From 9473250f0c80a3b410021b69002ceec60ffcf5d3 Mon Sep 17 00:00:00 2001 From: WBHarry Date: Tue, 13 Jan 2026 20:47:43 +0100 Subject: [PATCH 1/3] Fixed critical threshold applying to reactions --- module/data/fields/action/rollField.mjs | 2 +- module/dice/d20Roll.mjs | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/module/data/fields/action/rollField.mjs b/module/data/fields/action/rollField.mjs index e2196c1c..63d48990 100644 --- a/module/data/fields/action/rollField.mjs +++ b/module/data/fields/action/rollField.mjs @@ -87,7 +87,7 @@ export class DHActionRollData extends foundry.abstract.DataModel { if (this.type === CONFIG.DH.GENERAL.rollTypes.attack.id) modifiers.push({ label: 'Bonus to Hit', - value: this.bonus ?? this.parent.actor.system.attack.roll.bonus + value: this.bonus ?? this.parent.actor.system.attack.roll.bonus ?? 0 }); break; default: diff --git a/module/dice/d20Roll.mjs b/module/dice/d20Roll.mjs index f679d725..3ddd8027 100644 --- a/module/dice/d20Roll.mjs +++ b/module/dice/d20Roll.mjs @@ -35,7 +35,9 @@ export default class D20Roll extends DHRoll { get isCritical() { if (!this.d20._evaluated) return; - return this.d20.total >= this.data.system.criticalThreshold; + + const criticalThreshold = this.options.actionType === 'reaction' ? 20 : this.data.system.criticalThreshold; + return this.d20.total >= criticalThreshold; } get hasAdvantage() { From acafd2c8b923a543a0ef90504280e7ee261b6771 Mon Sep 17 00:00:00 2001 From: WBHarry Date: Tue, 13 Jan 2026 21:00:24 +0100 Subject: [PATCH 2/3] Added fallback for defaultHopeDice and defaultFearDice --- module/dice/dualityRoll.mjs | 10 ++++++---- module/enrichers/DualityRollEnricher.mjs | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/module/dice/dualityRoll.mjs b/module/dice/dualityRoll.mjs index 155d6aa5..32bb167a 100644 --- a/module/dice/dualityRoll.mjs +++ b/module/dice/dualityRoll.mjs @@ -131,11 +131,13 @@ export default class DualityRoll extends D20Roll { return; } - const { defaultHopeDice, defaultFearDice } = this.data.rules.dualityRoll; - - this.terms[0] = new foundry.dice.terms.Die({ faces: defaultHopeDice }); + this.terms[0] = new foundry.dice.terms.Die({ + faces: this.data.rules.dualityRoll?.defaultHopeDice ?? 12 + }); this.terms[1] = new foundry.dice.terms.OperatorTerm({ operator: '+' }); - this.terms[2] = new foundry.dice.terms.Die({ faces: defaultFearDice }); + this.terms[2] = new foundry.dice.terms.Die({ + faces: this.data.rules.dualityRoll?.defaultFearDice ?? 12 + }); } applyAdvantage() { diff --git a/module/enrichers/DualityRollEnricher.mjs b/module/enrichers/DualityRollEnricher.mjs index 1d6404ff..95733c45 100644 --- a/module/enrichers/DualityRollEnricher.mjs +++ b/module/enrichers/DualityRollEnricher.mjs @@ -101,7 +101,7 @@ export const enrichedDualityRoll = async ( await target.diceRoll(config); } else { // For no target, call DualityRoll directly with basic data - config.data = { experiences: {}, traits: {} }; + config.data = { experiences: {}, traits: {}, rules: {} }; config.source = { actor: null }; await CONFIG.Dice.daggerheart.DualityRoll.build(config); } From 5b61340fee0bd73ced82dd646ded6f301f4c0061 Mon Sep 17 00:00:00 2001 From: WBHarry Date: Tue, 13 Jan 2026 22:36:50 +0100 Subject: [PATCH 3/3] Fixed /dr without target failing resource update --- daggerheart.mjs | 2 +- module/dice/dualityRoll.mjs | 2 ++ module/enrichers/DualityRollEnricher.mjs | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/daggerheart.mjs b/daggerheart.mjs index f27892e2..4e88c148 100644 --- a/daggerheart.mjs +++ b/daggerheart.mjs @@ -309,7 +309,7 @@ Hooks.on('chatMessage', (_, message) => { target, difficulty, title, - label: 'test', + label: game.i18n.localize('DAGGERHEART.GENERAL.dualityRoll'), actionType: null, advantage }); diff --git a/module/dice/dualityRoll.mjs b/module/dice/dualityRoll.mjs index 32bb167a..aaca7400 100644 --- a/module/dice/dualityRoll.mjs +++ b/module/dice/dualityRoll.mjs @@ -261,6 +261,8 @@ export default class DualityRoll extends D20Roll { } static async handleTriggers(roll, config) { + if (!config.source?.actor) return; + const updates = []; const dualityUpdates = await game.system.registeredTriggers.runTrigger( CONFIG.DH.TRIGGER.triggers.dualityRoll.id, diff --git a/module/enrichers/DualityRollEnricher.mjs b/module/enrichers/DualityRollEnricher.mjs index 95733c45..536847f7 100644 --- a/module/enrichers/DualityRollEnricher.mjs +++ b/module/enrichers/DualityRollEnricher.mjs @@ -86,9 +86,9 @@ export const enrichedDualityRoll = async ( const config = { event: event ?? {}, title: title, + headerTitle: label, roll: { trait: traitValue && target ? traitValue : null, - label: label, difficulty: difficulty, advantage, type: reaction ? 'reaction' : null