Tmp fix for non consistent resource

This commit is contained in:
Dapoolp 2025-06-29 22:15:26 +02:00
parent c5c98d7a99
commit 0cd3e41fa4
2 changed files with 3 additions and 2 deletions

View file

@ -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);

View file

@ -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);
}
};