Added reroll icon

This commit is contained in:
WBHarry 2025-08-08 20:14:14 +02:00
parent b44d4695ad
commit 87d4ec0c7e
2 changed files with 7 additions and 2 deletions

View file

@ -195,11 +195,15 @@ export default class DamageRoll extends DHRoll {
results.splice(Number(result) + 1, 0, newResult[0]); results.splice(Number(result) + 1, 0, newResult[0]);
const rerolledDice = parsedRoll.dice.map((x, index) => { 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 { return {
dice: parsedRoll.dice[dice].denomination, dice: parsedRoll.dice[dice].denomination,
total: parsedRoll.dice[dice].total, total: parsedRoll.dice[dice].total,
results: results results: results.map(result => ({
...result,
hasRerolls: result.hasRerolls || isRerollDice
}))
}; };
}); });

View file

@ -33,6 +33,7 @@
class="dice reroll-button {{../dice}}" 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}}" data-die-index="0" data-type="damage" data-damage-type="{{@../../../key}}" data-part="{{@../../key}}" data-dice="{{@../key}}" data-result="{{@key}}"
> >
{{#if hasRerolls}}<i class="fa-solid fa-dice dice-rerolled" data-tooltip="{{localize "Rerolled"}}"></i>{{/if}}
{{result}} {{result}}
</div> </div>
</div> </div>