Fix weapon damages

This commit is contained in:
sladecraven 2022-02-02 09:35:32 +01:00
parent fd82c204d7
commit 1baa51b9de
3 changed files with 18 additions and 8 deletions

View File

@ -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()
}
}

View File

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

View File

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