diff --git a/lang/en.json b/lang/en.json index c6fbfa60..ed8bbebe 100644 --- a/lang/en.json +++ b/lang/en.json @@ -94,7 +94,11 @@ "BOL.ui.misc" : "Divers", "BOL.ui.noWeaponName" : "Unknown Weapon", "BOL.ui.targetDefence": "Defence", - + "BOL.ui.applyShieldMalus": "Apply Small Shield Malus", + "BOL.ui.shieldMalus": "Shield Malus", + "BOL.ui.defenseScore": "Defense Score", + "BOL.ui.defender": "Defender", + "BOL.featureCategory.origins": "Origines", "BOL.featureCategory.races": "Races", "BOL.featureCategory.careers": "Carrières", diff --git a/lang/fr.json b/lang/fr.json index 9a150e93..a7c195c1 100644 --- a/lang/fr.json +++ b/lang/fr.json @@ -96,6 +96,10 @@ "BOL.ui.speed" : "Vitesse", "BOL.ui.noWeaponName" : "Arme Inconnue", "BOL.ui.targetDefence": "Défense", + "BOL.ui.applyShieldMalus": "Appliquer le Malus de Petit Bouclier", + "BOL.ui.shieldMalus": "Malus de Bouclier", + "BOL.ui.defenseScore": "Score de Defense", + "BOL.ui.defender": "Défenseur", "BOL.featureCategory.origins": "Origines", "BOL.featureCategory.races": "Races", diff --git a/module/controllers/bol-rolls.js b/module/controllers/bol-rolls.js index cee42745..b5f11b95 100644 --- a/module/controllers/bol-rolls.js +++ b/module/controllers/bol-rolls.js @@ -69,7 +69,7 @@ export class BoLRoll { boons:actorData.features.boons, flaws:actorData.features.flaws }; - console.log(dialogData.careers); + const rollOptionContent = await renderTemplate(rollOptionTpl, dialogData); let d = new Dialog({ title: label, @@ -118,8 +118,17 @@ export class BoLRoll { careers: attackDef.attackerData.features.careers, boons: attackDef.attackerData.features.boons, flaws: attackDef.attackerData.features.flaws, - defence: (attackDef.defender) ? attackDef.defender.defenseValue : 0, }; + if ( attackDef.defender) { + dialogData.defence = attackDef.defender.defenseValue, + dialogData.shieldBlock = 'none' + let shields = attackDef.defender.shields + for( let shield of shields) { + dialogData.shieldBlock = (shield.data.properties.blocking.blockingAll) ? 'blockall' : 'blockone'; + dialogData.shieldAttackMalus = (shield.data.properties.blocking.malus)? shield.data.properties.blocking.malus : 1; + dialogData.applyShieldMalus = false + } + } const rollOptionContent = await renderTemplate(rollOptionTpl, dialogData); let d = new Dialog({ title: attackDef.label, @@ -139,13 +148,20 @@ export class BoLRoll { const apt = html.find('#apt').val(); const adv = html.find('#adv').val(); const mod = html.find('#mod').val() || 0; + + let shieldMalus = 0; + const applyShieldMalus = html.find('#applyShieldMalus').val() || false; + if (applyShieldMalus || dialogData.shieldBlock =='blockall') { + shieldMalus = dialogData.shieldAttackMalus; + } + let careers = html.find('#career').val(); const career = (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`); const aptValue = eval(`attackDef.attacker.data.data.aptitudes.${apt}.value`); - const modifiers = parseInt(attrValue) + parseInt(aptValue) + parseInt(mod) + parseInt(career) - dialogData.defence; + const modifiers = parseInt(attrValue) + parseInt(aptValue) + parseInt(mod) + parseInt(career) - dialogData.defence - shieldMalus; const formula = (isMalus) ? dicePool + "d6kl2 + " + modifiers : dicePool + "d6kh2 + " + modifiers; attackDef.formula = formula; let r = new BoLAttackRoll(attackDef); diff --git a/system.json b/system.json index 1192c7d6..d5fefc5f 100644 --- a/system.json +++ b/system.json @@ -9,7 +9,7 @@ "flags": {}, "version": "0.8.9.0", "minimumCoreVersion": "0.8.6", - "compatibleCoreVersion": "0.8.9", + "compatibleCoreVersion": "9", "scripts": [], "esmodules": [ "module/bol.js" diff --git a/templates/dialogs/weapon-roll-dialog.hbs b/templates/dialogs/weapon-roll-dialog.hbs index c66e99a6..036168ee 100644 --- a/templates/dialogs/weapon-roll-dialog.hbs +++ b/templates/dialogs/weapon-roll-dialog.hbs @@ -55,6 +55,26 @@