[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
This commit is contained in:
Nick Salyzyn 2025-12-23 06:17:50 -07:00 committed by GitHub
parent a168d8de65
commit 0f5f866b22
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 7 additions and 6 deletions

View file

@ -9,6 +9,9 @@ export default class DhActiveEffectConfig extends foundry.applications.sheets.Ac
if (!ignoredActorKeys.includes(key)) { if (!ignoredActorKeys.includes(key)) {
const model = game.system.api.models.actors[key]; const model = game.system.api.models.actors[key];
const attributes = CONFIG.Token.documentClass.getTrackedAttributes(model); 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 group = game.i18n.localize(model.metadata.label);
const choices = CONFIG.Token.documentClass const choices = CONFIG.Token.documentClass
.getTrackedAttributeChoices(attributes, model) .getTrackedAttributeChoices(attributes, model)

View file

@ -60,15 +60,13 @@ export default class DhpAdversary extends BaseDataActor {
0, 0,
0, 0,
'DAGGERHEART.GENERAL.HitPoints.plural', 'DAGGERHEART.GENERAL.HitPoints.plural',
true, true
game.i18n.localize('DAGGERHEART.GENERAL.max')
), ),
stress: resourceField( stress: resourceField(
0, 0,
0, 0,
'DAGGERHEART.GENERAL.stress', 'DAGGERHEART.GENERAL.stress',
true, true
game.i18n.localize('DAGGERHEART.GENERAL.max')
) )
}), }),
rules: new fields.SchemaField({ rules: new fields.SchemaField({

View file

@ -22,12 +22,12 @@
<fieldset class="flex"> <fieldset class="flex">
<legend>{{localize "DAGGERHEART.GENERAL.HitPoints.plural"}}</legend> <legend>{{localize "DAGGERHEART.GENERAL.HitPoints.plural"}}</legend>
{{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.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")}}
</fieldset> </fieldset>
<fieldset class="flex"> <fieldset class="flex">
<legend>{{localize "DAGGERHEART.GENERAL.stress"}}</legend> <legend>{{localize "DAGGERHEART.GENERAL.stress"}}</legend>
{{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.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")}}
</fieldset> </fieldset>
</div> </div>