diff options
Diffstat (limited to 'app/controllers')
-rw-r--r-- | app/controllers/characters/items_controller.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/app/controllers/characters/items_controller.rb b/app/controllers/characters/items_controller.rb index 93dc683..722c8ff 100644 --- a/app/controllers/characters/items_controller.rb +++ b/app/controllers/characters/items_controller.rb @@ -47,6 +47,14 @@ class Characters::ItemsController < ApplicationController end when "activity" start_activity(Activity.find_by_gid(effect[:gid])) and return + when "condition" + condition = Condition.find_by_gid(effect[:gid]) + Character.transaction do + current_char.shift_item(@item, -1) + current_char.states.create!(condition: condition, expires_at: Time.now + effect[:duration]) + flash[:notice] = "#{effect[:message]}" + flash[:notice] += " You gain the #{condition.name} condition." + end else raise "Invalid use effect type string (#{effect[:type]})" end |