Class: Gemwarrior::Bed
- Defined in:
- lib/gemwarrior/entities/items/bed.rb
Constant Summary collapse
- USE_TEXT =
CONSTANTS
'** ZZZZZ **'
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 ⇒ Bed
constructor
A new instance of Bed.
- #use(world) ⇒ Object
Methods inherited from Item
Methods inherited from Entity
Constructor Details
#initialize ⇒ Bed
Returns a new instance of Bed.
11 12 13 14 15 16 17 |
# File 'lib/gemwarrior/entities/items/bed.rb', line 11 def initialize super self.name = 'bed' self.name_display = 'Bed' self.description = 'The place where you sleep when you are not adventuring.' end |
Instance Method Details
#use(world) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/gemwarrior/entities/items/bed.rb', line 19 def use(world) if world.player.at_full_hp? puts 'You feel perfectly healthy and decide not to actually use the bed. Besides, the trail of fire ants currently leading up to and around the furniture seem somehow uninviting.' { type: nil, data: nil } else Animation.run(phrase: USE_TEXT) puts 'You unmake the bed, get under the covers, close your eyes, and begin to think about all the things you need to do today. You realize sleep is not one of them and quickly get back up, remake the bed, and get on about your day.' puts '>> You regain all of your hit points.'.colorize(:green) { type: 'rest', data: world.player.hp_max-world.player.hp_cur } end end |