Class: StudioGame::Berserk
Instance Attribute Summary
Attributes inherited from Player
#health, #name
Instance Method Summary
collapse
Methods inherited from Player
#<=>, #found_item, #found_treasure, from_csv, #item_values, #items, #score, #to_s
Methods included from Playable
#strong?, #weak?
Constructor Details
#initialize(name, health) ⇒ Berserk
Returns a new instance of Berserk.
5
6
7
8
|
# File 'lib/game/berserk.rb', line 5
def initialize(name, health)
@woot_count = 0
super(name, health)
end
|
Instance Method Details
#berserk? ⇒ Boolean
24
25
26
|
# File 'lib/game/berserk.rb', line 24
def berserk?
@woot_count >= 5
end
|
#blam ⇒ Object
16
17
18
19
20
21
22
|
# File 'lib/game/berserk.rb', line 16
def blam
if berserk?
w00t
else
super
end
end
|
#w00t ⇒ Object
10
11
12
13
14
|
# File 'lib/game/berserk.rb', line 10
def w00t
@woot_count += 1
super
puts "#{@name} is berserk!" if berserk?
end
|