diff --git a/lang/en.json b/lang/en.json index 989f516..75fb86a 100644 --- a/lang/en.json +++ b/lang/en.json @@ -158,6 +158,8 @@ "BOL.weaponCategory.ranged": "Arme de tir", "BOL.weaponCategory.other": "Autre", + "BOL.itemProperty.damageMultiplier": "Damages Multiplier", + "BOL.itemProperty.attackBonusDice": "Attack Bonus Dice", "BOL.itemProperty.equipable": "Équipable", "BOL.itemProperty.protection": "Protection", "BOL.itemProperty.blocking": "Blocage", diff --git a/lang/fr.json b/lang/fr.json index 12151f9..97eb010 100644 --- a/lang/fr.json +++ b/lang/fr.json @@ -159,6 +159,8 @@ "BOL.weaponCategory.ranged": "Arme de tir", "BOL.weaponCategory.other": "Autre", + "BOL.itemProperty.damageMultiplier": "Multiplicateur de dommages", + "BOL.itemProperty.attackBonusDice": "Dé de Bonus d'attaque", "BOL.itemProperty.equipable": "Équipable", "BOL.itemProperty.protection": "Protection", "BOL.itemProperty.blocking": "Blocage", diff --git a/module/controllers/bol-rolls.js b/module/controllers/bol-rolls.js index cdbe917..36d6760 100644 --- a/module/controllers/bol-rolls.js +++ b/module/controllers/bol-rolls.js @@ -105,7 +105,12 @@ export class BoLRoll { rollData.id = randomID(16) // Weapon mode specific management + rollData.weaponModifier = 0 + rollData.attackBonusDice = false if (rollData.mode == "weapon") { + //console.log("WEAPON", rollData.weapon) + rollData.weaponModifier = rollData.weapon.data.data.properties.attackModifiers?? 0; + rollData.attackBonusDice = rollData.weapon.data.data.properties.attackBonusDice if (rollData.defender) { // If target is selected rollData.defence = rollData.defender.defenseValue, rollData.shieldBlock = 'none' @@ -118,8 +123,6 @@ export class BoLRoll { } } - console.log("ROL1", rollData) - const rollOptionContent = await renderTemplate(rollOptionTpl, rollData); let d = new Dialog({ title: rollData.label, @@ -154,12 +157,13 @@ export class BoLRoll { } const isMalus = rollData.adv.includes('M'); - const dicePool = __adv2dice[rollData.adv] + let dicePool = __adv2dice[rollData.adv] + dicePool += (rollData.attackBonusDice) ? 1 : 0 //// const dicePool = (isMalus) ? 2 - parseInt(rollData.adv) : 2 + parseInt(rollData.adv); const attrValue = (rollData.attrKey) && eval(`rollData.actor.data.data.attributes.${rollData.attrKey}.value`) || 0; const aptValue = (rollData.aptKey) && eval(`rollData.actor.data.data.aptitudes.${rollData.aptKey}.value`) || 0 - const modifiers = parseInt(attrValue) + parseInt(aptValue) + parseInt(rollData.mod) + parseInt(rollData.career) - rollData.defence - shieldMalus; + const modifiers = rollData.weaponModifier + parseInt(attrValue) + parseInt(aptValue) + parseInt(rollData.mod) + parseInt(rollData.career) - rollData.defence - shieldMalus; const formula = (isMalus) ? dicePool + "d6kl2 + " + modifiers : dicePool + "d6kh2 + " + modifiers; rollData.formula = formula; rollData.modifiers = modifiers @@ -177,6 +181,7 @@ export class BoLRoll { } export class BoLDefaultRoll { + constructor(rollData) { BoLUtility.storeRoll(rollData) this.rollData = rollData diff --git a/module/system/bol-utility.js b/module/system/bol-utility.js index f847c9c..3cef4ad 100644 --- a/module/system/bol-utility.js +++ b/module/system/bol-utility.js @@ -381,24 +381,28 @@ export class BoLUtility { static getDamageFormula(damageString, modifier=0, multiplier = 1) { if (damageString[0] == 'd') { damageString = "1" + damageString } // Help parsing if (modifier == null) modifier = 0; - var myReg = new RegExp('(\\d+)[dD]([\\d]+)([MB]*)?([\\+\\d]*)?', 'g'); - let res = myReg.exec(damageString); - let nbDice = parseInt(res[1]); - let postForm = 'kh' + nbDice; - let modIndex = 3; - if (res[3]) { - if (res[3] == 'M') { - postForm = 'kl' + nbDice; - nbDice++; - modIndex = 4; - } - if (res[3] == 'B') { - postForm = 'kh' + nbDice; - nbDice++; - modIndex = 4; + + let formula = damageString + if ( damageString.includes("d") || damageString.includes("D")) { + var myReg = new RegExp('(\\d+)[dD]([\\d]+)([MB]*)?([\\+\\d]*)?', 'g'); + let res = myReg.exec(damageString); + let nbDice = parseInt(res[1]); + let postForm = 'kh' + nbDice; + let modIndex = 3; + if (res[3]) { + if (res[3] == 'M') { + postForm = 'kl' + nbDice; + nbDice++; + modIndex = 4; + } + if (res[3] == 'B') { + postForm = 'kh' + nbDice; + nbDice++; + modIndex = 4; + } } + formula = "(" + nbDice + "d" + res[2] + postForm + "+" + modifier +") *" + multiplier; } - let formula = "(" + nbDice + "d" + res[2] + postForm + "+" + modifier +") *" + multiplier; return formula; } /* -------------------------------------------- */ diff --git a/module/system/config.js b/module/system/config.js index 3b8fa90..382eb1d 100644 --- a/module/system/config.js +++ b/module/system/config.js @@ -10,6 +10,9 @@ System.debugMode = true; export const BOL = {}; BOL.damageValues = { + "1": "1", + "2": "2", + "3": "3", "d3" : "d3", "d6M" : "d6M (Malus)", "d6" : "d6", diff --git a/system.json b/system.json index 622872a..3ff1bbf 100644 --- a/system.json +++ b/system.json @@ -7,7 +7,7 @@ "url": "https://github.com/ZigmundKreud/bol", "license": "LICENSE.txt", "flags": {}, - "version": "0.9.0.0", + "version": "0.9.0.1", "templateVersion": 16, "minimumCoreVersion": "0.8.6", "compatibleCoreVersion": "9", diff --git a/templates/item/parts/properties/item/weapon-properties.hbs b/templates/item/parts/properties/item/weapon-properties.hbs index c48f5a7..93fd231 100644 --- a/templates/item/parts/properties/item/weapon-properties.hbs +++ b/templates/item/parts/properties/item/weapon-properties.hbs @@ -26,6 +26,10 @@ + + {{#if data.properties.ranged}}