From 2a55e317fcf36334452a4bc426c8204ebe423b0c Mon Sep 17 00:00:00 2001 From: Carlos Fernandez Date: Wed, 1 Apr 2026 16:56:44 -0400 Subject: [PATCH] Fix adversary damage rolls --- module/data/chat-message/actorRoll.mjs | 13 ++++++++----- module/data/fields/action/damageField.mjs | 2 +- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/module/data/chat-message/actorRoll.mjs b/module/data/chat-message/actorRoll.mjs index b0e122d1..89f34949 100644 --- a/module/data/chat-message/actorRoll.mjs +++ b/module/data/chat-message/actorRoll.mjs @@ -54,11 +54,14 @@ export default class DHActorRoll extends foundry.abstract.TypeDataModel { } get roll() { - if (this.parent.type === 'dualityRoll') - return this.parent.rolls.find(x => x instanceof game.system.api.dice.DualityRoll); - - if (this.parent.type === 'fateRoll') - return this.parent.rolls.find(x => x instanceof game.system.api.dice.FateRoll); + switch (this.parent.type) { + case 'adversaryRoll': + return this.parent.rolls.find(x => x instanceof game.system.api.dice.D20Roll); + case 'dualityRoll': + return this.parent.rolls.find(x => x instanceof game.system.api.dice.DualityRoll); + case 'fateRoll': + return this.parent.rolls.find(x => x instanceof game.system.api.dice.FateRoll); + } return null; } diff --git a/module/data/fields/action/damageField.mjs b/module/data/fields/action/damageField.mjs index 94f70e68..d41d2d4a 100644 --- a/module/data/fields/action/damageField.mjs +++ b/module/data/fields/action/damageField.mjs @@ -56,7 +56,7 @@ export default class DamageField extends fields.SchemaField { ...config, roll: formulas, data: this.getRollData(), - isCritical: message?.system.roll.isCritical + isCritical: Boolean(message?.system.roll?.isCritical) }; delete damageConfig.evaluate;