This commit is contained in:
Dapoolp 2025-07-18 15:13:45 +02:00
parent b3984a8e5f
commit 7e382d2e08
9 changed files with 52 additions and 61 deletions

View file

@ -128,8 +128,7 @@ export class DHDamageData extends DHResourceData {
required: true
}),
{
label: 'Type',
initial: 'physical'
label: 'Type'
}
)
}

View file

@ -34,16 +34,10 @@ export default class DHDamageAction extends DHBaseAction {
async rollDamage(event, data) {
const systemData = data.system ?? data;
/* let formula = this.damage.parts.map(p => this.getFormulaValue(p, data).getFormula(this.actor)).join(' + '),
damageTypes = [...new Set(this.damage.parts.reduce((a, c) => a.concat([...c.type]), []))];
damageTypes = !damageTypes.length ? ['physical'] : damageTypes;
if (!formula || formula == '') return; */
let formulas = this.damage.parts.map(p => ({
formula: this.getFormulaValue(p, data).getFormula(this.actor),
damageTypes: p.type,
damageTypes: p.applyTo === 'hitPoints' && !p.type.size ? new Set(['physical']) : p.type,
applyTo: p.applyTo
}));
@ -51,21 +45,14 @@ export default class DHDamageAction extends DHBaseAction {
formulas = this.formatFormulas(formulas, systemData);
/* let roll = { formula: formula, total: formula };
if (isNaN(formula)) formula = Roll.replaceFormulaData(formula, this.getRollData(systemData)); */
const config = {
title: game.i18n.format('DAGGERHEART.UI.Chat.damageRoll.title', { damage: this.name }),
// roll: { formula },
// roll: { formulas },
roll: formulas,
targets: systemData.targets.filter(t => t.hit) ?? data.targets,
hasSave: this.hasSave,
isCritical: systemData.roll?.isCritical ?? false,
source: systemData.source,
data: this.getRollData(),
// damageTypes,
event
};
if (this.hasSave) config.onSave = this.save.damageMod;
@ -76,7 +63,6 @@ export default class DHDamageAction extends DHBaseAction {
config.directDamage = true;
}
// roll = CONFIG.Dice.daggerheart.DamageRoll.build(config);
CONFIG.Dice.daggerheart.DamageRoll.build(config);
return CONFIG.Dice.daggerheart.DamageRoll.build(config);
}
}

View file

@ -19,14 +19,14 @@ export default class DHHealingAction extends DHBaseAction {
formula = formulaValue.getFormula(this.actor);
if (!formula || formula == '') return;
let roll = { formula: formula, total: formula },
bonusDamage = [];
let roll = { formula: formula, total: formula };
const config = {
title: game.i18n.format('DAGGERHEART.UI.Chat.healingRoll.title', {
healing: game.i18n.localize(CONFIG.DH.GENERAL.healingTypes[this.healing.type].label)
}),
roll: { formula },
// roll: { formula },
roll: [ formula ],
targets: (data.system?.targets ?? data.targets).filter(t => t.hit),
messageType: 'healing',
type: this.healing.type,