Adapt healing

This commit is contained in:
Dapoolp 2025-07-19 15:10:56 +02:00
parent 92feddce1b
commit 3186378872
12 changed files with 95 additions and 87 deletions

View file

@ -142,7 +142,7 @@ export default class DHBaseAction extends foundry.abstract.DataModel {
static getSourceConfig(parent) {
const updateSource = {};
updateSource.img ??= parent?.img ?? parent?.system?.img;
if (parent?.type === 'weapon') {
if (parent?.type === 'weapon' && this === game.system.api.models.actions.actionsTypes.attack) {
updateSource['damage'] = { includeBase: true };
updateSource['range'] = parent?.system?.attack?.range;
updateSource['roll'] = {
@ -216,7 +216,6 @@ export default class DHBaseAction extends foundry.abstract.DataModel {
if (Hooks.call(`${CONFIG.DH.id}.preUseAction`, this, config) === false) return;
// Display configuration window if necessary
// if (config.dialog?.configure && this.requireConfigurationDialog(config)) {
if (this.requireConfigurationDialog(config)) {
config = await D20RollDialog.configure(null, config);
if (!config) return;

View file

@ -15,25 +15,25 @@ export default class DHHealingAction extends DHBaseAction {
}
async rollHealing(event, data) {
let formulaValue = this.getFormulaValue(data),
formula = formulaValue.getFormula(this.actor);
if (!formula || formula == '') return;
let roll = { formula: formula, total: formula };
const systemData = data.system ?? data;
let formulas = [{
formula: this.getFormulaValue(data).getFormula(this.actor),
applyTo: this.healing.applyTo
}];
const config = {
title: game.i18n.format('DAGGERHEART.UI.Chat.healingRoll.title', {
healing: game.i18n.localize(CONFIG.DH.GENERAL.healingTypes[this.healing.type].label)
healing: game.i18n.localize(CONFIG.DH.GENERAL.healingTypes[this.healing.applyTo].label)
}),
// roll: { formula },
roll: [ formula ],
roll: formulas,
targets: (data.system?.targets ?? data.targets).filter(t => t.hit),
messageType: 'healing',
type: this.healing.type,
source: systemData.source,
data: this.getRollData(),
event
};
roll = CONFIG.Dice.daggerheart.DamageRoll.build(config);
return CONFIG.Dice.daggerheart.DamageRoll.build(config);
}
get chatTemplate() {