Healing updates

This commit is contained in:
Dapoolp 2025-07-27 23:31:38 +02:00
parent 8cb4b7663e
commit 9d0d35d1a7
21 changed files with 146 additions and 86 deletions

View file

@ -17,9 +17,9 @@ export default class DhpChatLog extends foundry.applications.sidebar.tabs.ChatLo
html.querySelectorAll('.duality-action-damage').forEach(element =>
element.addEventListener('click', event => this.onRollDamage(event, data.message))
);
html.querySelectorAll('.duality-action-healing').forEach(element =>
element.addEventListener('click', event => this.onRollHealing(event, data.message))
);
// html.querySelectorAll('.duality-action-healing').forEach(element =>
// element.addEventListener('click', event => this.onRollDamage(event, data.message))
// );
html.querySelectorAll('.target-save-container').forEach(element =>
element.addEventListener('click', event => this.onRollSave(event, data.message))
);
@ -92,16 +92,16 @@ export default class DhpChatLog extends foundry.applications.sidebar.tabs.ChatLo
}
}
async onRollHealing(event, message) {
event.stopPropagation();
const actor = await this.getActor(message.system.source.actor);
if (!actor || !game.user.isGM) return true;
if (message.system.source.item && message.system.source.action) {
const action = this.getAction(actor, message.system.source.item, message.system.source.action);
if (!action || !action?.rollHealing) return;
await action.rollHealing(event, message);
}
}
// async onRollHealing(event, message) {
// event.stopPropagation();
// const actor = await this.getActor(message.system.source.actor);
// if (!actor || !game.user.isGM) return true;
// if (message.system.source.item && message.system.source.action) {
// const action = this.getAction(actor, message.system.source.item, message.system.source.action);
// if (!action || !action?.rollHealing) return;
// await action.rollHealing(event, message);
// }
// }
async onRollSave(event, message) {
event.stopPropagation();
@ -160,7 +160,7 @@ export default class DhpChatLog extends foundry.applications.sidebar.tabs.ChatLo
return {
isHit,
targets: isHit
? message.system.targets.filter(t => t.hit === true).map(target => game.canvas.tokens.get(target.id))
? message.system.targets.filter(t => t.hit === true).map(target => game.canvas.tokens.documentCollection.find(t => t.actor.uuid === target.actorId))
: Array.from(game.user.targets)
};
}
@ -222,21 +222,24 @@ export default class DhpChatLog extends foundry.applications.sidebar.tabs.ChatLo
});
}
target.actor.takeDamage(damages);
if(message.system.hasHealing)
target.actor.takeHealing(damages);
else
target.actor.takeDamage(damages);
}
}
async onHealing(event, message) {
event.stopPropagation();
const targets = Array.from(game.user.targets);
// async onHealing(event, message) {
// event.stopPropagation();
// const targets = Array.from(game.user.targets);
if (targets.length === 0)
return ui.notifications.info(game.i18n.localize('DAGGERHEART.UI.Notifications.noTargetsSelected'));
// if (targets.length === 0)
// return ui.notifications.info(game.i18n.localize('DAGGERHEART.UI.Notifications.noTargetsSelected'));
for (var target of targets) {
target.actor.takeHealing(message.system.roll);
}
}
// for (var target of targets) {
// target.actor.takeHealing(message.system.roll);
// }
// }
/**
* Toggle visibility of target containers.