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

@ -8,6 +8,8 @@ export class ChatDamageData extends foundry.abstract.DataModel {
}
get isCritical() {
if (!this.parent?.parent) return false;
const roll = Roll.fromJSON(this.parent.parent._source.rolls[0]);
return roll.isCritical;
}
@ -33,7 +35,14 @@ export class ChatDamageData extends foundry.abstract.DataModel {
}
_prepareRolls() {
this.main &&= Roll.fromData({ ...this.main, options: { ...this.main.options, isCritical: this.isCritical } });
this.main &&= Roll.fromData({
...this.main,
options: {
...this.main.options,
isCritical: this.main.options.isCritical || this.isCritical
}
});
for (const key of Object.keys(this.resources)) {
this.resources[key] = Roll.fromData(this.resources[key]);
}