From a57fb3d7389798cb25e0d0ff0551fe5e0b35e06c Mon Sep 17 00:00:00 2001 From: sladecraven Date: Sat, 8 Jan 2022 23:40:45 +0100 Subject: [PATCH] Minor fixes --- module/controllers/bol-rolls.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/module/controllers/bol-rolls.js b/module/controllers/bol-rolls.js index e758854..6aded19 100644 --- a/module/controllers/bol-rolls.js +++ b/module/controllers/bol-rolls.js @@ -89,7 +89,7 @@ export class BoLRoll { const adv = html.find('#adv').val(); const mod = html.find('#mod').val(); let careers = html.find('#career').val(); - const career = (careers.length == 0) ? 0 : Math.max(...careers.map(i => parseInt(i))); + const career = (careers && careers.length == 0) ? 0 : Math.max(...careers.map(i => parseInt(i))); const isMalus = adv < 0; const dicePool = (isMalus) ? 2 - parseInt(adv) : 2 + parseInt(adv); const attrValue = eval(`actor.data.data.attributes.${attr}.value`); @@ -118,7 +118,9 @@ export class BoLRoll { careers: attackDef.attackerData.features.careers, boons: attackDef.attackerData.features.boons, flaws: attackDef.attackerData.features.flaws, + defence: 0 }; + if (attackDef.defender) { dialogData.defence = attackDef.defender.defenseValue, dialogData.shieldBlock = 'none' @@ -156,7 +158,7 @@ export class BoLRoll { } let careers = html.find('#career').val(); - const career = (careers.length == 0) ? 0 : Math.max(...careers.map(i => parseInt(i))); + const career = (careers && careers.length == 0) ? 0 : Math.max(...careers.map(i => parseInt(i))); const isMalus = adv < 0; const dicePool = (isMalus) ? 2 - parseInt(adv) : 2 + parseInt(adv); const attrValue = eval(`attackDef.attacker.data.data.attributes.${attr}.value`); @@ -204,7 +206,7 @@ export class BoLRoll { const adv = html.find('#adv').val(); const mod = html.find('#mod').val(); let careers = html.find('#career').val(); - const career = (careers.length == 0) ? 0 : Math.max(...careers.map(i => parseInt(i))); + const career = (careers && careers.length == 0) ? 0 : Math.max(...careers.map(i => parseInt(i))); const isMalus = adv < 0; const dicePool = (isMalus) ? 2 - parseInt(adv) : 2 + parseInt(adv); const aptValue = eval(`actor.data.data.aptitudes.${apt}.value`); @@ -280,6 +282,7 @@ export class BoLAttackRoll { } async roll() { + console.log("Attack def",this.attackDef.formula ) const r = new Roll(this.attackDef.formula); await r.roll({ "async": false }); //await BoLUtility.showDiceSoNice(r);