Fix numbering

This commit is contained in:
2022-01-30 09:44:37 +01:00
parent 9974c5365a
commit f590e1fe6a
7 changed files with 87 additions and 43 deletions

View File

@ -255,8 +255,24 @@ export class PegasusActor extends Actor {
getAttribute(attrKey) {
return this.data.data.attributes[attrKey];
}
/* -------------------------------------------- */
/* -------------------------------------------- */
async preprocessItem( event, item, onDrop = false) {
if ( item.data.type == 'race') {
this.applyRace(item.data)
} else if ( item.data.type == 'ability') {
this.applyAbility(item.data, [], true)
await this.createEmbeddedDocuments('Item', [item.data] )
} else {
if ( onDrop) {
await super._onDropItem(event, dragData)
} else {
await this.createEmbeddedDocuments('Item', [item.data] )
}
}
}
/* -------------------------------------------- */
async equipGear(equipmentId) {
let item = this.data.items.find(item => item.id == equipmentId);
if (item && item.data.data) {
@ -354,7 +370,7 @@ export class PegasusActor extends Actor {
/* -------------------------------------------- */
async computeNRGHealth() {
if ( this.isToken) return
if ( this.isToken ) return
if (this.isOwner || game.user.isGM) {
let updates = {}
let phyDiceValue = PegasusUtility.getDiceValue(this.data.data.statistics.phy.value) + this.data.data.secondary.health.bonus + this.data.data.statistics.phy.mod;
@ -454,12 +470,15 @@ export class PegasusActor extends Actor {
}
/* -------------------------------------------- */
applyAbility(ability, updates = []) {
applyAbility(ability, updates = [], directUpdate = false) {
if (ability.data.affectedstat != "notapplicable") {
let stat = duplicate(this.data.data.statistics[ability.data.affectedstat])
stat.value += parseInt(ability.data.statlevelincrease)
stat.mod += parseInt(ability.data.statmodifier)
updates[`data.statistics.${ability.data.affectedstat}`] = stat
if(directUpdate) {
this.update(updates)
}
}
}
/* -------------------------------------------- */
@ -470,7 +489,7 @@ export class PegasusActor extends Actor {
newItems.push(race);
for (let ability of race.data.abilities) {
newItems.push(ability);
newItems.push(ability)
this.applyAbility(ability, updates)
}
if (race.data.powersgained) {