From 6cbe7708801c0795d567fb1a544d19d0702cb95e Mon Sep 17 00:00:00 2001 From: WBHarry <89362246+WBHarry@users.noreply.github.com> Date: Wed, 11 Feb 2026 23:59:27 +0100 Subject: [PATCH] [Fix] ActiveEffectConfig Missing Resistances (#1653) * Fixed so that ActiveEffectConfig uses missing hints and has resistance in the autocomplete list * Raised version --- daggerheart.mjs | 11 +++++---- lang/en.json | 2 +- .../sheets-configs/activeEffectConfig.mjs | 23 +++++++++++-------- 3 files changed, 22 insertions(+), 14 deletions(-) diff --git a/daggerheart.mjs b/daggerheart.mjs index 49ed7049..e418401a 100644 --- a/daggerheart.mjs +++ b/daggerheart.mjs @@ -243,14 +243,17 @@ Hooks.on('setup', () => { })) ]; - const actorCommon = { - bar: ['resources.stress'], - value: [] - }; const damageThresholds = ['damageThresholds.major', 'damageThresholds.severe']; const traits = Object.keys(game.system.api.data.actors.DhCharacter.schema.fields.traits.fields).map( trait => `traits.${trait}.value` ); + const resistance = Object.values(game.system.api.data.actors.DhCharacter.schema.fields.resistance.fields).flatMap( + type => Object.keys(type.fields).map(x => `resistance.${type.name}.${x}`) + ); + const actorCommon = { + bar: ['resources.stress'], + value: [...resistance] + }; CONFIG.Actor.trackableAttributes = { character: { bar: [...actorCommon.bar, 'resources.hitPoints', 'resources.hope'], diff --git a/lang/en.json b/lang/en.json index 618beefc..19317228 100755 --- a/lang/en.json +++ b/lang/en.json @@ -2111,7 +2111,7 @@ "thresholdImmunities": { "minor": { "label": "Threshold Immunities: Minor", - "hint": "Automatically ignores minor damage" + "hint": "Automatically ignores minor damage when set to 1" } } }, diff --git a/module/applications/sheets-configs/activeEffectConfig.mjs b/module/applications/sheets-configs/activeEffectConfig.mjs index 8abc0b79..28db0efe 100644 --- a/module/applications/sheets-configs/activeEffectConfig.mjs +++ b/module/applications/sheets-configs/activeEffectConfig.mjs @@ -30,22 +30,27 @@ export default class DhActiveEffectConfig extends foundry.applications.sheets.Ac const group = game.i18n.localize(model.metadata.label); const attributes = CONFIG.Token.documentClass.getTrackedAttributes(model.metadata.type); - const getLabel = path => { - const label = model.schema.getField(path)?.label; - return label ? game.i18n.localize(label) : path; + const getTranslations = path => { + if (path === 'resources.hope.max') + return { + label: game.i18n.localize('DAGGERHEART.SETTINGS.Homebrew.FIELDS.maxHope.label'), + hint: '' + }; + + const field = model.schema.getField(path); + return { + label: field ? game.i18n.localize(field.label) : path, + hint: field ? game.i18n.localize(field.hint) : '' + }; }; const bars = attributes.bar.flatMap(x => { const joined = `${x.join('.')}.max`; - const label = - joined === 'resources.hope.max' - ? 'DAGGERHEART.SETTINGS.Homebrew.FIELDS.maxHope.label' - : getLabel(joined); - return { value: joined, label, group }; + return { value: joined, ...getTranslations(joined), group }; }); const values = attributes.value.flatMap(x => { const joined = x.join('.'); - return { value: joined, label: getLabel(joined), group }; + return { value: joined, ...getTranslations(joined), group }; }); const bonuses = getAllLeaves(model.schema.fields.bonuses, group);