Fix Damage chat message (#377)

* Fix Damage chat message

* Fix damage save

* Fix damage save 2

* Fix damage save 2

* Fix damage save 3
This commit is contained in:
Dapoulp 2025-07-19 18:08:32 +02:00 committed by GitHub
parent 7cbbb3168e
commit fc8eb8cb04
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -211,19 +211,19 @@ export default class DhpChatLog extends foundry.applications.sidebar.tabs.ChatLo
return ui.notifications.info(game.i18n.localize('DAGGERHEART.UI.Notifications.noTargetsSelected')); return ui.notifications.info(game.i18n.localize('DAGGERHEART.UI.Notifications.noTargetsSelected'));
for (let target of targets) { for (let target of targets) {
let damages = message.system.damage; let damages = foundry.utils.deepClone(message.system.damage?.roll ?? message.system.roll);
if (message.system.onSave && message.system.targets.find(t => t.id === target.id)?.saved?.success === true) { if (message.system.onSave && message.system.targets.find(t => t.id === target.id)?.saved?.success === true) {
const mod = CONFIG.DH.ACTIONS.damageOnSave[message.system.onSave]?.mod ?? 1; const mod = CONFIG.DH.ACTIONS.damageOnSave[message.system.onSave]?.mod ?? 1;
Object.entries(damages).forEach((k,v) => { Object.entries(damages).forEach(([k,v]) => {
let newTotal = 0; v.total = 0;
v.forEach(part => { v.parts.forEach(part => {
v.total = Math.ceil(v.total * mod); part.total = Math.ceil(part.total * mod);
newTotal += v.total; v.total += part.total;
}) })
}) })
} }
target.actor.takeDamage(damages.roll); target.actor.takeDamage(damages);
} }
}; };