Class: Gemwarrior::Letter
- Defined in:
- lib/gemwarrior/entities/items/letter.rb
Instance Attribute Summary
Attributes inherited from Item
#atk_hi, #atk_lo, #consumable, #equippable, #equipped, #takeable, #useable, #used
Attributes inherited from Entity
Instance Method Summary collapse
-
#initialize ⇒ Letter
constructor
A new instance of Letter.
- #use(player = nil) ⇒ Object
Methods inherited from Item
Methods inherited from Entity
Constructor Details
#initialize ⇒ Letter
Returns a new instance of Letter.
8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/gemwarrior/entities/items/letter.rb', line 8 def initialize self.name = 'letter' self.description = 'A single page of thin paper, folded at the middle, with some excellent penmanship impressed upon it.' self.atk_lo = nil self.atk_hi = nil self.takeable = true self.useable = true self.equippable = false self.equipped = false self.used = false end |
Instance Method Details
#use(player = nil) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/gemwarrior/entities/items/letter.rb', line 20 def use(player = nil) if self.used puts 'Do you want to read the letter again? (Y/N)' print '> ' choice = STDIN.getch case choice when 'y' print "\n" print_letter(player) else {:type => nil, :data => nil} end else self.used = true print_letter(player) {:type => 'xp', :data => 3} end end |