Skip to content

Commit

Permalink
feat(active_effects): very WIP active effect implementation
Browse files Browse the repository at this point in the history
* add AE support for signature abilities

#1215
  • Loading branch information
wrycu committed May 20, 2023
1 parent d2c351f commit 129bc06
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion modules/helpers/item-helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ export default class ItemHelpers {
});
}
}
else if (['forcepower'].includes(parent_item.type)) {
else if (['forcepower', 'signatureability'].includes(parent_item.type)) {
for (const upgrade_id of Object.keys(parent_item.system?.upgrades)) {
let upgrade_data = parent_item.system.upgrades[upgrade_id];
if (Object.keys(upgrade_data).includes('attributes')) {
Expand Down
4 changes: 2 additions & 2 deletions modules/helpers/modifiers.js
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ export default class ModifierHelpers {
console.log(this.item)
console.log(this)
if (this.id === 'popout-modifiers') {
if (this.object.parent.type === 'forcepower') {
if (this.object.parent.type === 'forcepower' || this.object.parent.type === 'signatureability') {
// create the active effect after submitting the change because things go wrong in the other order
await this.object.parent.createEmbeddedDocuments("ActiveEffect", [{
label: `attr${nk}`,
Expand Down Expand Up @@ -363,7 +363,7 @@ export default class ModifierHelpers {
const delete_id = $(li).attr('data-attribute');
// find the matching active effect
const to_delete = [];
if (this.id === 'popout-modifiers' && this.object.parent.type === 'forcepower') {
if (this.id === 'popout-modifiers' && this.object.parent.type === 'forcepower' || this.object.parent.type === 'signatureability') {
this.object.parent.getEmbeddedCollection("ActiveEffect").filter(i => i.label === delete_id).forEach(function (item) {
to_delete.push(item.id);
});
Expand Down
5 changes: 3 additions & 2 deletions modules/items/item-ffg.js
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ export class ItemFFG extends ItemBaseFFG {
}

if (this.type === "signatureability") {
this._prepareSignatureAbilities();
await this._prepareSignatureAbilities();
}
}
/**
Expand Down Expand Up @@ -484,8 +484,9 @@ export class ItemFFG extends ItemBaseFFG {
await ItemHelpers.syncModifierActiveEffects(this);
}

_prepareSignatureAbilities() {
async _prepareSignatureAbilities() {
this._prepareTalentTrees("upgrades", "upgrade", "powerUpgrades");
await ItemHelpers.syncModifierActiveEffects(this);
}

_updateSpecializationTalentReference(specializationTalentItem, talentItem) {
Expand Down

0 comments on commit 129bc06

Please sign in to comment.