mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-11 19:25:21 +01:00
Feature/443 adversary action roll type (#456)
* Some tests * Filter types choices * Resource/Uses max as FormulaField * Removed isReversed on item resources * Stuffs --------- Co-authored-by: WBHarry <williambjrklund@gmail.com>
This commit is contained in:
parent
2608c4a5ae
commit
8e516df7cb
19 changed files with 172 additions and 86 deletions
|
|
@ -7,6 +7,7 @@ export default class RegisterHandlebarsHelpers {
|
|||
includes: this.includes,
|
||||
times: this.times,
|
||||
damageFormula: this.damageFormula,
|
||||
formulaValue: this.formulaValue,
|
||||
damageSymbols: this.damageSymbols,
|
||||
rollParsed: this.rollParsed,
|
||||
hasProperty: foundry.utils.hasProperty,
|
||||
|
|
@ -39,6 +40,15 @@ export default class RegisterHandlebarsHelpers {
|
|||
return instances.join(traitTotal > 0 ? ' + ' : ' - ');
|
||||
}
|
||||
|
||||
static formulaValue(formula, item) {
|
||||
if(isNaN(formula)) {
|
||||
const data = item.getRollData.bind(item)(),
|
||||
roll = new Roll(Roll.replaceFormulaData(formula, data)).evaluateSync();
|
||||
formula = roll.total;
|
||||
}
|
||||
return formula;
|
||||
}
|
||||
|
||||
static damageSymbols(damageParts) {
|
||||
const symbols = [...new Set(damageParts.reduce((a, c) => a.concat([...c.type]), []))].map(
|
||||
p => CONFIG.DH.GENERAL.damageTypes[p].icon
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue