From 0f5f866b2225ec3bf5e83fe016ac3c989e257999 Mon Sep 17 00:00:00 2001 From: Nick Salyzyn Date: Tue, 23 Dec 2025 06:17:50 -0700 Subject: [PATCH] [PR] Adding max attributes to the action list and missing localization for them (#1446) * Adding max attributes and missing localization for them * Making sure the adversary settings page has only 'max' in the fieldset --- module/applications/sheets-configs/activeEffectConfig.mjs | 3 +++ module/data/actor/adversary.mjs | 6 ++---- templates/sheets-settings/adversary-settings/details.hbs | 4 ++-- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/module/applications/sheets-configs/activeEffectConfig.mjs b/module/applications/sheets-configs/activeEffectConfig.mjs index 468aba5c..d7b1b536 100644 --- a/module/applications/sheets-configs/activeEffectConfig.mjs +++ b/module/applications/sheets-configs/activeEffectConfig.mjs @@ -9,6 +9,9 @@ export default class DhActiveEffectConfig extends foundry.applications.sheets.Ac if (!ignoredActorKeys.includes(key)) { const model = game.system.api.models.actors[key]; const attributes = CONFIG.Token.documentClass.getTrackedAttributes(model); + // As per DHToken._getTrackedAttributesFromSchema, attributes.bar have a max version as well. + const maxAttributes = attributes.bar.map(x => [...x, 'max']); + attributes.value.push(...maxAttributes); const group = game.i18n.localize(model.metadata.label); const choices = CONFIG.Token.documentClass .getTrackedAttributeChoices(attributes, model) diff --git a/module/data/actor/adversary.mjs b/module/data/actor/adversary.mjs index a7b66d4d..32f5c979 100644 --- a/module/data/actor/adversary.mjs +++ b/module/data/actor/adversary.mjs @@ -60,15 +60,13 @@ export default class DhpAdversary extends BaseDataActor { 0, 0, 'DAGGERHEART.GENERAL.HitPoints.plural', - true, - game.i18n.localize('DAGGERHEART.GENERAL.max') + true ), stress: resourceField( 0, 0, 'DAGGERHEART.GENERAL.stress', - true, - game.i18n.localize('DAGGERHEART.GENERAL.max') + true ) }), rules: new fields.SchemaField({ diff --git a/templates/sheets-settings/adversary-settings/details.hbs b/templates/sheets-settings/adversary-settings/details.hbs index 0eb8da30..065ebe74 100644 --- a/templates/sheets-settings/adversary-settings/details.hbs +++ b/templates/sheets-settings/adversary-settings/details.hbs @@ -22,12 +22,12 @@
{{localize "DAGGERHEART.GENERAL.HitPoints.plural"}} {{formGroup systemFields.resources.fields.hitPoints.fields.value value=document._source.system.resources.hitPoints.value label=(localize "DAGGERHEART.ACTORS.Adversary.FIELDS.resources.hitPoints.value.label")}} - {{formGroup systemFields.resources.fields.hitPoints.fields.max value=document._source.system.resources.hitPoints.max}} + {{formGroup systemFields.resources.fields.hitPoints.fields.max value=document._source.system.resources.hitPoints.max label=(localize "DAGGERHEART.ACTORS.Adversary.FIELDS.resources.hitPoints.max.label")}}
{{localize "DAGGERHEART.GENERAL.stress"}} {{formGroup systemFields.resources.fields.stress.fields.value value=document._source.system.resources.stress.value label=(localize "DAGGERHEART.ACTORS.Adversary.FIELDS.resources.stress.value.label")}} - {{formGroup systemFields.resources.fields.stress.fields.max value=document._source.system.resources.stress.max}} + {{formGroup systemFields.resources.fields.stress.fields.max value=document._source.system.resources.stress.max label=(localize "DAGGERHEART.ACTORS.Adversary.FIELDS.resources.stress.max.label")}}