diff options
Diffstat (limited to 'app/controllers')
-rw-r--r-- | app/controllers/activities_controller.rb | 8 | ||||
-rw-r--r-- | app/controllers/game_controller.rb | 1 |
2 files changed, 7 insertions, 2 deletions
diff --git a/app/controllers/activities_controller.rb b/app/controllers/activities_controller.rb index a535f99..a32ffab 100644 --- a/app/controllers/activities_controller.rb +++ b/app/controllers/activities_controller.rb @@ -5,7 +5,11 @@ class ActivitiesController < ApplicationController def start @activity = Activity.find(params[:id]) - current_char.update(activity: @activity, activity_started_at: Time.now) - redirect_to action: :show + if current_char.can_do_activity?(@activity) + redirect_to action: :show + else + flash[:alert] = "You can't do that. Make sure you have the items and meet the requirements." + redirect_to character_path(current_char) + end end end diff --git a/app/controllers/game_controller.rb b/app/controllers/game_controller.rb index d69645f..147b692 100644 --- a/app/controllers/game_controller.rb +++ b/app/controllers/game_controller.rb @@ -2,6 +2,7 @@ class GameController < ApplicationController def finish_activity @results = [] return unless current_char.activity_time_remaining <= 0 + return unless current_char.can_do_activity?(current_char.activity) # TODO: Add error message current_char.update(activity_started_at: Time.now) current_char.activity.whatnot[:results].each do |result| |