Skip to content

Commit

Permalink
closes #488
Browse files Browse the repository at this point in the history
  • Loading branch information
Muttley committed Sep 25, 2024
1 parent 7f3b38c commit 54ff7ce
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 11 additions & 3 deletions system/src/documents/FalloutActor.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -54,7 +57,6 @@ export default class FalloutActor extends Actor {
return this.type === "robot";
}


get isWellRested() {
return this.type === "character" && this.system.conditions.wellRested;
}
Expand Down Expand Up @@ -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);
}
}

0 comments on commit 54ff7ce

Please sign in to comment.