diff options
-rw-r--r-- | CHANGELOG.md | 6 | ||||
-rw-r--r-- | app/models/character.rb | 5 |
2 files changed, 8 insertions, 3 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 3981c11..20dcb7b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,12 @@ # Changelog All notable changes to this project will be documented in this file. +## [0.1.4.1] - 2021-05-31 + +### Changed +- Max rested time reduced from 10 days to 12 hours +- Rested time is now used to cut your timer in half, rather than reduce it by a flat amount + ## [0.1.4] - 2021-05-31 ### Added diff --git a/app/models/character.rb b/app/models/character.rb index 25a4ac5..b7b323d 100644 --- a/app/models/character.rb +++ b/app/models/character.rb @@ -207,7 +207,7 @@ class Character < ApplicationRecord def rested_duration_to_spend_on_activity return nil unless self.activity - [duration_of_activity - 10, self.rested_duration].min + [(duration_of_activity / 2).floor, self.rested_duration].min end def can_do_activity?(activity, ignore_cost: false, ignore_requirements: false) @@ -264,8 +264,7 @@ class Character < ApplicationRecord return false unless self.started_resting_at Character.transaction do seconds_of_this_rest = (Time.now - self.started_resting_at).to_i - # Maximum rested duration is 10 days. - new_rested_duration = [(seconds_of_this_rest + self.rested_duration), (60 * 60 * 24 * 10)].min + new_rested_duration = [(seconds_of_this_rest + self.rested_duration), (60 * 60 * 12)].min self.update(started_resting_at: nil, rested_duration: new_rested_duration) end end |