diff options
Diffstat (limited to 'app/controllers')
-rw-r--r-- | app/controllers/characters/items_controller.rb | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/app/controllers/characters/items_controller.rb b/app/controllers/characters/items_controller.rb index 722c8ff..470e21c 100644 --- a/app/controllers/characters/items_controller.rb +++ b/app/controllers/characters/items_controller.rb @@ -5,10 +5,15 @@ class Characters::ItemsController < ApplicationController def equip @item = Item.find(params[:item_id]) + unless current_char.can_equip? @item + flash[:alert] = "Couldn't equip #{@item.name}" + flash[:alert] += " (requires #{@item.equip_requirements&.join(", ")})" if @item.equip_requirements.any? + return + end current_char.equip(@item) flash[:notice] = "Equipped #{@item.name}." rescue EquipmentError - flash[:alert] = "Couldn't equip #{@item.name}." + flash[:alert] = "Couldn't equip #{@item.name}. Make sure the slot is free." ensure redirect_to character_items_path(current_char) end |