Fix journey end calculation and hope reduction when gaining scars

This commit is contained in:
Carlos Fernandez 2026-05-17 19:51:56 -04:00
parent ab412367f9
commit 52a21e9388
2 changed files with 9 additions and 7 deletions

View file

@ -840,12 +840,13 @@ export default class DhCharacter extends DhCreature {
const newHopeMax = this.resources.hope.max + diff;
const newHopeValue = Math.min(newHopeMax, this.resources.hope.value);
if (newHopeValue != this.resources.hope.value) {
if (!changes.system.resources.hope) changes.system.resources.hope = { value: 0 };
changes.system.resources.hope = {
...changes.system.resources.hope,
value: changes.system.resources.hope.value + newHopeValue
};
changes.system = foundry.utils.mergeObject(changes.system ?? {}, {
resources: {
hope: {
value: (changes.system?.resources?.hope?.value ?? 0) + newHopeMax
}
}
});
}
}