diff options
Diffstat (limited to 'app/controllers')
-rw-r--r-- | app/controllers/game_controller.rb | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/app/controllers/game_controller.rb b/app/controllers/game_controller.rb index 40d8991..886b37a 100644 --- a/app/controllers/game_controller.rb +++ b/app/controllers/game_controller.rb @@ -9,7 +9,14 @@ class GameController < ApplicationController return unless current_char.activity_time_remaining <= 0 activity = current_char.activity - return unless current_char.can_do_activity?(activity) # TODO: Add error message + unless current_char.can_do_activity?(activity) + message = "You can't do this right now." + message += " (requires #{activity.requirements&.join(", ")})" if activity.requirements.any? + message += " (costs #{activity.costs&.join(", ")})" if activity.costs.any? + @results.replace([{ type: "error", message: message }]) + current_char.stop_activity + return + end Character.transaction do current_char.pay_cost_for(activity) |