Various fixes #9

Merged
sladecraven merged 3 commits from master into master 2022-01-20 16:27:28 +01:00
10 changed files with 62 additions and 21 deletions

BIN
images/map_lemurie.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 MiB

View File

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

View File

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

View File

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

View File

@ -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;
}
/* -------------------------------------------- */

View File

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

2
packs/aides-de-jeu.db Normal file

File diff suppressed because one or more lines are too long

1
packs/cartes.db Normal file

File diff suppressed because one or more lines are too long

View File

@ -7,7 +7,7 @@
"url": "https://github.com/ZigmundKreud/bol",
"license": "LICENSE.txt",
"flags": {},
"version": "0.9.0.0",
"version": "0.9.0.2",
"templateVersion": 16,
"minimumCoreVersion": "0.8.6",
"compatibleCoreVersion": "9",
@ -90,6 +90,24 @@
"tag": "item",
"type": "Item",
"private": false
},
{
"label": "Aides de Jeu",
"type": "JournalEntry",
"name": "aides-de-jeu",
"path": "packs/aides-de-jeu.db",
"system": "bol",
"entity": "JournalEntry",
"private": false
},
{
"label": "Cartes",
"type": "Scene",
"name": "cartes",
"path": "packs/cartes.db",
"system": "bol",
"entity": "Scene",
"private": false
}
],
"system": [],

View File

@ -26,6 +26,10 @@
<label class="checkbox">
<input class="field-value" type="checkbox" name="data.properties.ignoreshield" {{checked data.properties.ignoreshield}}> {{localize "BOL.itemProperty.ignoreshield"}}
</label>
<label class="checkbox">
<input class="field-value" type="checkbox" name="data.properties.attackBonusDice" {{checked data.properties.attackBonusDice}}> {{localize "BOL.itemProperty.attackBonusDice"}}
</label>
{{#if data.properties.ranged}}
<label class="checkbox">
<input class="field-value" type="checkbox" name="data.properties.reloadable" {{checked data.properties.reloadable}}> {{localize "BOL.itemProperty.reloadable"}}