Damage multiplier
This commit is contained in:
parent
06cf860505
commit
0b77238dc2
@ -53,8 +53,8 @@
|
|||||||
"BOL.ui.delete": "Supprimer",
|
"BOL.ui.delete": "Supprimer",
|
||||||
"BOL.ui.roll" : "Utiliser",
|
"BOL.ui.roll" : "Utiliser",
|
||||||
"BOL.ui.equipment" : "Équipement",
|
"BOL.ui.equipment" : "Équipement",
|
||||||
"BOL.ui.equipmentProperties" : "Propiétés d'équipement",
|
"BOL.ui.equipmentProperties" : "Propriétés d'équipement",
|
||||||
"BOL.ui.weaponProperties" : "Propiétés offensives",
|
"BOL.ui.weaponProperties" : "Propriétés offensives",
|
||||||
"BOL.ui.protectionProperties" : "Protection",
|
"BOL.ui.protectionProperties" : "Protection",
|
||||||
"BOL.ui.magicalProperties" : "Propriétés magiques",
|
"BOL.ui.magicalProperties" : "Propriétés magiques",
|
||||||
"BOL.ui.capacityProperties" : "Propriétés de capacité",
|
"BOL.ui.capacityProperties" : "Propriétés de capacité",
|
||||||
|
@ -323,8 +323,11 @@ export class BoLAttackRoll {
|
|||||||
async processResult( ) {
|
async processResult( ) {
|
||||||
if (this._isSuccess) {
|
if (this._isSuccess) {
|
||||||
let attrDamage = this.attackDef.weapon.data.data.properties.damageAttribute;
|
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;
|
let damageFormula = weaponFormula + "+" + this.attackDef.attacker.data.data.attributes[attrDamage].value;
|
||||||
|
console.log("Formula", damageFormula)
|
||||||
this.damageRoll = new Roll(damageFormula);
|
this.damageRoll = new Roll(damageFormula);
|
||||||
await this.damageRoll.roll({ "async": false });
|
await this.damageRoll.roll({ "async": false });
|
||||||
await BoLUtility.showDiceSoNice(this.damageRoll);
|
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 (damageString[0] == 'd') { damageString = "1" + damageString } // Help parsing
|
||||||
|
if (modifier == null) modifier = 0;
|
||||||
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]);
|
||||||
@ -400,7 +401,7 @@ export class BoLUtility {
|
|||||||
modIndex = 4;
|
modIndex = 4;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let formula = nbDice + "d" + res[2] + postForm + ((res[modIndex]) ? res[modIndex] : "");
|
let formula = "(" + nbDice + "d" + res[2] + postForm + "+" + modifier +") *" + multiplier;
|
||||||
return formula;
|
return formula;
|
||||||
}
|
}
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
|
@ -17,6 +17,13 @@ BOL.damageValues = {
|
|||||||
"d6BB" : "d6B + dé bonus",
|
"d6BB" : "d6B + dé bonus",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BOL.damageMultiplier = {
|
||||||
|
"1": "x1",
|
||||||
|
"2": "x2",
|
||||||
|
"3": "x3",
|
||||||
|
"4": "x4",
|
||||||
|
}
|
||||||
|
|
||||||
BOL.equipmentSlots = {
|
BOL.equipmentSlots = {
|
||||||
"none" : "BOL.equipmentSlots.none",
|
"none" : "BOL.equipmentSlots.none",
|
||||||
"head" : "BOL.equipmentSlots.head",
|
"head" : "BOL.equipmentSlots.head",
|
||||||
|
@ -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.8.9.5",
|
"version": "0.8.9.6",
|
||||||
"templateVersion": 14,
|
"templateVersion": 14,
|
||||||
"minimumCoreVersion": "0.8.6",
|
"minimumCoreVersion": "0.8.6",
|
||||||
"compatibleCoreVersion": "9",
|
"compatibleCoreVersion": "9",
|
||||||
|
@ -115,6 +115,18 @@
|
|||||||
<input class="field-value" type="text" name="data.properties.damageModifiers" value="{{data.properties.damageModifiers}}" data-dtype="Number"/>
|
<input class="field-value" type="text" name="data.properties.damageModifiers" value="{{data.properties.damageModifiers}}" data-dtype="Number"/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="property-label">{{localize "BOL.itemProperty.damageMultiplier"}}</label>
|
||||||
|
<div class="form-fields center">
|
||||||
|
<select class="field-value" name="data.properties.damageMultiplier" data-dtype="String">
|
||||||
|
{{#select data.properties.damageMultiplier}}
|
||||||
|
{{#each config.damageMultiplier as |value id|}}
|
||||||
|
<option value="{{id}}">{{value}}</option>
|
||||||
|
{{/each}}
|
||||||
|
{{/select}}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="property-label">{{localize "BOL.itemProperty.damageSpecial"}}</label>
|
<label class="property-label">{{localize "BOL.itemProperty.damageSpecial"}}</label>
|
||||||
<div class="form-fields center">
|
<div class="form-fields center">
|
||||||
|
Loading…
Reference in New Issue
Block a user