From c4f35aef9eb94613843ff880e138451fd877054e Mon Sep 17 00:00:00 2001 From: Chris Ryan <73275196+chrisryan10@users.noreply.github.com> Date: Wed, 13 Aug 2025 18:08:43 +1000 Subject: [PATCH] Change the critical damage max calculation (#890) * Change the critical damage max calculation to avoid setting the rolled portion to maximum all the time. * Change to the more neater code * Restored package.json --------- Co-authored-by: Chris Ryan Co-authored-by: WBHarry --- module/dice/damageRoll.mjs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/module/dice/damageRoll.mjs b/module/dice/damageRoll.mjs index 8a72d86e..0d64329e 100644 --- a/module/dice/damageRoll.mjs +++ b/module/dice/damageRoll.mjs @@ -137,9 +137,10 @@ export default class DamageRoll extends DHRoll { } if (config.isCritical && part.applyTo === CONFIG.DH.GENERAL.healingTypes.hitPoints.id) { - const tmpRoll = Roll.fromTerms(part.roll.terms)._evaluateSync({ maximize: true }), - criticalBonus = tmpRoll.total - this.constructor.calculateTotalModifiers(tmpRoll); - part.roll.terms.push(...this.formatModifier(criticalBonus)); + const total = part.roll.dice.reduce((acc, term) => acc + term._faces*term._number, 0); + if (total > 0) { + part.roll.terms.push(...this.formatModifier(total)); + } } /* To Remove When Reaction System */