mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-15 05:01:08 +01:00
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:
parent
7cbbb3168e
commit
fc8eb8cb04
1 changed files with 7 additions and 7 deletions
|
|
@ -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);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue