From a65937515718d0b26677bafacb984d40086bf581 Mon Sep 17 00:00:00 2001 From: Dapoolp Date: Tue, 26 Aug 2025 16:48:02 +0200 Subject: [PATCH] Fixes --- lang/en.json | 1 + module/applications/dialogs/d20RollDialog.mjs | 28 +++++++++---------- module/data/action/baseAction.mjs | 6 +++- styles/less/global/elements.less | 1 + styles/less/global/global.less | 2 +- templates/actionTypes/save.hbs | 11 +++++--- templates/dialogs/dice-roll/rollSelection.hbs | 14 ++-------- 7 files changed, 31 insertions(+), 32 deletions(-) diff --git a/lang/en.json b/lang/en.json index 7799cf84..d3d707d6 100755 --- a/lang/en.json +++ b/lang/en.json @@ -96,6 +96,7 @@ "attackName": "Attack Name", "includeBase": { "label": "Include Item Damage" }, "multiplier": "Multiplier", + "saveHint": "Set a default Trait to enable Reaction Roll. It can be changed later in Reaction Roll Dialog.", "resultBased": { "label": "Formula based on Hope/Fear result." }, diff --git a/module/applications/dialogs/d20RollDialog.mjs b/module/applications/dialogs/d20RollDialog.mjs index 2b048218..2546e127 100644 --- a/module/applications/dialogs/d20RollDialog.mjs +++ b/module/applications/dialogs/d20RollDialog.mjs @@ -141,7 +141,7 @@ export default class D20RollDialog extends HandlebarsApplicationMixin(Applicatio this.roll[key] = value; }); } - if(rest.trait) this.config.roll.trait = rest.trait; + if(rest.hasOwnProperty("trait")) this.config.roll.trait = rest.trait; this.config.extraFormula = rest.extraFormula; this.render(); } @@ -160,20 +160,18 @@ export default class D20RollDialog extends HandlebarsApplicationMixin(Applicatio this.config.experiences.indexOf(button.dataset.key) > -1 ? this.config.experiences.filter(x => x !== button.dataset.key) : [...this.config.experiences, button.dataset.key]; - if (this.config?.data?.parent?.type === 'character' || this.config?.data?.parent?.type === 'companion') { - this.config.costs = - this.config.costs.indexOf(this.config.costs.find(c => c.extKey === button.dataset.key)) > -1 - ? this.config.costs.filter(x => x.extKey !== button.dataset.key) - : [ - ...this.config.costs, - { - extKey: button.dataset.key, - key: 'hope', - value: 1, - name: this.config.data?.experiences?.[button.dataset.key]?.name - } - ]; - } + this.config.costs = + this.config.costs.indexOf(this.config.costs.find(c => c.extKey === button.dataset.key)) > -1 + ? this.config.costs.filter(x => x.extKey !== button.dataset.key) + : [ + ...this.config.costs, + { + extKey: button.dataset.key, + key: this.config?.data?.parent?.isNPC ? 'fear' : 'hope', + value: 1, + name: this.config.data?.experiences?.[button.dataset.key]?.name + } + ]; this.render(); } diff --git a/module/data/action/baseAction.mjs b/module/data/action/baseAction.mjs index 1497742c..6e522ceb 100644 --- a/module/data/action/baseAction.mjs +++ b/module/data/action/baseAction.mjs @@ -43,6 +43,9 @@ export default class DHBaseAction extends ActionMixin(foundry.abstract.DataModel /** * Create a Map containing each Action step based on fields define in schema. Ordered by Fields order property. + * + * Each step can be called individually as long as needed config is provided. + * Ex: .workflow.get("damage").execute(config) * @returns {Map} */ defineWorkflow() { @@ -254,7 +257,8 @@ export default class DHBaseAction extends ActionMixin(foundry.abstract.DataModel } /** - * + * Consume Action configured resources & uses. + * That method is only used when we want those resources to be consumed outside of the use method workflow. * @param {object} config Object that contains workflow datas. Usually made from Action Fields prepareConfig methods. * @param {boolean} successCost */ diff --git a/styles/less/global/elements.less b/styles/less/global/elements.less index 399715ca..e4a2128c 100755 --- a/styles/less/global/elements.less +++ b/styles/less/global/elements.less @@ -624,6 +624,7 @@ .form-group { justify-content: end; + flex-wrap: nowrap; } .hint { diff --git a/styles/less/global/global.less b/styles/less/global/global.less index cf8431b5..e135846f 100644 --- a/styles/less/global/global.less +++ b/styles/less/global/global.less @@ -18,7 +18,7 @@ color: var(--color-form-hint); } - &:hover { + .form-group:hover { .hint { color: var(--color-form-hint-hover); } diff --git a/templates/actionTypes/save.hbs b/templates/actionTypes/save.hbs index 3980cc99..85536c87 100644 --- a/templates/actionTypes/save.hbs +++ b/templates/actionTypes/save.hbs @@ -1,6 +1,9 @@ -
+
{{localize "DAGGERHEART.GENERAL.Roll.reaction"}} - {{formField fields.trait label="Trait" name="save.trait" value=source.trait localize=true}} - {{formField fields.difficulty label="Difficulty" name="save.difficulty" value=source.difficulty disabled=(not source.trait) placeholder=@root.baseSaveDifficulty}} - {{formField fields.damageMod label="Damage on Save" name="save.damageMod" value=source.damageMod localize=true disabled=(not source.trait)}} +

{{localize "DAGGERHEART.ACTIONS.Settings.saveHint"}}

+
+ {{formField fields.trait label="Trait" name="save.trait" value=source.trait localize=true}} + {{formField fields.difficulty label="Difficulty" name="save.difficulty" value=source.difficulty disabled=(not source.trait) placeholder=@root.baseSaveDifficulty}} + {{formField fields.damageMod label="Damage on Save" name="save.damageMod" value=source.damageMod localize=true disabled=(not source.trait)}} +
\ No newline at end of file diff --git a/templates/dialogs/dice-roll/rollSelection.hbs b/templates/dialogs/dice-roll/rollSelection.hbs index 18bb1429..6a4655d6 100644 --- a/templates/dialogs/dice-roll/rollSelection.hbs +++ b/templates/dialogs/dice-roll/rollSelection.hbs @@ -75,16 +75,8 @@ {{#each experiences}} {{#if name}}
- {{#if (includes ../selectedExperiences id)}} - - {{else}} - - {{/if}} - {{#if (eq @root.rollType 'D20Roll')}} - {{name}} +{{modifier}} - {{else}} - {{name}} +{{value}} - {{/if}} + + {{name}} +{{value}}
{{/if}} {{/each}} @@ -129,7 +121,7 @@ {{#if abilities}} {{localize "DAGGERHEART.GENERAL.traitModifier"}} {{/if}} {{/unless}}