Fixed so that the forced critical toggle in the DamageDialog sets damageRoll.options.isCritical

This commit is contained in:
WBHarry 2026-07-19 18:22:30 +02:00
parent c0fe127df4
commit cfb6bc2479
3 changed files with 22 additions and 4 deletions

View file

@ -121,7 +121,14 @@ export default class DamageDialog extends HandlebarsApplicationMixin(Application
}
static async submitRoll() {
const isCritical = this.config.isCritical;
const { damageFormula, resourceFormulas } = this.roll.constructFormulas({ ...this.config, isCritical: false });
/* Sideeffect occuring in constructFormulas that sets this.config.isCritical to the false value. Can remove the below if it can be prevented */
this.config.isCritical = isCritical;
damageFormula.roll.options.isCritical = isCritical;
for (const formula of resourceFormulas)
formula.roll.options.isCritical = isCritical;
this.config.damageFormula = damageFormula;
this.config.resourceFormulas = resourceFormulas;
await this.close({ submitted: true });