Fix #96 hindrance stuff

This commit is contained in:
sladecraven 2022-10-05 14:38:31 +02:00
parent a68db10676
commit e2d5a0ec74

View File

@ -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