diff --git a/module/blades-actor.js b/module/blades-actor.js index 223ab67a..f5fe20f7 100644 --- a/module/blades-actor.js +++ b/module/blades-actor.js @@ -99,7 +99,7 @@ class BladesActor extends Actor { get archivedSubActors() { return this.subActors.filter((subActor) => subActor.hasTag(Tag.System.Archived)); } checkActorPrereqs(actor) { - return true; + return actor && true; } processEmbeddedActorMatches(globalActors) { return globalActors @@ -279,8 +279,8 @@ class BladesActor extends Actor { switch (pType) { case PrereqType.HasActiveItem: { const thisItem = this.activeSubItems - .filter((item) => !hitRecord[pType]?.includes(item.id)) - .find((item) => item.system.world_name === pString); + .filter((i) => !hitRecord[pType]?.includes(i.id)) + .find((i) => i.system.world_name === pString); if (thisItem) { hitRecord[pType].push(thisItem.id); } @@ -291,8 +291,8 @@ class BladesActor extends Actor { } case PrereqType.HasActiveItemsByTag: { const thisItem = this.activeSubItems - .filter((item) => !hitRecord[pType]?.includes(item.id)) - .find((item) => item.hasTag(pString)); + .filter((i) => !hitRecord[pType]?.includes(i.id)) + .find((i) => i.hasTag(pString)); if (thisItem) { hitRecord[pType].push(thisItem.id); } @@ -539,14 +539,24 @@ class BladesActor extends Actor { return dialogData; } getSubItem(itemRef, activeOnly = false) { + const activeCheck = (i) => !activeOnly || !i.hasTag(Tag.System.Archived); if (typeof itemRef === "string" && this.items.get(itemRef)) { - return this.items.get(itemRef); + const returnItem = this.items.get(itemRef); + if (returnItem && activeCheck(returnItem)) { + return returnItem; + } + else { + return undefined; + } } - const globalItem = BladesItem.Get(itemRef); - if (!globalItem) { - return undefined; + else { + const globalItem = BladesItem.Get(itemRef); + if (!globalItem) { + return undefined; + } + return this.items.find((item) => item.name === globalItem.name && activeCheck(item)) + ?? this.items.find((item) => item.system.world_name === globalItem.system.world_name && activeCheck(item)); } - return this.items.find((item) => item.name === globalItem.name) ?? this.items.find((item) => item.system.world_name === globalItem.system.world_name); } hasSubItemOf(itemRef) { const item = BladesItem.Get(itemRef); @@ -765,7 +775,7 @@ class BladesActor extends Actor { return this.activeSubItems.filter((item) => [BladesItemType.cohort_gang, BladesItemType.cohort_expert].includes(item.type)); } getTaggedItemBonuses(tags) { - return 0; + return tags.length; } prepareDerivedData() { @@ -775,12 +785,6 @@ class BladesActor extends Actor { if (BladesActor.IsType(this, BladesActorType.crew)) { this._prepareCrewData(this.system); } - if (BladesActor.IsType(this, BladesActorType.npc)) { - this._prepareNPCData(this.system); - } - if (BladesActor.IsType(this, BladesActorType.faction)) { - this._prepareFactionData(this.system); - } } _preparePCData(system) { if (!BladesActor.IsType(this, BladesActorType.pc)) { @@ -802,16 +806,6 @@ class BladesActor extends Actor { system.turfs = this.playbook.system.turfs; } } - _prepareNPCData(system) { - if (!BladesActor.IsType(this, BladesActorType.npc)) { - return; - } - } - _prepareFactionData(system) { - if (!BladesActor.IsType(this, BladesActorType.faction)) { - return; - } - } async _onCreateDescendantDocuments(parent, collection, docs, data, options, userId) { await Promise.all(docs.map(async (doc) => { @@ -861,14 +855,16 @@ class BladesActor extends Actor { } rollAttributePopup(attribute_name) { - const attribute_label = U.tCase(attribute_name); + const attribute_label = U.tCase(attribute_name); + const MIN_DICE_MOD = -3; + const MAX_DICE_MOD = 3; let content = `