Added ArmoreEffect.armorInteraction option

This commit is contained in:
WBHarry 2026-02-11 17:00:58 +01:00
parent c067fd0e10
commit 10baf0ba10
9 changed files with 62 additions and 24 deletions

View file

@ -9,6 +9,7 @@ export default class ArmorActiveEffectConfig extends HandlebarsApplicationMixin(
submitOnChange: true,
closeOnSubmit: false
},
position: { width: 560 },
actions: {
finish: ArmorActiveEffectConfig.#finish
}

View file

@ -890,3 +890,9 @@ export const activeEffectModes = {
label: 'EFFECT.CHANGES.TYPES.override'
}
};
export const activeEffectArmorInteraction = {
none: { id: 'none', label: 'DAGGERHEART.CONFIG.ArmorInteraction.none.label' },
active: { id: 'active', label: 'DAGGERHEART.CONFIG.ArmorInteraction.active.label' },
inactive: { id: 'inactive', label: 'DAGGERHEART.CONFIG.ArmorInteraction.inactive.label' }
};

View file

@ -51,10 +51,30 @@ export default class ArmorEffect extends foundry.data.ActiveEffectTypeDataModel
}
]
}
)
),
armorInteraction: new fields.StringField({
required: true,
choices: CONFIG.DH.GENERAL.activeEffectArmorInteraction,
initial: CONFIG.DH.GENERAL.activeEffectArmorInteraction.none.id,
label: 'DAGGERHEART.EFFECTS.Armor.FIELDS.armorInteraction.label',
hint: 'DAGGERHEART.EFFECTS.Armor.FIELDS.armorInteraction.hint'
})
};
}
get isSuppressed() {
if (this.parent.actor?.type !== 'character') return false;
switch (this.armorInteraction) {
case CONFIG.DH.GENERAL.activeEffectArmorInteraction.active.id:
return !this.parent.actor.system.armor;
case CONFIG.DH.GENERAL.activeEffectArmorInteraction.inactive.id:
return Boolean(this.parent.actor.system.armor);
default:
return false;
}
}
/* Type Functions */
/**

View file

@ -8,6 +8,8 @@ export default class DhActiveEffect extends foundry.documents.ActiveEffect {
/**@override */
get isSuppressed() {
if (this.system.isSuppressed === true) return true;
// If this is a copied effect from an attachment, never suppress it
// (These effects have attachmentSource metadata)
if (this.flags?.daggerheart?.attachmentSource) {