From 16299a98652293476f53ad4b61d3901d0fb2c4a5 Mon Sep 17 00:00:00 2001 From: WBHarry <89362246+WBHarry@users.noreply.github.com> Date: Thu, 14 Aug 2025 19:21:12 +0200 Subject: [PATCH] Fixed damage reduction any (#937) --- module/applications/dialogs/damageReductionDialog.mjs | 4 ++-- module/data/fields/actorField.mjs | 1 - module/helpers/utils.mjs | 5 +++-- .../domains/domainCard_Get_Back_Up_BFWN2cObMdlk9uVz.json | 6 ------ .../domains/domainCard_Shrug_It_Off_JwfhtgmmuRxg4zhI.json | 6 ------ 5 files changed, 5 insertions(+), 17 deletions(-) diff --git a/module/applications/dialogs/damageReductionDialog.mjs b/module/applications/dialogs/damageReductionDialog.mjs index d8541396..b64149c0 100644 --- a/module/applications/dialogs/damageReductionDialog.mjs +++ b/module/applications/dialogs/damageReductionDialog.mjs @@ -39,7 +39,7 @@ export default class DamageReductionDialog extends HandlebarsApplicationMixin(Ap this.availableStressReductions = Object.keys(actor.system.rules.damageReduction.stressDamageReduction).reduce( (acc, key) => { const dr = actor.system.rules.damageReduction.stressDamageReduction[key]; - if (dr.enabled) { + if (dr.cost) { if (acc === null) acc = {}; const damage = damageKeyToNumber(key); @@ -260,7 +260,7 @@ export default class DamageReductionDialog extends HandlebarsApplicationMixin(Ap const reducedDamage = currentDamage !== this.damage ? getDamageLabel(currentDamage) : null; const currentDamageLabel = reducedDamage ?? getDamageLabel(this.damage); - if (stressReduction.from !== currentDamageLabel) return; + if (!stressReduction.any && stressReduction.from !== currentDamageLabel) return; stressReduction.selected = true; this.render(); diff --git a/module/data/fields/actorField.mjs b/module/data/fields/actorField.mjs index 3c65b984..f9eeeb90 100644 --- a/module/data/fields/actorField.mjs +++ b/module/data/fields/actorField.mjs @@ -20,7 +20,6 @@ const resourceField = (max = 0, initial = 0, label, reverse = false, maxLabel) = const stressDamageReductionRule = localizationPath => new fields.SchemaField({ - enabled: new fields.BooleanField({ required: true, initial: false }), cost: new fields.NumberField({ integer: true, label: `${localizationPath}.label`, diff --git a/module/helpers/utils.mjs b/module/helpers/utils.mjs index 439f1780..6f4e5a26 100644 --- a/module/helpers/utils.mjs +++ b/module/helpers/utils.mjs @@ -198,7 +198,7 @@ foundry.dice.terms.Die.prototype.selfCorrecting = function (modifier) { }; export const getDamageKey = damage => { - return ['none', 'minor', 'major', 'severe'][damage]; + return ['none', 'minor', 'major', 'severe', 'any'][damage]; }; export const getDamageLabel = damage => { @@ -210,7 +210,8 @@ export const damageKeyToNumber = key => { none: 0, minor: 1, major: 2, - severe: 3 + severe: 3, + any: 4 }[key]; }; diff --git a/src/packs/domains/domainCard_Get_Back_Up_BFWN2cObMdlk9uVz.json b/src/packs/domains/domainCard_Get_Back_Up_BFWN2cObMdlk9uVz.json index a2e1366b..91b55807 100644 --- a/src/packs/domains/domainCard_Get_Back_Up_BFWN2cObMdlk9uVz.json +++ b/src/packs/domains/domainCard_Get_Back_Up_BFWN2cObMdlk9uVz.json @@ -45,12 +45,6 @@ "mode": 5, "value": "1", "priority": null - }, - { - "key": "system.rules.damageReduction.stressDamageReduction.severe.enabled", - "mode": 5, - "value": "1", - "priority": null } ], "disabled": false, diff --git a/src/packs/domains/domainCard_Shrug_It_Off_JwfhtgmmuRxg4zhI.json b/src/packs/domains/domainCard_Shrug_It_Off_JwfhtgmmuRxg4zhI.json index 4a6d5a74..2b7ccf04 100644 --- a/src/packs/domains/domainCard_Shrug_It_Off_JwfhtgmmuRxg4zhI.json +++ b/src/packs/domains/domainCard_Shrug_It_Off_JwfhtgmmuRxg4zhI.json @@ -101,12 +101,6 @@ "mode": 5, "value": "1", "priority": null - }, - { - "key": "system.rules.damageReduction.stressDamageReduction.any.enabled", - "mode": 5, - "value": "1", - "priority": null } ], "disabled": false,