mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-15 13:11:08 +01:00
Update the current Hope value if the scar value change affects it
This commit is contained in:
parent
d6c3cfb83a
commit
cb143756e3
1 changed files with 14 additions and 0 deletions
|
|
@ -679,6 +679,20 @@ export default class DhCharacter extends BaseDataActor {
|
||||||
changes.system.experiences[experience].core = true;
|
changes.system.experiences[experience].core = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Scars can alter the amount of current hope */
|
||||||
|
if (changes.system?.scars) {
|
||||||
|
const diff = this.system.scars - changes.system.scars;
|
||||||
|
const newHopeMax = this.system.resources.hope.max + diff;
|
||||||
|
const newHopeValue = Math.min(newHopeMax, this.system.resources.hope.value);
|
||||||
|
if (newHopeValue != this.system.resources.hope.value) {
|
||||||
|
changes.system.resources = {
|
||||||
|
hope: {
|
||||||
|
value: newHopeValue
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async _preDelete() {
|
async _preDelete() {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue