From 0cd3e41fa4e3ec0822f61f179e7f043a17e38638 Mon Sep 17 00:00:00 2001 From: Dapoolp Date: Sun, 29 Jun 2025 22:15:26 +0200 Subject: [PATCH] Tmp fix for non consistent resource --- module/documents/actor.mjs | 3 ++- module/ui/chatLog.mjs | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/module/documents/actor.mjs b/module/documents/actor.mjs index 92f4f7b9..6e475d7e 100644 --- a/module/documents/actor.mjs +++ b/module/documents/actor.mjs @@ -422,13 +422,14 @@ export default class DhpActor extends Actor { break; default: updates.actor.resources[`system.resources.${r.type}.value`] = Math.max( - Math.min(this.system.resources[r.type].value + r.value, this.system.resources[r.type].max), + Math.min(this.system.resources[r.type].value + r.value, (this.system.resources[r.type].maxTotal ?? this.system.resources[r.type].max)), 0 ); break; } }); Object.values(updates).forEach(async u => { + console.log(updates, u) if (Object.keys(u.resources).length > 0) { if (game.user.isGM) { await u.target.update(u.resources); diff --git a/module/ui/chatLog.mjs b/module/ui/chatLog.mjs index 3f537adf..dfcc1b8e 100644 --- a/module/ui/chatLog.mjs +++ b/module/ui/chatLog.mjs @@ -155,7 +155,6 @@ export default class DhpChatLog extends foundry.applications.sidebar.tabs.ChatLo : Array.from(game.user.targets); if(message.system.onSave && event.currentTarget.dataset.targetHit) { - console.log(message.system.targets) const pendingingSaves = message.system.targets.filter(target => target.hit && target.saved.success === null); if(pendingingSaves.length) { const confirm = await foundry.applications.api.DialogV2.confirm({ @@ -171,6 +170,7 @@ export default class DhpChatLog extends foundry.applications.sidebar.tabs.ChatLo for (let target of targets) { let damage = message.system.roll.total; if(message.system.onSave && message.system.targets.find(t => t.id === target.id)?.saved?.success === true) damage = Math.ceil(damage * (SYSTEM.ACTIONS.damageOnSave[message.system.onSave]?.mod ?? 1)); + await target.actor.takeDamage(damage, message.system.roll.type); } };