From 1baa51b9de2d5840faa543ba00ce0d0352fdbd53 Mon Sep 17 00:00:00 2001 From: sladecraven Date: Wed, 2 Feb 2022 09:35:32 +0100 Subject: [PATCH] Fix weapon damages --- module/actor/actor.js | 3 +-- module/controllers/bol-rolls.js | 21 ++++++++++++++++----- system.json | 2 +- 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/module/actor/actor.js b/module/actor/actor.js index 8c0828b..df81353 100644 --- a/module/actor/actor.js +++ b/module/actor/actor.js @@ -362,10 +362,9 @@ export class BoLActor extends Actor { rollWeaponDamage( itemId) { let weapon = this.data.items.get(itemId ) if ( weapon ) { - console.log("WE", weapon) let r = new BoLDefaultRoll( { id: randomID(16), isSuccess: true, mode: "weapon", weapon: weapon, actor: this} ) r.setSuccess(true) - r.processResult() + r.rollDamage() } } diff --git a/module/controllers/bol-rolls.js b/module/controllers/bol-rolls.js index a38bc1a..171fe13 100644 --- a/module/controllers/bol-rolls.js +++ b/module/controllers/bol-rolls.js @@ -344,6 +344,17 @@ export class BoLDefaultRoll { }); } + getDamageAttributeValue( attrDamage) { + let attrDamageValue = 0 + if ( attrDamage.includes("vigor") ) { + attrDamageValue = this.rollData.actor.data.data.attributes.vigor.value + if (attrDamage.includes("half")) { + attrDamageValue = Math.floor(attrDamageValue / 2) + } + } + return attrDamageValue + } + async rollDamage() { if (this.rollData.mode != "weapon") { // Only specific process in Weapon mode return; @@ -358,12 +369,12 @@ export class BoLDefaultRoll { if ( this.rollData.damageMode == 'damage-plus-12') { bonusDmg = 12 } - console.log("DAMAGE !!!") - let attrDamage = this.rollData.weapon.data.data.properties.damageAttribute; + let attrDamageValue = this.getDamageAttributeValue(this.rollData.weapon.data.data.properties.damageAttribute) let weaponFormula = BoLUtility.getDamageFormula(this.rollData.weapon.data.data.properties.damage, - this.rollData.weapon.data.data.properties.damageModifiers, - this.rollData.weapon.data.data.properties.damageMultiplier) - let damageFormula = weaponFormula + "+" + bonusDmg + ((attrDamage) ? "+" + this.rollData.actor.data.data.attributes[attrDamage].value : "+0"); + this.rollData.weapon.data.data.properties.damageModifiers, + this.rollData.weapon.data.data.properties.damageMultiplier) + let damageFormula = weaponFormula + "+" + bonusDmg + "+" + attrDamageValue + console.log("DAMAGE !!!", damageFormula, attrDamageValue) //console.log("Formula", weaponFormula, damageFormula, this.rollData.weapon.data.data.properties.damage) this.rollData.damageFormula = damageFormula diff --git a/system.json b/system.json index 6b9cf76..c03f6d9 100644 --- a/system.json +++ b/system.json @@ -7,7 +7,7 @@ "url": "https://github.com/ZigmundKreud/bol", "license": "LICENSE.txt", "flags": {}, - "version": "0.9.1.2", + "version": "0.9.1.3", "templateVersion": 18, "minimumCoreVersion": "0.8.6", "compatibleCoreVersion": "9",