mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-07-21 18:09:54 +02:00
Start supporting flat damage without custom formulas (#2077)
Some checks are pending
Project CI / build (24.x) (push) Waiting to run
Some checks are pending
Project CI / build (24.x) (push) Waiting to run
This commit is contained in:
parent
c181a47cc2
commit
4b651836ff
1 changed files with 11 additions and 3 deletions
|
|
@ -275,10 +275,18 @@ export class DHActionDiceData extends foundry.abstract.DataModel {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @returns {string} the formula associated with this damage field
|
||||||
|
*/
|
||||||
getFormula() {
|
getFormula() {
|
||||||
const multiplier = this.multiplier === 'flat' ? this.flatMultiplier : `@${this.multiplier}`,
|
if (this.custom.enabled) return this.custom.formula;
|
||||||
bonus = this.bonus ? (this.bonus < 0 ? ` - ${Math.abs(this.bonus)}` : ` + ${this.bonus}`) : '';
|
|
||||||
return this.custom.enabled ? this.custom.formula : `${multiplier ?? 1}${this.dice}${bonus}`;
|
const multiplier = this.multiplier === 'flat' ? this.flatMultiplier : `@${this.multiplier}`;
|
||||||
|
if (!multiplier) return String(this.bonus || 0);
|
||||||
|
|
||||||
|
const dice = `${multiplier ?? 1}${this.dice}`;
|
||||||
|
const sign = this.bonus < 0 ? ' - ' : ' + ';
|
||||||
|
return this.bonus ? `${dice} ${sign} ${Math.abs(this.bonus)}` : dice;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue