Fix
This commit is contained in:
@ -578,37 +578,55 @@ export class PegasusActor extends Actor {
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
computeNRGHealth() {
|
||||
let phyDiceValue = PegasusUtility.getDiceValue(this.data.data.statistics.phy.value) + this.data.data.statistics.phy.mod;
|
||||
async computeNRGHealth() {
|
||||
let updates = {}
|
||||
let phyDiceValue = PegasusUtility.getDiceValue(this.data.data.statistics.phy.value) + this.data.data.secondary.health.bonus + this.data.data.statistics.phy.mod;
|
||||
if (phyDiceValue != this.data.data.secondary.health.max) {
|
||||
this.update({ 'data.secondary.health.max': phyDiceValue, 'data.secondary.health.value': phyDiceValue })
|
||||
updates['data.secondary.health.max'] = phyDiceValue
|
||||
updates['data.secondary.health.value'] = phyDiceValue
|
||||
}
|
||||
let mndDiceValue = PegasusUtility.getDiceValue(this.data.data.statistics.mnd.value) + this.data.data.statistics.mnd.mod;
|
||||
let mndDiceValue = PegasusUtility.getDiceValue(this.data.data.statistics.mnd.value) + this.data.data.secondary.delirium.bonus + this.data.data.statistics.mnd.mod;
|
||||
if (mndDiceValue != this.data.data.secondary.delirium.max) {
|
||||
this.update({ 'data.secondary.delirium.max': mndDiceValue, 'data.secondary.delirium.value': mndDiceValue })
|
||||
updates['data.secondary.delirium.max'] = mndDiceValue
|
||||
updates['data.secondary.delirium.value'] = mndDiceValue
|
||||
}
|
||||
let stlDiceValue = PegasusUtility.getDiceValue(this.data.data.statistics.stl.value) +this.data.data.statistics.stl.mod;
|
||||
let stlDiceValue = PegasusUtility.getDiceValue(this.data.data.statistics.stl.value) + this.data.data.secondary.stealthhealth.bonus + this.data.data.statistics.stl.mod;
|
||||
if (stlDiceValue != this.data.data.secondary.stealthhealth.max) {
|
||||
this.update({ 'data.secondary.stealthhealth.max': stlDiceValue, 'data.secondary.stealthhealth.value': stlDiceValue })
|
||||
updates['data.secondary.stealthhealth.max'] = stlDiceValue
|
||||
updates['data.secondary.stealthhealth.value'] = stlDiceValue
|
||||
}
|
||||
let socDiceValue = PegasusUtility.getDiceValue(this.data.data.statistics.soc.value) + this.data.data.statistics.soc.mod;
|
||||
|
||||
let socDiceValue = PegasusUtility.getDiceValue(this.data.data.statistics.soc.value) + this.data.data.secondary.socialhealth.bonus + this.data.data.statistics.soc.mod;
|
||||
if (socDiceValue != this.data.data.secondary.socialhealth.max) {
|
||||
this.update({ 'data.secondary.socialhealth.max': socDiceValue, 'data.secondary.socialhealth.value': socDiceValue })
|
||||
updates['data.secondary.socialhealth.max'] = socDiceValue
|
||||
updates['data.secondary.socialhealth.value'] = socDiceValue
|
||||
}
|
||||
|
||||
let nrgValue = PegasusUtility.getDiceValue(this.data.data.statistics.foc.value) + + this.data.data.statistics.foc.mod;
|
||||
|
||||
let nrgValue = PegasusUtility.getDiceValue(this.data.data.statistics.foc.value) + this.data.data.nrg.mod + this.data.data.statistics.foc.mod;
|
||||
if (nrgValue != this.data.data.nrg.max) {
|
||||
this.update({ 'data.nrg.max': nrgValue, 'data.nrg.value': nrgValue })
|
||||
updates['data.nrg.max'] = nrgValue
|
||||
updates['data.nrg.value'] = nrgValue
|
||||
}
|
||||
if (nrgValue != this.data.data.combat.stunthreshold) {
|
||||
this.update({ 'data.combat.stunthreshold': nrgValue })
|
||||
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) {
|
||||
this.update({ 'data.mr.value': mrLevel });
|
||||
updates['data.mr.value'] = mrLevel
|
||||
}
|
||||
|
||||
let race = this.getRace()
|
||||
if ( race && race.name && (race.name != this.data.data.biodata.racename) ) {
|
||||
updates['data.biodata.racename'] = race.name
|
||||
}
|
||||
let role = this.getRole()
|
||||
if ( role && role.name && (role.name != this.data.data.biodata.rolename)) {
|
||||
updates['data.biodata.rolename'] = role.name
|
||||
}
|
||||
//console.log("UPD", updates, this.data.data.biodata)
|
||||
await this.update(updates)
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
@ -652,7 +670,7 @@ export class PegasusActor extends Actor {
|
||||
}
|
||||
/* -------------------------------------------- */
|
||||
async applyRace(race) {
|
||||
let updates = { 'data.racename': race.name }
|
||||
let updates = { 'data.biodata.racename': race.name }
|
||||
let newItems = []
|
||||
await this.deleteAllItemsByType('race')
|
||||
newItems.push(race);
|
||||
@ -699,7 +717,7 @@ export class PegasusActor extends Actor {
|
||||
async applyRole(role) {
|
||||
console.log("ROLE", role)
|
||||
|
||||
let updates = { 'data.rolename': role.name }
|
||||
let updates = { 'data.biodata.rolename': role.name }
|
||||
let newItems = []
|
||||
await this.deleteAllItemsByType('role')
|
||||
newItems.push(role);
|
||||
|
Reference in New Issue
Block a user