From dfa3ee6b51aceff64217d328e87dccd0b4a780c3 Mon Sep 17 00:00:00 2001 From: WBHarry Date: Thu, 10 Jul 2025 13:14:24 +0200 Subject: [PATCH] Improved with tertiary --- module/dice/dualityRoll.mjs | 2 +- module/helpers/utils.mjs | 12 +++++------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/module/dice/dualityRoll.mjs b/module/dice/dualityRoll.mjs index e466b7fc..6c1d0fe4 100644 --- a/module/dice/dualityRoll.mjs +++ b/module/dice/dualityRoll.mjs @@ -143,6 +143,6 @@ export default class DualityRoll extends D20Roll { label: roll.totalLabel }; - setDiceSoNiceForDualityRoll(roll, config.roll.advantage); + setDiceSoNiceForDualityRoll(roll, config.roll.advantage.type); } } diff --git a/module/helpers/utils.mjs b/module/helpers/utils.mjs index 81da1edb..8156736d 100644 --- a/module/helpers/utils.mjs +++ b/module/helpers/utils.mjs @@ -122,16 +122,14 @@ export const getCommandTarget = () => { return target; }; -export const setDiceSoNiceForDualityRoll = (rollResult, advantage) => { +export const setDiceSoNiceForDualityRoll = (rollResult, advantageState) => { const diceSoNicePresets = getDiceSoNicePresets(); rollResult.dice[0].options = { appearance: diceSoNicePresets.hope }; rollResult.dice[1].options = { appearance: diceSoNicePresets.fear }; //diceSoNicePresets.fear; - if (rollResult.dice[2]) { - if (advantage.type === 1) { - rollResult.dice[2].options = { appearance: diceSoNicePresets.advantage }; - } else if (advantage.type === -1) { - rollResult.dice[2].options = { appearance: diceSoNicePresets.disadvantage }; - } + if (rollResult.dice[2] && advantageState) { + rollResult.dice[2].options = { + appearance: advantageState === 1 ? diceSoNicePresets.advantage : diceSoNicePresets.disadvantage + }; } };