class TreasureHunt::BerserkPlayer
Public Class Methods
new(name, health=100)
click to toggle source
Calls superclass method
# File lib/treasure_game/berserk_player.rb, line 6 def initialize(name, health=100) super(name, health) @heal_count = 0 end
Public Instance Methods
berserk?()
click to toggle source
# File lib/treasure_game/berserk_player.rb, line 11 def berserk? @heal_count > 5 end
heal()
click to toggle source
Calls superclass method
# File lib/treasure_game/berserk_player.rb, line 15 def heal super @heal_count += 1 puts "#{@name} has gone berserk!" if berserk? end
hit()
click to toggle source
Calls superclass method
# File lib/treasure_game/berserk_player.rb, line 21 def hit berserk? ? heal : super end