Fix #70 : effect OK for dmr roll

This commit is contained in:
sladecraven 2022-09-28 20:14:24 +02:00
parent fb69f24fce
commit 18a69ba993
3 changed files with 12 additions and 8 deletions

View File

@ -373,7 +373,7 @@ export class PegasusActor extends Actor {
}
}
if (ppp != this.system.ppp.spentPPP) {
//this.update({ 'system.ppp.spentPPP': ppp })
this.update({ 'system.ppp.spentPPP': ppp })
}
}
/* -------------------------------------------- */
@ -385,7 +385,7 @@ export class PegasusActor extends Actor {
}
}
if (sizeBonus != this.system.biodata.sizebonus) {
//this.update( {'system.biodata.sizebonus': sizeBonus})
this.update( {'system.biodata.sizebonus': sizeBonus})
}
}
@ -1758,24 +1758,25 @@ export class PegasusActor extends Actor {
processSizeBonus( rollData) {
if ( rollData.defenderTokenId) {
let diffSize = rollData.defenderSize - this.system.biodata.sizenum+this.system.biodata.sizebonus
console.log("Diffsize", diffSize)
if( rollData.subKey == "melee-atk" || rollData.subKey == "ranged-atk") {
if ( diffSize > 0) {
rollData.effectsList.push({ label: "Size Bonus", type: "effect", applied: true, value: diffSize })
rollData.effectsList.push({ label: "Size Bonus", type: "effect", applied: false, isdynamic: true, value: diffSize })
}
}
if( rollData.subKey == "dmg-res" ) {
if ( diffSize < 0) {
rollData.effectsList.push({ label: "Size Bonus", type: "effect", applied: true, value: Math.abs(diffSize) })
rollData.effectsList.push({ label: "Size Bonus", type: "effect", applied: false, isdynamic: true, value: Math.abs(diffSize) })
}
}
if( rollData.subKey == "defence" ) {
if ( diffSize > 0) {
rollData.effectsList.push({ label: "Size Bonus", type: "effect", applied: true, value: Math.abs(diffSize) })
rollData.effectsList.push({ label: "Size Bonus", type: "effect", applied: false, isdynamic: true, value: Math.abs(diffSize) })
}
}
if( rollData.subKey == "melee-dmg" || rollData.subKey == "ranged-dmg") {
if ( diffSize < 0) {
rollData.effectsList.push({ label: "Size Bonus", type: "effect", applied: true, value: diffSize })
rollData.effectsList.push({ label: "Size Bonus", type: "effect", applied: false, isdynamic: true, value: Math.abs(diffSize) })
}
}
}

View File

@ -49,7 +49,7 @@ export class PegasusRollDialog extends Dialog {
effect.applied = toggled
let level, genre, idVal, key
if (effect.type == 'effect') {
if (effect.type == 'effect' && effect.effect) {
let effectData = effect.effect
level = effectData.system.effectlevel
genre = effectData.system.genre

View File

@ -144,9 +144,12 @@ 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.system.bonusdice) {
if (effect && effect.applied && effect.type == "effect" && 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) {
newDicePool = newDicePool.concat( this.buildDicePool("effect-bonus-dice", effect.value, 0, effect.name ))
}
}
rollData.dicePool = newDicePool
}