From e2d5a0ec74d7dd132ac55d8f136941be594ec346 Mon Sep 17 00:00:00 2001 From: sladecraven Date: Wed, 5 Oct 2022 14:38:31 +0200 Subject: [PATCH] Fix #96 hindrance stuff --- modules/pegasus-utility.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/modules/pegasus-utility.js b/modules/pegasus-utility.js index 67604bf..1deaa5f 100644 --- a/modules/pegasus-utility.js +++ b/modules/pegasus-utility.js @@ -146,10 +146,10 @@ export class PegasusUtility { static updateEffectsBonusDice(rollData) { let newDicePool = rollData.dicePool.filter(dice => dice.name != "effect-bonus-dice") for (let effect of rollData.effectsList) { - if (effect && effect.applied && effect.type == "effect" && effect.effect && effect.effect.system.bonusdice) { + if (effect && effect.applied && effect.type == "effect" && !effect.effect?.system?.hindrance && effect.effect && effect.effect.system.bonusdice) { newDicePool = newDicePool.concat(this.buildDicePool("effect-bonus-dice", effect.effect.system.effectlevel, 0, effect.effect.name)) } - if (effect && effect.applied && effect.type == "effect" && effect.value && effect.isdynamic) { + if (effect && effect.applied && effect.type == "effect" && effect.value && effect.isdynamic && !effect.effect?.system?.hindrance) { newDicePool = newDicePool.concat(this.buildDicePool("effect-bonus-dice", effect.value, 0, effect.name)) } } @@ -161,7 +161,9 @@ export class PegasusUtility { let newDicePool = rollData.dicePool.filter(dice => dice.name != "effect-hindrance") for (let hindrance of rollData.effectsList) { if (hindrance && hindrance.applied && (hindrance.type == "hindrance" || (hindrance.type == "effect" && hindrance.effect?.system?.hindrance))) { + console.log("Adding Hindrance 1", hindrance, newDicePool) newDicePool = newDicePool.concat(this.buildDicePool("effect-hindrance", (hindrance.value) ? hindrance.value : hindrance.effect.system.effectlevel, 0, hindrance.name)) + console.log("Adding Hindrance 2", newDicePool) } } rollData.dicePool = newDicePool