Fix glitches

This commit is contained in:
2022-01-22 21:49:34 +01:00
parent 0d144ef2a9
commit 35b78c8127
9 changed files with 181 additions and 76 deletions

View File

@ -110,6 +110,11 @@ export class PegasusActor extends Actor {
return comp;
}
/* -------------------------------------------- */
getMoneys() {
let comp = this.data.items.filter(item => item.type == 'money');
return comp;
}
/* -------------------------------------------- */
getArmors() {
let comp = duplicate(this.data.items.filter(item => item.type == 'armor') || []);
return comp;
@ -481,9 +486,18 @@ export class PegasusActor extends Actor {
rollDialog.render(true);
}
/* -------------------------------------------- */
getShieldDice() {
let shields = this.data.items.filter( item => item.type == "shield" && item.data.data.equipped)
let def = 0
for ( let sh of shields) {
def += sh.data.data.level
}
return def
}
/* -------------------------------------------- */
rollPool(statKey, useSPec) {
rollPool(statKey, useShield=false) {
let stat = this.getStat(statKey);
if (stat) {
let rollData = this.getCommonRollData()
@ -491,7 +505,10 @@ export class PegasusActor extends Actor {
rollData.specList = this.getRelevantSpec(statKey)
rollData.selectedSpec = "0"
rollData.stat = stat;
if (useShield) {
rollData.otherDicesLevel = this.getShieldDice()
}
this.startRoll(rollData);
} else {
ui.notifications.warn("Statistic not found !");
@ -608,14 +625,15 @@ export class PegasusActor extends Actor {
updates['data.nrg.max'] = nrgValue
updates['data.nrg.value'] = nrgValue
}
nrgValue = PegasusUtility.getDiceValue(this.data.data.statistics.foc.value) + this.data.data.statistics.foc.mod;
if (nrgValue != this.data.data.combat.stunthreshold) {
updates['data.combat.stunthreshold'] = nrgValue
}
let mrLevel = (this.data.data.statistics.agi.value + this.data.data.statistics.str.value) - this.data.data.statistics.phy.value
mrLevel = (mrLevel < 1) ? 1 : mrLevel;
if (mrLevel != this.data.data.mr.value) {
updates['data.mr.value'] = mrLevel
let momentum = PegasusUtility.getDiceValue(this.data.data.statistics.foc.value) + this.data.data.statistics.foc.mod
if (momentum != this.data.data.momentum.max) {
updates['data.momentum.value'] = momentum
updates['data.momentum.max'] = momentum
}
let race = this.getRace()