mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-12 19:51:08 +01:00
Initial damage message
This commit is contained in:
parent
afdffb672a
commit
362facae76
5 changed files with 95 additions and 4 deletions
|
|
@ -597,7 +597,9 @@ export default class DhpActor extends Actor {
|
|||
|
||||
await this.modifyResource(updates);
|
||||
|
||||
if (Hooks.call(`${CONFIG.DH.id}.postTakeDamage`, this, updates) === false) return null;
|
||||
Hooks.call(`${CONFIG.DH.id}.postTakeDamage`, this, updates);
|
||||
|
||||
return updates;
|
||||
}
|
||||
|
||||
calculateDamage(baseDamage, type) {
|
||||
|
|
@ -645,7 +647,8 @@ export default class DhpActor extends Actor {
|
|||
|
||||
await this.modifyResource(updates);
|
||||
|
||||
if (Hooks.call(`${CONFIG.DH.id}.postTakeHealing`, this, updates) === false) return null;
|
||||
Hooks.call(`${CONFIG.DH.id}.postTakeHealing`, this, updates);
|
||||
return updates;
|
||||
}
|
||||
|
||||
async modifyResource(resources) {
|
||||
|
|
|
|||
|
|
@ -156,6 +156,7 @@ export default class DhpChatMessage extends foundry.documents.ChatMessage {
|
|||
if (targets.length === 0)
|
||||
return ui.notifications.info(game.i18n.localize('DAGGERHEART.UI.Notifications.noTargetsSelected'));
|
||||
|
||||
const targetDamage = [];
|
||||
for (let target of targets) {
|
||||
let damages = foundry.utils.deepClone(this.system.damage);
|
||||
if (
|
||||
|
|
@ -174,9 +175,26 @@ export default class DhpChatMessage extends foundry.documents.ChatMessage {
|
|||
}
|
||||
|
||||
this.consumeOnSuccess();
|
||||
if (this.system.hasHealing) target.actor.takeHealing(damages);
|
||||
else target.actor.takeDamage(damages, this.system.isDirect);
|
||||
const updates = this.system.hasHealing
|
||||
? await target.actor.takeHealing(damages)
|
||||
: await target.actor.takeDamage(damages, this.system.isDirect);
|
||||
targetDamage.push({ token: target, updates: updates });
|
||||
}
|
||||
|
||||
const cls = getDocumentClass('ChatMessage');
|
||||
const msg = {
|
||||
user: game.user.id,
|
||||
speaker: cls.getSpeaker(),
|
||||
title: game.i18n.localize('DAGGERHEART.UI.Chat.deathMove.title'),
|
||||
content: await foundry.applications.handlebars.renderTemplate(
|
||||
'systems/daggerheart/templates/ui/chat/damageSummary.hbs',
|
||||
{
|
||||
targets: targetDamage
|
||||
}
|
||||
)
|
||||
};
|
||||
|
||||
cls.create(msg);
|
||||
}
|
||||
|
||||
getAction(actor, itemId, actionId) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue