From 3b3d0ddaaa368359a474b60c79771406168e7e1e Mon Sep 17 00:00:00 2001 From: David Gay Date: Mon, 31 May 2021 20:12:09 -0400 Subject: Change rested time mechanic to require more active play, and update changelog for 0.1.4.1 release --- app/models/character.rb | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'app/models') 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 -- cgit v1.2.3