Fix #115 fix negative effect
This commit is contained in:
parent
b2dd8edab2
commit
aa5b13ae07
@ -1459,17 +1459,27 @@ export class PegasusActor extends Actor {
|
|||||||
if (this.system.biodata.noautobonus) { // If we are in "no-bonus mode
|
if (this.system.biodata.noautobonus) { // If we are in "no-bonus mode
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
let effects = this.items.filter(effect => effect.type == "effect" && effect.system.genre == "positive" && effect.system.statdice)
|
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) {
|
for (let statKey in this.system.statistics) {
|
||||||
let stat = duplicate(this.system.statistics[statKey])
|
let stat = duplicate(this.system.statistics[statKey])
|
||||||
let bonus = 0
|
let bonus = 0
|
||||||
for (let effect of effects) {
|
for (let effect of effectsPlus) {
|
||||||
if (effect.system.stataffected == statKey) {
|
if (effect.system.stataffected == statKey) {
|
||||||
bonus += Number(effect.system.effectlevel)
|
bonus += Number(effect.system.effectlevel)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
for (let effect of effectsMinus) {
|
||||||
|
if (effect.system.stataffected == statKey) {
|
||||||
|
bonus -= Number(effect.system.effectlevel)
|
||||||
|
}
|
||||||
|
}
|
||||||
if (bonus != stat.bonuseffect) {
|
if (bonus != stat.bonuseffect) {
|
||||||
stat.bonuseffect = bonus
|
stat.bonuseffect = bonus
|
||||||
|
if ( stat.bonuseffect + stat.value < 1) {
|
||||||
|
stat.value = 1
|
||||||
|
stat.bonuseffect = 0
|
||||||
|
}
|
||||||
this.update({ [`system.statistics.${statKey}`]: stat })
|
this.update({ [`system.statistics.${statKey}`]: stat })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2214,11 +2224,11 @@ export class PegasusActor extends Actor {
|
|||||||
}
|
}
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
processVehicleStatEffects() {
|
processVehicleStatEffects() {
|
||||||
let bonus = 0
|
|
||||||
let effectsPlus = this.items.filter(effect => effect.type == "effect" && effect.system.genre == "positive" && effect.system.statdice)
|
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)
|
let effectsMinus = this.items.filter(effect => effect.type == "effect" && effect.system.genre == "negative" && effect.system.reducedicevalue)
|
||||||
for (let statKey in this.system.statistics) {
|
for (let statKey in this.system.statistics) {
|
||||||
let stat = duplicate(this.system.statistics[statKey])
|
let stat = duplicate(this.system.statistics[statKey])
|
||||||
|
let bonus = 0
|
||||||
for (let effect of effectsPlus) {
|
for (let effect of effectsPlus) {
|
||||||
if (effect.system.stataffected == statKey) {
|
if (effect.system.stataffected == statKey) {
|
||||||
bonus += Number(effect.system.effectlevel)
|
bonus += Number(effect.system.effectlevel)
|
||||||
@ -2231,6 +2241,10 @@ export class PegasusActor extends Actor {
|
|||||||
}
|
}
|
||||||
if (bonus != stat.bonuseffect) {
|
if (bonus != stat.bonuseffect) {
|
||||||
stat.bonuseffect = bonus
|
stat.bonuseffect = bonus
|
||||||
|
if ( stat.bonuseffect + stat.level < 1) {
|
||||||
|
stat.level = 1
|
||||||
|
stat.bonuseffect = 0
|
||||||
|
}
|
||||||
if (stat.currentlevel > stat.bonuseffect+stat.level) {
|
if (stat.currentlevel > stat.bonuseffect+stat.level) {
|
||||||
stat.currentlevel = stat.bonuseffect+stat.level
|
stat.currentlevel = stat.bonuseffect+stat.level
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user