mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-06-13 16:18:11 +02:00
FIX: formula lables for attacks and weapons
This commit is contained in:
parent
9d0cfdd927
commit
e154d8610c
4 changed files with 22 additions and 18 deletions
|
|
@ -50,23 +50,21 @@ export default class DHAttackAction extends DHDamageAction {
|
|||
_getLabels() {
|
||||
const labels = [];
|
||||
const { roll, range, damage } = this;
|
||||
|
||||
|
||||
if (roll.trait) labels.push(game.i18n.localize(`DAGGERHEART.CONFIG.Traits.${roll.trait}.short`))
|
||||
labels.push(game.i18n.localize(`DAGGERHEART.CONFIG.Range.${range}.short`));
|
||||
if (range) labels.push(game.i18n.localize(`DAGGERHEART.CONFIG.Range.${range}.short`));
|
||||
|
||||
for (const { value, type } of damage.parts) {
|
||||
const str = [value.dice];
|
||||
if (value.bonus) str.push(value.bonus.signedString());
|
||||
const str = Roll.replaceFormulaData(value.getFormula(), this.actor?.getRollData() ?? {});
|
||||
|
||||
const icons = Array.from(type)
|
||||
.map(t => CONFIG.DH.GENERAL.damageTypes[t]?.icon)
|
||||
.filter(Boolean);
|
||||
|
||||
const labelValue = str.join('');
|
||||
if (icons.length === 0) {
|
||||
labels.push(labelValue);
|
||||
labels.push(str);
|
||||
} else {
|
||||
labels.push({ value: labelValue, icons });
|
||||
labels.push({ value: str, icons });
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue