Class: Gemwarrior::Herb
- Defined in:
- lib/gemwarrior/entities/items/herb.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 ⇒ Herb
constructor
A new instance of Herb.
- #use(world) ⇒ Object
Methods inherited from Item
Methods inherited from Entity
Constructor Details
#initialize ⇒ Herb
Returns a new instance of Herb.
8 9 10 11 12 13 14 15 16 17 |
# File 'lib/gemwarrior/entities/items/herb.rb', line 8 def initialize super self.name = 'herb' self.name_display = 'Herb' self.description = 'Green and leafy, this wild herb looks edible.' self.takeable = true self.consumable = true self.useable_battle = true end |
Instance Method Details
#use(world) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/gemwarrior/entities/items/herb.rb', line 19 def use(world) puts 'You place the entire, smallish plant in your mouth, testing its texture. The mysterious herb is easily chewable, and you are able to swallow it without much effort. Slight tingles travel up and down your spine.' if world.player.at_full_hp? puts '>> The herb has no medicinal effect, as you already feel perfectly healthy, but it was kind of tasty.' { type: nil, data: nil } else hp_healed = rand(3..5) puts ">> You regain #{hp_healed} hit points.".colorize(:green) { type: 'health', data: hp_healed } end end |