diff --git a/modules/pegasus-actor.js b/modules/pegasus-actor.js index 7134cc5..87e207a 100644 --- a/modules/pegasus-actor.js +++ b/modules/pegasus-actor.js @@ -979,8 +979,6 @@ export class PegasusActor extends Actor { /* -------------------------------------------- */ async computeNRGHealth() { - 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; @@ -1044,7 +1042,7 @@ export class PegasusActor extends Actor { if (moralitythreshold != this.data.data.biodata.moralitythreshold) { updates['data.biodata.moralitythreshold'] = moralitythreshold } - if (!this.warnMorality && this.data.data.biodata.morality >= moralitythreshold-2) { + if (!this.warnMorality && this.data.data.biodata.morality <= moralitythreshold-2) { ChatMessage.create( {content: "WARNING: Your character is dangerously close to becoming corrupted and defeated. Start on a path of redemption!"} ) this.warnMorality = true } @@ -1059,8 +1057,7 @@ export class PegasusActor extends Actor { } //console.log("UPD", updates, this.data.data.biodata) await this.update(updates) - - this.computeThreatLevel() + this.computeThreatLevel() } if (this.isOwner || game.user.isGM) { diff --git a/modules/pegasus-utility.js b/modules/pegasus-utility.js index 6831cde..3a500fa 100644 --- a/modules/pegasus-utility.js +++ b/modules/pegasus-utility.js @@ -502,7 +502,7 @@ export class PegasusUtility { static getTarget() { if (game.user.targets && game.user.targets.size == 1) { for (let target of game.user.targets) { - return target; + return target } } return undefined; @@ -514,17 +514,17 @@ export class PegasusUtility { } /* -------------------------------------------- */ - static async updateDefenseState(defenderId, rollId) { - this.defenderStore[defenderId] = rollId - if (game.user.character && game.user.character.id == defenderId) { - let defender = game.actors.get(defenderId); + static async updateDefenseState(defenderTokenId, rollId) { + this.defenderStore[defenderTokenId] = rollId + let defender = game.canvas.tokens.get(defenderTokenId).actor + if (game.user.character && game.user.character.id == defender.id) { let chatData = { user: game.user.id, alias: defender.name, rollMode: game.settings.get("core", "rollMode"), whisper: [game.user.id].concat(ChatMessage.getWhisperRecipients('GM')), content: `
${defender.name} is under attack. He must roll a skill/weapon/technique to defend himself or suffer damages (button below). - No defense