Class: Gemwarrior::Chest
- Defined in:
- lib/gemwarrior/entities/items/chest.rb
Instance Attribute Summary
Attributes inherited from Item
Attributes inherited from Entity
#consumable, #describe, #describe_detailed, #description, #display_shopping_cart, #equippable, #equipped, #name, #name_display, #number_of_uses, #takeable, #talkable, #useable, #useable_battle, #used, #used_again
Instance Method Summary collapse
-
#initialize ⇒ Chest
constructor
A new instance of Chest.
- #use(world) ⇒ Object
Methods inherited from Item
Methods inherited from Entity
Constructor Details
#initialize ⇒ Chest
Returns a new instance of Chest.
8 9 10 11 12 13 14 |
# File 'lib/gemwarrior/entities/items/chest.rb', line 8 def initialize super self.name = 'chest' self.name_display = 'Chest' self.description = 'Well-crafted with solid oak, this family chest has intricate inlays all around the front and sides. It\'s the one thing from home you took with you when you left.' end |
Instance Method Details
#use(world) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/gemwarrior/entities/items/chest.rb', line 16 def use(world) home = world.location_by_name('home') open_description = 'You open the chest and find little inside but some dust and faded memories of your childhood.' if self.used if home.contains_item?('leather_jerkin') open_description += ' The old sword fighting garment is still in there, too.' end puts open_description { type: nil, data: nil } else open_description += ' That, and a slightly dirty, but still useful garment you remember using while taking those sword fighting lessons as a small boy.' puts open_description home.items.push(LeatherJerkin.new) self.used = true { type: nil, data: nil } end end |