From 87d4ec0c7e5a547e9ce6d2612bcbdafb51b7db29 Mon Sep 17 00:00:00 2001 From: WBHarry Date: Fri, 8 Aug 2025 20:14:14 +0200 Subject: [PATCH] Added reroll icon --- module/dice/damageRoll.mjs | 8 ++++++-- templates/ui/chat/parts/damage-part.hbs | 1 + 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/module/dice/damageRoll.mjs b/module/dice/damageRoll.mjs index 5a2eeb52..8d6347e8 100644 --- a/module/dice/damageRoll.mjs +++ b/module/dice/damageRoll.mjs @@ -195,11 +195,15 @@ export default class DamageRoll extends DHRoll { results.splice(Number(result) + 1, 0, newResult[0]); const rerolledDice = parsedRoll.dice.map((x, index) => { - if (index !== Number(dice)) return { ...x, dice: x.denomination }; + const isRerollDice = index === Number(dice); + if (!isRerollDice) return { ...x, dice: x.denomination }; return { dice: parsedRoll.dice[dice].denomination, total: parsedRoll.dice[dice].total, - results: results + results: results.map(result => ({ + ...result, + hasRerolls: result.hasRerolls || isRerollDice + })) }; }); diff --git a/templates/ui/chat/parts/damage-part.hbs b/templates/ui/chat/parts/damage-part.hbs index 10c8a6f5..232b1303 100644 --- a/templates/ui/chat/parts/damage-part.hbs +++ b/templates/ui/chat/parts/damage-part.hbs @@ -33,6 +33,7 @@ class="dice reroll-button {{../dice}}" data-die-index="0" data-type="damage" data-damage-type="{{@../../../key}}" data-part="{{@../../key}}" data-dice="{{@../key}}" data-result="{{@key}}" > + {{#if hasRerolls}}{{/if}} {{result}}