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

@ -751,6 +751,11 @@
"bruiser": "for each Bruiser adversary.",
"solo": "for each Solo adversary."
},
"ArmorInteraction": {
"none": { "label": "Ignores Armor" },
"active": { "label": "Only Active With Armor" },
"inactive": { "label": "Only Active Without Armor" }
},
"ArmorFeature": {
"burning": {
"name": "Burning",
@ -1851,7 +1856,13 @@
"transferHint": "If checked, this effect will be applied to any actor that owns this Effect's parent Item. The effect is always applied if this Item is attached to another one."
},
"Armor": {
"newArmorEffect": "Armor Effect"
"newArmorEffect": "Armor Effect",
"FIELDS": {
"armorInteraction": {
"label": "Armor Interaction",
"hint": "Does the character wearing armor suppress this effect?"
}
}
}
},
"GENERAL": {

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) {

View file

@ -101,7 +101,8 @@
"value": 0,
"max": "1"
}
]
],
"armorInteraction": "active"
},
"_id": "tJw2JIPcT9hEMRXg",
"img": "icons/tools/hand/hammer-and-nail.webp",
@ -112,7 +113,7 @@
"expiry": null,
"expired": false
},
"description": "<p><span style=\"color:rgb(239, 230, 216);font-family:Montserrat, sans-serif;font-size:14px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;orphans:2;text-align:start;text-indent:0px;text-transform:none;widows:2;word-spacing:0px;-webkit-text-stroke-width:0px;white-space:normal;background-color:rgba(24, 22, 46, 0.376);text-decoration-thickness:initial;text-decoration-style:initial;text-decoration-color:initial;display:inline !important;float:none\">While youre wearing armor, gain a +1 bonus to your </span><span class=\"tooltip-convert\" style=\"box-sizing:border-box;scrollbar-width:thin;scrollbar-color:rgb(93, 20, 43) rgba(0, 0, 0, 0);color:rgb(239, 230, 216);font-family:Montserrat, sans-serif;font-size:14px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;orphans:2;text-align:start;text-indent:0px;text-transform:none;widows:2;word-spacing:0px;-webkit-text-stroke-width:0px;white-space:normal;background-color:rgba(24, 22, 46, 0.376);text-decoration-thickness:initial;text-decoration-style:initial;text-decoration-color:initial\">Armor Score</span><span style=\"color:rgb(239, 230, 216);font-family:Montserrat, sans-serif;font-size:14px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;orphans:2;text-align:start;text-indent:0px;text-transform:none;widows:2;word-spacing:0px;-webkit-text-stroke-width:0px;white-space:normal;background-color:rgba(24, 22, 46, 0.376);text-decoration-thickness:initial;text-decoration-style:initial;text-decoration-color:initial;display:inline !important;float:none\">.</span></p>",
"description": "<p><span style=\"color:rgb(239, 230, 216);font-family:Montserrat, sans-serif;font-size:14px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;orphans:2;text-align:start;text-indent:0px;text-transform:none;widows:2;word-spacing:0px;-webkit-text-stroke-width:0px;white-space:normal;background-color:rgba(24, 22, 46, 0.376);text-decoration-thickness:initial;text-decoration-style:initial;text-decoration-color:initial;display:inline !important;float:none\">While youre wearing armor, gain a +1 bonus to your </span><span style=\"box-sizing:border-box;scrollbar-width:thin;scrollbar-color:rgb(93, 20, 43) rgba(0, 0, 0, 0);color:rgb(239, 230, 216);font-family:Montserrat, sans-serif;font-size:14px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;orphans:2;text-align:start;text-indent:0px;text-transform:none;widows:2;word-spacing:0px;-webkit-text-stroke-width:0px;white-space:normal;background-color:rgba(24, 22, 46, 0.376);text-decoration-thickness:initial;text-decoration-style:initial;text-decoration-color:initial\" class=\"tooltip-convert\">Armor Score</span><span style=\"color:rgb(239, 230, 216);font-family:Montserrat, sans-serif;font-size:14px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;orphans:2;text-align:start;text-indent:0px;text-transform:none;widows:2;word-spacing:0px;-webkit-text-stroke-width:0px;white-space:normal;background-color:rgba(24, 22, 46, 0.376);text-decoration-thickness:initial;text-decoration-style:initial;text-decoration-color:initial;display:inline !important;float:none\">.</span></p>",
"origin": null,
"tint": "#ffffff",
"transfer": true,

View file

@ -33,7 +33,8 @@
"phase": "initial",
"priority": 20
}
]
],
"armorInteraction": "inactive"
},
"_id": "FCsgz7Tdsw6QUzBs",
"img": "icons/magic/control/buff-strength-muscle-damage-orange.webp",

View file

@ -1,16 +1,5 @@
.application.sheet.daggerheart.dh-style.armor-effect-config {
.armor-effects-container {
display: flex;
flex-direction: column;
gap: 8px;
.armor-effect-container {
display: flex;
gap: 4px;
* {
flex: 1;
}
}
.tab-form-footer {
margin-top: 8px;
}
}

View file

@ -1,10 +1,17 @@
<section class="tab{{#if tab.active}} active{{/if}}" data-group="{{tab.group}}" data-tab="{{tab.id}}">
<div class="armor-effects-container">
{{#each source.system.changes as |change index|}}
<div class="armor-effect-container">
<fieldset>
<legend>{{localize "Armor"}}</legend>
<div class="two-columns even">
{{#each source.system.changes as |change index|}}
{{formGroup @root.systemFields.changes.element.fields.value name=(concat 'system.changes.' index '.value') value=change.value localize=true}}
{{formGroup @root.systemFields.changes.element.fields.max name=(concat 'system.changes.' index '.max') value=change.max localize=true}}
</div>
{{/each}}
</div>
{{/each}}
</div>
</fieldset>
<fieldset>
<legend>{{localize "DAGGERHEART.GENERAL.general"}}</legend>
{{formGroup @root.systemFields.armorInteraction name="system.armorInteraction" value=source.system.armorInteraction localize=true}}
</fieldset>
</section>