Fixed so rerolling damage doesn't make damageParts an object

This commit is contained in:
WBHarry 2025-08-15 21:16:44 +02:00
parent 006f9dde1f
commit 3f0457b8b9

View file

@ -137,7 +137,7 @@ export default class DamageRoll extends DHRoll {
} }
if (config.isCritical && part.applyTo === CONFIG.DH.GENERAL.healingTypes.hitPoints.id) { if (config.isCritical && part.applyTo === CONFIG.DH.GENERAL.healingTypes.hitPoints.id) {
const total = part.roll.dice.reduce((acc, term) => acc + term._faces*term._number, 0); const total = part.roll.dice.reduce((acc, term) => acc + term._faces * term._number, 0);
if (total > 0) { if (total > 0) {
part.roll.terms.push(...this.formatModifier(total)); part.roll.terms.push(...this.formatModifier(total));
} }
@ -164,8 +164,8 @@ export default class DamageRoll extends DHRoll {
const change = c.changes.find(ch => ch.key === 'system.bonuses.rally'); const change = c.changes.find(ch => ch.key === 'system.bonuses.rally');
if (change) a.push({ value: c.id, label: change.value }); if (change) a.push({ value: c.id, label: change.value });
return a; return a;
}, []) }, []);
if(rallyChoices.length) { if (rallyChoices.length) {
mods.rally = { mods.rally = {
label: 'DAGGERHEART.CLASS.Feature.rallyDice', label: 'DAGGERHEART.CLASS.Feature.rallyDice',
values: rallyChoices, values: rallyChoices,
@ -322,11 +322,13 @@ export default class DamageRoll extends DHRoll {
[`system.damage.${damageType}`]: { [`system.damage.${damageType}`]: {
...updateMessage, ...updateMessage,
total: parsedRoll.total, total: parsedRoll.total,
[`parts.${part}`]: { parts: [
{
...rollPart, ...rollPart,
total: parsedRoll.total, total: parsedRoll.total,
dice: rerolledDice dice: rerolledDice
} }
]
} }
}); });
} }