Fix #115 fix negative effect

This commit is contained in:
sladecraven 2022-10-07 17:45:53 +02:00
parent 8fac4dcb36
commit b2dd8edab2
3 changed files with 17 additions and 8 deletions

View File

@ -1744,7 +1744,7 @@ export class PegasusActor extends Actor {
let effects = this.items.filter(item => item.type == 'effect')
for (let effect of effects) {
effect = duplicate(effect)
if (!effect.system.hindrance && !effect.system.statdice
if (!effect.system.hindrance && !effect.system.statdice && !effect.system.reducedicevalue
&& (effect.system.stataffected != "notapplicable" || effect.system.specaffected.length > 0)
&& effect.system.stataffected != "special"
&& effect.system.stataffected != "powerroll"
@ -2214,19 +2214,28 @@ export class PegasusActor extends Actor {
}
/* -------------------------------------------- */
processVehicleStatEffects() {
let effects = this.items.filter(effect => effect.type == "effect" && effect.system.genre == "positive" && effect.system.statdice)
let bonus = 0
let effectsPlus = this.items.filter(effect => effect.type == "effect" && effect.system.genre == "positive" && effect.system.statdice)
let effectsMinus = this.items.filter(effect => effect.type == "effect" && effect.system.genre == "negative" && effect.system.reducedicevalue)
for (let statKey in this.system.statistics) {
let stat = duplicate(this.system.statistics[statKey])
let bonus = 0
for (let effect of effects) {
for (let effect of effectsPlus) {
if (effect.system.stataffected == statKey) {
bonus += Number(effect.system.effectlevel)
}
}
for (let effect of effectsMinus) {
if (effect.system.stataffected == statKey) {
bonus -= Number(effect.system.effectlevel)
}
}
if (bonus != stat.bonuseffect) {
stat.bonuseffect = bonus
if (stat.currentlevel > stat.bonuseffect+stat.level) {
stat.currentlevel = stat.bonuseffect+stat.level
}
this.update({ [`system.statistics.${statKey}`]: stat })
}
}
}
}

View File

@ -544,7 +544,7 @@ export class PegasusUtility {
/* -------------------------------------------- */
static getDiceFromLevel(level = 0) {
level = Number(level)
level = Math.max( Number(level), 0)
return this.diceList[level];
}
/* -------------------------------------------- */

View File

@ -253,7 +253,7 @@
],
"title": "Pegasus RPG",
"url": "https://www.uberwald.me/data/files/fvtt-pegasus-rpg",
"version": "10.1.7",
"download": "https://www.uberwald.me/gitea/uberwald/fvtt-pegasus-rpg/archive/fvtt-pegasus-rpg-v10.1.7.zip",
"version": "10.1.8",
"download": "https://www.uberwald.me/gitea/uberwald/fvtt-pegasus-rpg/archive/fvtt-pegasus-rpg-v10.1.8.zip",
"background": "systems/fvtt-pegasus-rpg/images/ui/pegasus_welcome_page.webp"
}