Fix armors

This commit is contained in:
sladecraven 2022-03-21 13:28:27 +01:00
parent 80725d57e1
commit fff6b2a733
3 changed files with 8 additions and 6 deletions

View File

@ -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 {

View File

@ -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;

View File

@ -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",