Attack process path

This commit is contained in:
sladecraven 2021-12-29 20:33:59 +01:00
parent 420390eed7
commit ad205f4669
6 changed files with 51 additions and 7 deletions

View File

@ -94,6 +94,10 @@
"BOL.ui.misc" : "Divers", "BOL.ui.misc" : "Divers",
"BOL.ui.noWeaponName" : "Unknown Weapon", "BOL.ui.noWeaponName" : "Unknown Weapon",
"BOL.ui.targetDefence": "Defence", "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.origins": "Origines",
"BOL.featureCategory.races": "Races", "BOL.featureCategory.races": "Races",

View File

@ -96,6 +96,10 @@
"BOL.ui.speed" : "Vitesse", "BOL.ui.speed" : "Vitesse",
"BOL.ui.noWeaponName" : "Arme Inconnue", "BOL.ui.noWeaponName" : "Arme Inconnue",
"BOL.ui.targetDefence": "Défense", "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.origins": "Origines",
"BOL.featureCategory.races": "Races", "BOL.featureCategory.races": "Races",

View File

@ -69,7 +69,7 @@ export class BoLRoll {
boons:actorData.features.boons, boons:actorData.features.boons,
flaws:actorData.features.flaws flaws:actorData.features.flaws
}; };
console.log(dialogData.careers);
const rollOptionContent = await renderTemplate(rollOptionTpl, dialogData); const rollOptionContent = await renderTemplate(rollOptionTpl, dialogData);
let d = new Dialog({ let d = new Dialog({
title: label, title: label,
@ -118,8 +118,17 @@ export class BoLRoll {
careers: attackDef.attackerData.features.careers, careers: attackDef.attackerData.features.careers,
boons: attackDef.attackerData.features.boons, boons: attackDef.attackerData.features.boons,
flaws: attackDef.attackerData.features.flaws, 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); const rollOptionContent = await renderTemplate(rollOptionTpl, dialogData);
let d = new Dialog({ let d = new Dialog({
title: attackDef.label, title: attackDef.label,
@ -139,13 +148,20 @@ export class BoLRoll {
const apt = html.find('#apt').val(); const apt = html.find('#apt').val();
const adv = html.find('#adv').val(); const adv = html.find('#adv').val();
const mod = html.find('#mod').val() || 0; 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(); let careers = html.find('#career').val();
const career = (careers.length == 0) ? 0 : Math.max(...careers.map(i => parseInt(i))); const career = (careers.length == 0) ? 0 : Math.max(...careers.map(i => parseInt(i)));
const isMalus = adv < 0; const isMalus = adv < 0;
const dicePool = (isMalus) ? 2 - parseInt(adv) : 2 + parseInt(adv); const dicePool = (isMalus) ? 2 - parseInt(adv) : 2 + parseInt(adv);
const attrValue = eval(`attackDef.attacker.data.data.attributes.${attr}.value`); const attrValue = eval(`attackDef.attacker.data.data.attributes.${attr}.value`);
const aptValue = eval(`attackDef.attacker.data.data.aptitudes.${apt}.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; const formula = (isMalus) ? dicePool + "d6kl2 + " + modifiers : dicePool + "d6kh2 + " + modifiers;
attackDef.formula = formula; attackDef.formula = formula;
let r = new BoLAttackRoll(attackDef); let r = new BoLAttackRoll(attackDef);

View File

@ -9,7 +9,7 @@
"flags": {}, "flags": {},
"version": "0.8.9.0", "version": "0.8.9.0",
"minimumCoreVersion": "0.8.6", "minimumCoreVersion": "0.8.6",
"compatibleCoreVersion": "0.8.9", "compatibleCoreVersion": "9",
"scripts": [], "scripts": [],
"esmodules": [ "esmodules": [
"module/bol.js" "module/bol.js"

View File

@ -55,6 +55,26 @@
</div> </div>
<div class="flex1 center cell">{{defence}}</div> <div class="flex1 center cell">{{defence}}</div>
</div> </div>
{{#if (eq shieldBlock 'blockall')}}
<div class="flexrow" style="margin-bottom: 1px;">
<div class="flex1 center bg-darkred">
<label for="mod">{{localize 'BOL.ui.shieldMalus'}}</label>
</div>
<div class="flex1 center cell">{{shieldAttackMalus}}</div>
</div>
{{/if}}
{{#if (eq shieldBlock 'blockone')}}
<div class="flexrow" style="margin-bottom: 1px;">
<div class="flex1 center bg-darkred">
<label for="mod">{{localize 'BOL.ui.shieldMalus'}}</label>
</div>
<div class="flex1 center cell">
<label class="checkbox">
<input class="field-value" type="checkbox" id="applyShieldMalus" name="applyShieldMalus" {{checked applyShieldMalus}}> {{localize "BOL.ui.applyShieldMalus"}}
</label>
</div>
</div>
{{/if}}
{{#if careers.items}} {{#if careers.items}}
<div class="flexrow" style="margin-bottom: 1px;"> <div class="flexrow" style="margin-bottom: 1px;">
<div class="flex1 center bg-darkred"> <div class="flex1 center bg-darkred">

View File

@ -1,11 +1,11 @@
<form class="skill-roll-dialog"> <form class="skill-roll-dialog">
{{#if defender}} {{#if defender}}
<div class="property flexrow"> <div class="property flexrow">
<label class="property-label">{{localize "Defender"}} : </label> <label class="property-label">{{localize "BOL.ui.defender"}} : </label>
<label class="property-label">{{defender.name}}</label> <label class="property-label">{{defender.name}}</label>
</div> </div>
<div class="property flexrow"> <div class="property flexrow">
<label class="property-label">{{localize "Defense score"}}</label> <label class="property-label">{{localize "BOL.ui.defenseScore"}}</label>
<label class="property-label">{{defender.data.aptitudes.def.value}}</label> <label class="property-label">{{defender.data.aptitudes.def.value}}</label>
</div> </div>
{{/if}} {{/if}}