From df5373cd209d86fef95a9e8d50fe75f29488b0c6 Mon Sep 17 00:00:00 2001 From: Dapoulp <74197441+Dapoulp@users.noreply.github.com> Date: Sun, 10 Aug 2025 16:52:36 +0200 Subject: [PATCH] Fix bardic rally showing in damage dialog when it should not (#783) --- module/dice/damageRoll.mjs | 35 ++++++++++--------- .../dialogs/dice-roll/damageSelection.hbs | 4 +-- 2 files changed, 21 insertions(+), 18 deletions(-) diff --git a/module/dice/damageRoll.mjs b/module/dice/damageRoll.mjs index 44794faa..8a72d86e 100644 --- a/module/dice/damageRoll.mjs +++ b/module/dice/damageRoll.mjs @@ -159,25 +159,28 @@ export default class DamageRoll extends DHRoll { if (config.data?.parent) { if (config.data.parent.appliedEffects) { // Bardic Rally - mods.rally = { - label: 'DAGGERHEART.CLASS.Feature.rallyDice', - values: config.data?.parent?.appliedEffects.reduce((a, c) => { + const rallyChoices = config.data?.parent?.appliedEffects.reduce((a, c) => { const change = c.changes.find(ch => ch.key === 'system.bonuses.rally'); if (change) a.push({ value: c.id, label: change.value }); return a; - }, []), - value: null, - beforeCrit: true, - callback: part => { - const rallyFaces = config.modifiers.rally.values.find( - r => r.value === config.modifiers.rally.value - )?.label; - part.roll.terms.push( - new foundry.dice.terms.OperatorTerm({ operator: '+' }), - ...this.parse(`1${rallyFaces}`) - ); - } - }; + }, []) + if(rallyChoices.length) { + mods.rally = { + label: 'DAGGERHEART.CLASS.Feature.rallyDice', + values: rallyChoices, + value: null, + beforeCrit: true, + callback: part => { + const rallyFaces = config.modifiers.rally.values.find( + r => r.value === config.modifiers.rally.value + )?.label; + part.roll.terms.push( + new foundry.dice.terms.OperatorTerm({ operator: '+' }), + ...this.parse(`1${rallyFaces}`) + ); + } + }; + } } const item = config.data.parent.items?.get(config.source.item); diff --git a/templates/dialogs/dice-roll/damageSelection.hbs b/templates/dialogs/dice-roll/damageSelection.hbs index be49906b..ba542666 100644 --- a/templates/dialogs/dice-roll/damageSelection.hbs +++ b/templates/dialogs/dice-roll/damageSelection.hbs @@ -24,7 +24,7 @@ {{/each}} - {{#if @root.modifiers}} + {{#unless (empty @root.modifiers)}}
{{localize "DAGGERHEART.GENERAL.Modifier.plural"}} {{#each @root.modifiers}} @@ -39,7 +39,7 @@ {{/if}} {{/each}}
- {{/if}} + {{/unless}}
{{#if directDamage}}