#68 : Process stat effects automatically
This commit is contained in:
@@ -1330,6 +1330,25 @@ export class PegasusActor extends Actor {
|
||||
this.system.combat.hindrancedice = hindrance
|
||||
this.getTraumaState()
|
||||
this.cleanupPerksIfTrauma()
|
||||
this.parseStatEffects()
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
parseStatEffects() {
|
||||
let effects = this.items.filter(effect => effect.type == "effect" && effect.system.genre == "positive" && effect.system.statdice )
|
||||
for (let statKey in this.system.statistics) {
|
||||
let stat = duplicate(this.system.statistics[statKey])
|
||||
let bonus = 0
|
||||
for (let effect of effects) {
|
||||
if (effect.system.stataffected == statKey) {
|
||||
bonus += Number(effect.system.effectlevel)
|
||||
}
|
||||
}
|
||||
if ( bonus != stat.bonuseffect) {
|
||||
stat.bonuseffect = bonus
|
||||
this.update( { [`system.statistics.${statKey}`]: stat} )
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1568,7 +1587,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
|
||||
if (!effect.system.hindrance && !effect.system.statdice
|
||||
&& (effect.system.stataffected != "notapplicable" || effect.system.specaffected.length > 0)
|
||||
&& effect.system.stataffected != "special"
|
||||
&& effect.system.stataffected != "powerroll"
|
||||
@@ -1660,7 +1679,10 @@ export class PegasusActor extends Actor {
|
||||
if (statKey) {
|
||||
rollData.statKey = statKey
|
||||
rollData.stat = this.getStat(statKey)
|
||||
rollData.statDicesLevel = rollData.stat.value || rollData.stat.level
|
||||
if ( rollData.stat.value != undefined ) {
|
||||
rollData.stat.level = rollData.stat.value // Normalize
|
||||
}
|
||||
rollData.statDicesLevel = rollData.stat.level + rollData.stat.bonuseffect
|
||||
rollData.statMod = rollData.stat.mod
|
||||
if (vehicle) {
|
||||
rollData.vehicle = duplicate(vehicle)
|
||||
|
@@ -59,6 +59,13 @@ export class PegasusUtility {
|
||||
Handlebars.registerHelper('mul', function (a, b) {
|
||||
return parseInt(a) * parseInt(b);
|
||||
})
|
||||
Handlebars.registerHelper('add', function (a, b) {
|
||||
return parseInt(a) + parseInt(b);
|
||||
});
|
||||
Handlebars.registerHelper('sub', function (a, b) {
|
||||
return parseInt(a) - parseInt(b);
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
|
Reference in New Issue
Block a user