New fields for weapons
This commit is contained in:
parent
4e7b8b9a78
commit
adfcce10fc
@ -158,6 +158,8 @@
|
|||||||
"BOL.weaponCategory.ranged": "Arme de tir",
|
"BOL.weaponCategory.ranged": "Arme de tir",
|
||||||
"BOL.weaponCategory.other": "Autre",
|
"BOL.weaponCategory.other": "Autre",
|
||||||
|
|
||||||
|
"BOL.itemProperty.damageMultiplier": "Damages Multiplier",
|
||||||
|
"BOL.itemProperty.attackBonusDice": "Attack Bonus Dice",
|
||||||
"BOL.itemProperty.equipable": "Équipable",
|
"BOL.itemProperty.equipable": "Équipable",
|
||||||
"BOL.itemProperty.protection": "Protection",
|
"BOL.itemProperty.protection": "Protection",
|
||||||
"BOL.itemProperty.blocking": "Blocage",
|
"BOL.itemProperty.blocking": "Blocage",
|
||||||
|
@ -159,6 +159,8 @@
|
|||||||
"BOL.weaponCategory.ranged": "Arme de tir",
|
"BOL.weaponCategory.ranged": "Arme de tir",
|
||||||
"BOL.weaponCategory.other": "Autre",
|
"BOL.weaponCategory.other": "Autre",
|
||||||
|
|
||||||
|
"BOL.itemProperty.damageMultiplier": "Multiplicateur de dommages",
|
||||||
|
"BOL.itemProperty.attackBonusDice": "Dé de Bonus d'attaque",
|
||||||
"BOL.itemProperty.equipable": "Équipable",
|
"BOL.itemProperty.equipable": "Équipable",
|
||||||
"BOL.itemProperty.protection": "Protection",
|
"BOL.itemProperty.protection": "Protection",
|
||||||
"BOL.itemProperty.blocking": "Blocage",
|
"BOL.itemProperty.blocking": "Blocage",
|
||||||
|
@ -105,7 +105,12 @@ export class BoLRoll {
|
|||||||
rollData.id = randomID(16)
|
rollData.id = randomID(16)
|
||||||
|
|
||||||
// Weapon mode specific management
|
// Weapon mode specific management
|
||||||
|
rollData.weaponModifier = 0
|
||||||
|
rollData.attackBonusDice = false
|
||||||
if (rollData.mode == "weapon") {
|
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
|
if (rollData.defender) { // If target is selected
|
||||||
rollData.defence = rollData.defender.defenseValue,
|
rollData.defence = rollData.defender.defenseValue,
|
||||||
rollData.shieldBlock = 'none'
|
rollData.shieldBlock = 'none'
|
||||||
@ -118,8 +123,6 @@ export class BoLRoll {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log("ROL1", rollData)
|
|
||||||
|
|
||||||
const rollOptionContent = await renderTemplate(rollOptionTpl, rollData);
|
const rollOptionContent = await renderTemplate(rollOptionTpl, rollData);
|
||||||
let d = new Dialog({
|
let d = new Dialog({
|
||||||
title: rollData.label,
|
title: rollData.label,
|
||||||
@ -154,12 +157,13 @@ export class BoLRoll {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const isMalus = rollData.adv.includes('M');
|
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 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 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 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;
|
const formula = (isMalus) ? dicePool + "d6kl2 + " + modifiers : dicePool + "d6kh2 + " + modifiers;
|
||||||
rollData.formula = formula;
|
rollData.formula = formula;
|
||||||
rollData.modifiers = modifiers
|
rollData.modifiers = modifiers
|
||||||
@ -177,6 +181,7 @@ export class BoLRoll {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class BoLDefaultRoll {
|
export class BoLDefaultRoll {
|
||||||
|
|
||||||
constructor(rollData) {
|
constructor(rollData) {
|
||||||
BoLUtility.storeRoll(rollData)
|
BoLUtility.storeRoll(rollData)
|
||||||
this.rollData = rollData
|
this.rollData = rollData
|
||||||
|
@ -381,6 +381,9 @@ export class BoLUtility {
|
|||||||
static getDamageFormula(damageString, modifier=0, multiplier = 1) {
|
static getDamageFormula(damageString, modifier=0, multiplier = 1) {
|
||||||
if (damageString[0] == 'd') { damageString = "1" + damageString } // Help parsing
|
if (damageString[0] == 'd') { damageString = "1" + damageString } // Help parsing
|
||||||
if (modifier == null) modifier = 0;
|
if (modifier == null) modifier = 0;
|
||||||
|
|
||||||
|
let formula = damageString
|
||||||
|
if ( damageString.includes("d") || damageString.includes("D")) {
|
||||||
var myReg = new RegExp('(\\d+)[dD]([\\d]+)([MB]*)?([\\+\\d]*)?', 'g');
|
var myReg = new RegExp('(\\d+)[dD]([\\d]+)([MB]*)?([\\+\\d]*)?', 'g');
|
||||||
let res = myReg.exec(damageString);
|
let res = myReg.exec(damageString);
|
||||||
let nbDice = parseInt(res[1]);
|
let nbDice = parseInt(res[1]);
|
||||||
@ -398,7 +401,8 @@ export class BoLUtility {
|
|||||||
modIndex = 4;
|
modIndex = 4;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let formula = "(" + nbDice + "d" + res[2] + postForm + "+" + modifier +") *" + multiplier;
|
formula = "(" + nbDice + "d" + res[2] + postForm + "+" + modifier +") *" + multiplier;
|
||||||
|
}
|
||||||
return formula;
|
return formula;
|
||||||
}
|
}
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
|
@ -10,6 +10,9 @@ System.debugMode = true;
|
|||||||
export const BOL = {};
|
export const BOL = {};
|
||||||
|
|
||||||
BOL.damageValues = {
|
BOL.damageValues = {
|
||||||
|
"1": "1",
|
||||||
|
"2": "2",
|
||||||
|
"3": "3",
|
||||||
"d3" : "d3",
|
"d3" : "d3",
|
||||||
"d6M" : "d6M (Malus)",
|
"d6M" : "d6M (Malus)",
|
||||||
"d6" : "d6",
|
"d6" : "d6",
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
"url": "https://github.com/ZigmundKreud/bol",
|
"url": "https://github.com/ZigmundKreud/bol",
|
||||||
"license": "LICENSE.txt",
|
"license": "LICENSE.txt",
|
||||||
"flags": {},
|
"flags": {},
|
||||||
"version": "0.9.0.0",
|
"version": "0.9.0.1",
|
||||||
"templateVersion": 16,
|
"templateVersion": 16,
|
||||||
"minimumCoreVersion": "0.8.6",
|
"minimumCoreVersion": "0.8.6",
|
||||||
"compatibleCoreVersion": "9",
|
"compatibleCoreVersion": "9",
|
||||||
|
@ -26,6 +26,10 @@
|
|||||||
<label class="checkbox">
|
<label class="checkbox">
|
||||||
<input class="field-value" type="checkbox" name="data.properties.ignoreshield" {{checked data.properties.ignoreshield}}> {{localize "BOL.itemProperty.ignoreshield"}}
|
<input class="field-value" type="checkbox" name="data.properties.ignoreshield" {{checked data.properties.ignoreshield}}> {{localize "BOL.itemProperty.ignoreshield"}}
|
||||||
</label>
|
</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}}
|
{{#if data.properties.ranged}}
|
||||||
<label class="checkbox">
|
<label class="checkbox">
|
||||||
<input class="field-value" type="checkbox" name="data.properties.reloadable" {{checked data.properties.reloadable}}> {{localize "BOL.itemProperty.reloadable"}}
|
<input class="field-value" type="checkbox" name="data.properties.reloadable" {{checked data.properties.reloadable}}> {{localize "BOL.itemProperty.reloadable"}}
|
||||||
|
Loading…
Reference in New Issue
Block a user