diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/lib/activity_processor.rb | 2 | ||||
-rw-r--r-- | app/models/character.rb | 1 |
2 files changed, 2 insertions, 1 deletions
diff --git a/app/lib/activity_processor.rb b/app/lib/activity_processor.rb index 72c7ddd..b5dd11c 100644 --- a/app/lib/activity_processor.rb +++ b/app/lib/activity_processor.rb @@ -9,7 +9,7 @@ class ActivityProcessor end def process - return unless @character.activity_time_remaining <= 0 + return unless @character.activity && @character.activity_time_remaining <= 0 if @character.resting? @results.replace([{ type: "error", message: "You can't do anything while you're resting." }]) @character.stop_activity diff --git a/app/models/character.rb b/app/models/character.rb index ce2b0db..d386002 100644 --- a/app/models/character.rb +++ b/app/models/character.rb @@ -197,6 +197,7 @@ class Character < ApplicationRecord end def activity_time_remaining + return nil unless self.activity time = activity_duration - (Time.now - self.activity_started_at) time -= rested_duration_to_spend_on_activity if self.rested_duration > 0 time |