[Fix] ActiveEffectConfig Missing Resistances (#1653)

* Fixed so that ActiveEffectConfig uses missing hints and has resistance in the autocomplete list

* Raised version
This commit is contained in:
WBHarry 2026-02-11 23:59:27 +01:00 committed by GitHub
parent 95d4003045
commit 6cbe770880
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 22 additions and 14 deletions

View file

@ -243,14 +243,17 @@ Hooks.on('setup', () => {
})) }))
]; ];
const actorCommon = {
bar: ['resources.stress'],
value: []
};
const damageThresholds = ['damageThresholds.major', 'damageThresholds.severe']; const damageThresholds = ['damageThresholds.major', 'damageThresholds.severe'];
const traits = Object.keys(game.system.api.data.actors.DhCharacter.schema.fields.traits.fields).map( const traits = Object.keys(game.system.api.data.actors.DhCharacter.schema.fields.traits.fields).map(
trait => `traits.${trait}.value` 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 = { CONFIG.Actor.trackableAttributes = {
character: { character: {
bar: [...actorCommon.bar, 'resources.hitPoints', 'resources.hope'], bar: [...actorCommon.bar, 'resources.hitPoints', 'resources.hope'],

View file

@ -2111,7 +2111,7 @@
"thresholdImmunities": { "thresholdImmunities": {
"minor": { "minor": {
"label": "Threshold Immunities: Minor", "label": "Threshold Immunities: Minor",
"hint": "Automatically ignores minor damage" "hint": "Automatically ignores minor damage when set to 1"
} }
} }
}, },

View file

@ -30,22 +30,27 @@ export default class DhActiveEffectConfig extends foundry.applications.sheets.Ac
const group = game.i18n.localize(model.metadata.label); const group = game.i18n.localize(model.metadata.label);
const attributes = CONFIG.Token.documentClass.getTrackedAttributes(model.metadata.type); const attributes = CONFIG.Token.documentClass.getTrackedAttributes(model.metadata.type);
const getLabel = path => { const getTranslations = path => {
const label = model.schema.getField(path)?.label; if (path === 'resources.hope.max')
return label ? game.i18n.localize(label) : path; 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 bars = attributes.bar.flatMap(x => {
const joined = `${x.join('.')}.max`; const joined = `${x.join('.')}.max`;
const label = return { value: joined, ...getTranslations(joined), group };
joined === 'resources.hope.max'
? 'DAGGERHEART.SETTINGS.Homebrew.FIELDS.maxHope.label'
: getLabel(joined);
return { value: joined, label, group };
}); });
const values = attributes.value.flatMap(x => { const values = attributes.value.flatMap(x => {
const joined = x.join('.'); 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); const bonuses = getAllLeaves(model.schema.fields.bonuses, group);