diff --git a/CHANGELOG.md b/CHANGELOG.md index 99c14f98..cd697a7f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ #### Bugs - [#487] Hazmat Suit is missing cost/weight/rarity values +- [#488] Well rested doesn't modify current HP level correctly after party sleep #### Chores - [#478] Merge new French, Polish and Portuguese/Brazilian translation updates from Crowdin diff --git a/system/src/documents/FalloutActor.mjs b/system/src/documents/FalloutActor.mjs index f1c6d0de..5fe3e149 100644 --- a/system/src/documents/FalloutActor.mjs +++ b/system/src/documents/FalloutActor.mjs @@ -45,6 +45,9 @@ export default class FalloutActor extends Actor { return !this.isRobot; } + get isNotWellRested() { + return !this.isWellRested; + } get isPlayerCharacter() { return ["character", "robot"].includes(this.type); @@ -54,7 +57,6 @@ export default class FalloutActor extends Actor { return this.type === "robot"; } - get isWellRested() { return this.type === "character" && this.system.conditions.wellRested; } @@ -1565,11 +1567,17 @@ export default class FalloutActor extends Actor { if (newSleepStatus > 0) newSleepStatus--; } - await this.update({ + const updateData = { "system.conditions.fatigue": newFatigue, "system.conditions.lastChanged.sleep": game.time.worldTime, "system.conditions.sleep": newSleepStatus, "system.conditions.wellRested": newWellRested, - }); + }; + + if (newWellRested && this.isNotWellRested) { + updateData["system.health.value"] = this.system.health.value + 2; + } + + await this.update(updateData); } }