From f786ee5f06168b014aa09b971f337ddd5fe3d1e8 Mon Sep 17 00:00:00 2001 From: WBHarry Date: Sun, 21 Dec 2025 15:39:05 +0100 Subject: [PATCH] Fixed actionType constants --- module/applications/dialogs/d20RollDialog.mjs | 6 +-- module/dice/dhRoll.mjs | 38 +++++++++---------- module/dice/dualityRoll.mjs | 2 +- 3 files changed, 23 insertions(+), 23 deletions(-) diff --git a/module/applications/dialogs/d20RollDialog.mjs b/module/applications/dialogs/d20RollDialog.mjs index b28a3ffb..5ef9e005 100644 --- a/module/applications/dialogs/d20RollDialog.mjs +++ b/module/applications/dialogs/d20RollDialog.mjs @@ -195,9 +195,9 @@ export default class D20RollDialog extends HandlebarsApplicationMixin(Applicatio if (this.config.roll) { this.reactionOverride = !this.reactionOverride; this.config.actionType = this.reactionOverride - ? CONFIG.DH.ITEM.actionTypes.reaction.id - : this.config.actionType === CONFIG.DH.ITEM.actionTypes.reaction.id - ? CONFIG.DH.ITEM.actionTypes.action.id + ? 'reaction' + : this.config.actionType === 'reaction' + ? 'action' : this.config.actionType; this.render(); } diff --git a/module/dice/dhRoll.mjs b/module/dice/dhRoll.mjs index ce39ed6a..ec289941 100644 --- a/module/dice/dhRoll.mjs +++ b/module/dice/dhRoll.mjs @@ -240,11 +240,13 @@ export default class DHRoll extends Roll { async function automateHopeFear(config) { const automationSettings = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Automation); const hopeFearAutomation = automationSettings.hopeFear; - if (!config.source?.actor || + if ( + !config.source?.actor || (game.user.isGM ? !hopeFearAutomation.gm : !hopeFearAutomation.players) || config.actionType === 'reaction' || config.tagTeamSelected || - config.skips?.resources) + config.skips?.resources + ) return; const actor = await fromUuid(config.source.actor); let updates = []; @@ -252,26 +254,22 @@ async function automateHopeFear(config) { if (config.rerolledRoll) { if (config.roll.result.duality != config.rerolledRoll.result.duality) { - const hope = (config.roll.isCritical || config.roll.result.duality === 1 ? 1 : 0) - - (config.rerolledRoll.isCritical || config.rerolledRoll.result.duality === 1 ? 1 : 0); + const hope = + (config.roll.isCritical || config.roll.result.duality === 1 ? 1 : 0) - + (config.rerolledRoll.isCritical || config.rerolledRoll.result.duality === 1 ? 1 : 0); const stress = (config.roll.isCritical ? 1 : 0) - (config.rerolledRoll.isCritical ? 1 : 0); - const fear = (config.roll.result.duality === -1 ? 1 : 0) - - (config.rerolledRoll.result.duality === -1 ? 1 : 0) + const fear = + (config.roll.result.duality === -1 ? 1 : 0) - (config.rerolledRoll.result.duality === -1 ? 1 : 0); - if (hope !== 0) - updates.push({ key: 'hope', value: hope, total: -1 * hope, enabled: true }); - if (stress !== 0) - updates.push({ key: 'stress', value: -1 * stress, total: stress, enabled: true }); - if (fear !== 0) - updates.push({ key: 'fear', value: fear, total: -1 * fear, enabled: true }); + if (hope !== 0) updates.push({ key: 'hope', value: hope, total: -1 * hope, enabled: true }); + if (stress !== 0) updates.push({ key: 'stress', value: -1 * stress, total: stress, enabled: true }); + if (fear !== 0) updates.push({ key: 'fear', value: fear, total: -1 * fear, enabled: true }); } } else { if (config.roll.isCritical || config.roll.result.duality === 1) updates.push({ key: 'hope', value: 1, total: -1, enabled: true }); - if (config.roll.isCritical) - updates.push({ key: 'stress', value: -1, total: 1, enabled: true }); - if (config.roll.result.duality === -1) - updates.push({ key: 'fear', value: 1, total: -1, enabled: true }); + if (config.roll.isCritical) updates.push({ key: 'stress', value: -1, total: 1, enabled: true }); + if (config.roll.result.duality === -1) updates.push({ key: 'fear', value: 1, total: -1, enabled: true }); } if (updates.length) { @@ -287,15 +285,17 @@ export const registerRollDiceHooks = () => { const automationSettings = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Automation); if ( automationSettings.countdownAutomation && - config.actionType !== CONFIG.DH.ITEM.actionTypes.reaction.id && + config.actionType !== 'reaction' && !config.tagTeamSelected && !config.skips?.updateCountdowns ) { const { updateCountdowns } = game.system.api.applications.ui.DhCountdowns; if (config.roll.result.duality === -1) { - await updateCountdowns(CONFIG.DH.GENERAL.countdownProgressionTypes.actionRoll.id, - CONFIG.DH.GENERAL.countdownProgressionTypes.fear.id); + await updateCountdowns( + CONFIG.DH.GENERAL.countdownProgressionTypes.actionRoll.id, + CONFIG.DH.GENERAL.countdownProgressionTypes.fear.id + ); } else { await updateCountdowns(CONFIG.DH.GENERAL.countdownProgressionTypes.actionRoll.id); } diff --git a/module/dice/dualityRoll.mjs b/module/dice/dualityRoll.mjs index 59cb6e02..4d305c6c 100644 --- a/module/dice/dualityRoll.mjs +++ b/module/dice/dualityRoll.mjs @@ -19,7 +19,7 @@ export default class DualityRoll extends D20Roll { get title() { return game.i18n.localize( - `DAGGERHEART.GENERAL.${this.options?.actionType === CONFIG.DH.ITEM.actionTypes.reaction.id ? 'reactionRoll' : 'dualityRoll'}` + `DAGGERHEART.GENERAL.${this.options?.actionType === 'reaction' ? 'reactionRoll' : 'dualityRoll'}` ); }