From fff6b2a733d4b3dcea75ffe1a981206973461beb Mon Sep 17 00:00:00 2001 From: sladecraven Date: Mon, 21 Mar 2022 13:28:27 +0100 Subject: [PATCH] Fix armors --- module/actor/actor.js | 9 +++++---- module/system/bol-utility.js | 3 ++- system.json | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/module/actor/actor.js b/module/actor/actor.js index bf55938..7e589ef 100644 --- a/module/actor/actor.js +++ b/module/actor/actor.js @@ -455,14 +455,15 @@ export class BoLActor extends Actor { /*-------------------------------------------- */ async manageHealthState() { - let lastHP = await this.getFlag("world", "lastHP") + let hpID = "lastHP"+this.id + let lastHP = await this.getFlag("world", hpID ) if ( lastHP != this.data.data.resources.hp.value ) { - await this.setFlag("world", "lastHP", this.data.data.resources.hp.value) + await this.setFlag("world", hpID, this.data.data.resources.hp.value) if (this.data.data.resources.hp.value <= 0 ) { ChatMessage.create({ alias: this.name, whisper: BoLUtility.getWhisperRecipientsAndGMs(this.name), - content: await renderTemplate('systems/bol/templates/chat/chat-vitality-zero.hbs', { name: this.name, hp: this.data.data.resources.hp.value} ) + content: await renderTemplate('systems/bol/templates/chat/chat-vitality-zero.hbs', { name: this.name, img: this.img, hp: this.data.data.resources.hp.value} ) }) } } @@ -499,7 +500,7 @@ export class BoLActor extends Actor { if ( protect.data.subtype == 'helm') { formula += "+1" } else if ( protect.data.subtype == 'armor') { - if ( BoLUtility.this.getRollArmor() ) { + if ( BoLUtility.getRollArmor() ) { if ( !protect.data.properties.soak.formula || protect.data.properties.soak.formula=="") { ui.notifications.warn(`L'armure ${protect.name} n'a pas de formule pour la protection !`) } else { diff --git a/module/system/bol-utility.js b/module/system/bol-utility.js index 0b7a5e9..6acd425 100644 --- a/module/system/bol-utility.js +++ b/module/system/bol-utility.js @@ -220,7 +220,8 @@ export class BoLUtility { if (defenseMode == 'damage-with-armor') { let armorFormula = attackDef.defender.getArmorFormula() attackDef.rollArmor = new Roll(armorFormula) - attackDef.rollArmor.roll({ async: false }) + attackDef.rollArmor.roll( { async: false } ) + console.log("Armor roll ", attackDef.rollArmor) attackDef.armorProtect = (attackDef.rollArmor.total < 0) ? 0 : attackDef.rollArmor.total; attackDef.finalDamage = attackDef.damageRoll.total - attackDef.armorProtect; attackDef.finalDamage = (attackDef.finalDamage < 0) ? 0 : attackDef.finalDamage; diff --git a/system.json b/system.json index 6b9abe3..c94e2db 100644 --- a/system.json +++ b/system.json @@ -7,7 +7,7 @@ "url": "https://github.com/ZigmundKreud/bol", "license": "LICENSE.txt", "flags": {}, - "version": "1.2.2", + "version": "1.2.4", "templateVersion": 22, "minimumCoreVersion": "0.8.6", "compatibleCoreVersion": "9",