Attack process path #3

Merged
sladecraven merged 2 commits from master into master 2021-12-29 20:53:46 +01:00
6 changed files with 51 additions and 7 deletions
Showing only changes of commit ad205f4669 - Show all commits

View File

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

View File

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

View File

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

View File

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

View File

@ -55,6 +55,26 @@
</div>
<div class="flex1 center cell">{{defence}}</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}}
<div class="flexrow" style="margin-bottom: 1px;">
<div class="flex1 center bg-darkred">

View File

@ -1,11 +1,11 @@
<form class="skill-roll-dialog">
{{#if defender}}
<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>
</div>
<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>
</div>
{{/if}}