diff options
author | David Gay <david@davidgay.org> | 2021-05-29 17:19:56 -0400 |
---|---|---|
committer | David Gay <david@davidgay.org> | 2021-05-29 17:19:56 -0400 |
commit | aac7563767c5fbc5ef67f4d615833e7523a46df7 (patch) | |
tree | 807e708c32d6d8710bcc1b6f96862ed34b320072 /app/controllers | |
parent | 8f9dcbf33d5cd3222e4d8e0cfa6f72b1596b917c (diff) |
Conditions and states (boons & banes), with `quarrying_draught`
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 |