Damage multiplier
This commit is contained in:
@ -323,8 +323,11 @@ export class BoLAttackRoll {
|
||||
async processResult( ) {
|
||||
if (this._isSuccess) {
|
||||
let attrDamage = this.attackDef.weapon.data.data.properties.damageAttribute;
|
||||
let weaponFormula = BoLUtility.getDamageFormula(this.attackDef.weapon.data.data.properties.damage)
|
||||
let weaponFormula = BoLUtility.getDamageFormula(this.attackDef.weapon.data.data.properties.damage,
|
||||
this.attackDef.weapon.data.data.properties.damageModifiers,
|
||||
this.attackDef.weapon.data.data.properties.damageMultiplier)
|
||||
let damageFormula = weaponFormula + "+" + this.attackDef.attacker.data.data.attributes[attrDamage].value;
|
||||
console.log("Formula", damageFormula)
|
||||
this.damageRoll = new Roll(damageFormula);
|
||||
await this.damageRoll.roll({ "async": false });
|
||||
await BoLUtility.showDiceSoNice(this.damageRoll);
|
||||
|
@ -381,8 +381,9 @@ export class BoLUtility {
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static getDamageFormula(damageString) {
|
||||
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]);
|
||||
@ -400,7 +401,7 @@ export class BoLUtility {
|
||||
modIndex = 4;
|
||||
}
|
||||
}
|
||||
let formula = nbDice + "d" + res[2] + postForm + ((res[modIndex]) ? res[modIndex] : "");
|
||||
let formula = "(" + nbDice + "d" + res[2] + postForm + "+" + modifier +") *" + multiplier;
|
||||
return formula;
|
||||
}
|
||||
/* -------------------------------------------- */
|
||||
|
@ -17,6 +17,13 @@ BOL.damageValues = {
|
||||
"d6BB" : "d6B + dé bonus",
|
||||
}
|
||||
|
||||
BOL.damageMultiplier = {
|
||||
"1": "x1",
|
||||
"2": "x2",
|
||||
"3": "x3",
|
||||
"4": "x4",
|
||||
}
|
||||
|
||||
BOL.equipmentSlots = {
|
||||
"none" : "BOL.equipmentSlots.none",
|
||||
"head" : "BOL.equipmentSlots.head",
|
||||
|
Reference in New Issue
Block a user