Class: Gemwarrior::SmallHole
- Inherits:
-
Item
show all
- Defined in:
- lib/gemwarrior/entities/items/small_hole.rb
Instance Attribute Summary
Attributes inherited from Item
#atk_hi, #atk_lo, #equippable, #equipped, #takeable, #useable
Attributes inherited from Entity
#description, #name
Instance Method Summary
collapse
Methods inherited from Item
#describe
Methods inherited from Entity
#status
Constructor Details
Returns a new instance of SmallHole.
12
13
14
15
16
17
18
19
20
21
|
# File 'lib/gemwarrior/entities/items/small_hole.rb', line 12
def initialize
self.name = 'small_hole'
self.description = 'Amongst the rubble of the alcove, a small hole, barely big enough for a rodent, exists in an absently-minded way near the bottom of the wall.'
self.atk_lo = nil
self.atk_hi = nil
self.takeable = false
self.useable = true
self.equippable = false
self.equipped = false
end
|
Instance Method Details
#rat_shop(player) ⇒ Object
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
|
# File 'lib/gemwarrior/entities/items/small_hole.rb', line 33
def rat_shop(player)
items_purchased = []
puts '>>"Hello, wanderer. Welcome to my establishment, as it were. Are you in need of anything?"'
puts
puts 'The creature gently shoves a small slip of paper out of his hole and towards you. You take a peek and notice it has a list of things with prices on it.'
puts
puts 'Rockney\'s Hole in the Wall'
puts '--------------------------'
puts '(1) Herb - 10 rox'
puts '(2) Dagger - 150 rox'
puts
puts '>>"What are you in need of?"'
loop do
puts " 1 - Herb"
puts " 2 - Dagger"
puts " x - leave"
choice = gets.chomp!
case choice
when '1'
if player.rox >= 10
player.rox -= 10
items_purchased.push(Herb.new)
puts '>>"Excellent choice."'
puts '>>"Anything else?"'
next
else
puts PLAYER_ROX_INSUFFICIENT
next
end
when '2'
if player.rox >= 150
player.rox -= 150
items_purchased.push(Dagger.new)
puts '>>"A fine blade, indeed."'
puts '>>"Anything else?"'
next
else
puts PLAYER_ROX_INSUFFICIENT
next
end
when 'x'
puts '>>"If you need anything further, I\'m always in this hole..."'
return {:type => 'purchase', :data => items_purchased}
else
puts '>>"Huh?"'
next
end
end
end
|
#reuse(player = nil) ⇒ Object
29
30
31
|
# File 'lib/gemwarrior/entities/items/small_hole.rb', line 29
def reuse(player = nil)
rat_shop(player)
end
|
#use(player = nil) ⇒ Object
23
24
25
26
27
|
# File 'lib/gemwarrior/entities/items/small_hole.rb', line 23
def use(player = nil)
puts 'You lower yourself to the ground and attempt to peer in the hole in the wall. Just as you begin to think this is a fruitless endeavor, a pair of bright, beady eyes manifest, and an unexpectedly low voice begins speaking to you:'
rat_shop(player)
end
|