NPC on change : Linked actor for Adversary, unlinked for Minion

This commit is contained in:
Vlyan
2021-07-04 11:30:09 +02:00
parent 5d52f18baf
commit 4d8da8f26a
2 changed files with 10 additions and 5 deletions

View File

@@ -1,7 +1,7 @@
# Changelog # Changelog
## 1.3.2 - Ronin's Bubble ## 1.3.2 - Ronin's Bubble
- Replaced moving description in items by a big popup on hover. - Replaced moving description in items by a big tooltip on hover.
- Added PoW Revised 20Q (for old Ronin, just modify the template in 20Q to change the character sheet fields). - Added PoW Revised 20Q (for old Ronin, just modify the template in 20Q to change the character sheet fields).
- Added Bushido tenets on Social tab in sheet for all (I think this is useful for players, and it's in Core rulebook so... why this is not by default ;) ). - Added Bushido tenets on Social tab in sheet for all (I think this is useful for players, and it's in Core rulebook so... why this is not by default ;) ).
- Added English/French Journal Compendiums for Conditions and Terrain Qualities (thanks to TesserWract). - Added English/French Journal Compendiums for Conditions and Terrain Qualities (thanks to TesserWract).
@@ -9,6 +9,7 @@
- Added PoW Name Tables compendium : Qamarist Names, Ivory Kingdoms Names, Rokugani Names and Ujik Names. - Added PoW Name Tables compendium : Qamarist Names, Ivory Kingdoms Names, Rokugani Names and Ujik Names.
- Added ability to drop a (Curriculum) Journal to have a button in school experience tab. - Added ability to drop a (Curriculum) Journal to have a button in school experience tab.
- Added properties antagonists (ex : Sacred remove Unholy on drop). - Added properties antagonists (ex : Sacred remove Unholy on drop).
- Added when switching between NPC types, now the prototype token is altered this way : Linked actor for Adversary, unlinked for Minion.
- Fixed school compendium: "Kuni Warden School" from "Scorpion" to "Crab". - Fixed school compendium: "Kuni Warden School" from "Scorpion" to "Crab".
- Fixed roll for RollTable not showing the text. - Fixed roll for RollTable not showing the text.
- Fixed some Pdf Copy-Paste error in school cursus that make L instead of I: Lkoma/Lsawa/Luchi... - Fixed some Pdf Copy-Paste error in school cursus that make L instead of I: Lkoma/Lsawa/Luchi...

View File

@@ -65,7 +65,7 @@ export class ActorL5r5e extends Actor {
*/ */
async update(data = {}, context = {}) { async update(data = {}, context = {}) {
// Need a _id // Need a _id
if (!data._id) { if (!data["_id"]) {
data["_id"] = this.id; data["_id"] = this.id;
} }
@@ -73,8 +73,13 @@ export class ActorL5r5e extends Actor {
context.parent = this.parent; context.parent = this.parent;
context.pack = this.pack; context.pack = this.pack;
// NPC switch between types : Linked actor for Adversary, unlinked for Minion
if (this.data.type === "npc" && data["data.type"] !== this.data.data.type) {
data["token.actorLink"] = data["data.type"] === "adversary";
}
// Only on linked Actor // Only on linked Actor
if (data.token?.actorLink || (data.token?.actorLink === undefined && this.data.token.actorLink)) { if (!!data["token.actorLink"] || (data["token.actorLink"] === undefined && this.data.token.actorLink)) {
// Update the token name/image if the sheet name/image changed, but only if they was previously the same // Update the token name/image if the sheet name/image changed, but only if they was previously the same
["name", "img"].forEach((fieldName) => { ["name", "img"].forEach((fieldName) => {
if ( if (
@@ -88,8 +93,7 @@ export class ActorL5r5e extends Actor {
} }
// Now using updateDocuments // Now using updateDocuments
data = data instanceof Array ? data : [data]; return Actor.updateDocuments([data], context);
return Actor.updateDocuments(data, context);
} }
/** @override */ /** @override */