Class: BerserkPlayer
- Inherits:
-
TextGame::Player
- Object
- TextGame::Player
- BerserkPlayer
- Defined in:
- lib/text_game/berserk_player.rb
Instance Attribute Summary collapse
-
#berserk ⇒ Object
readonly
Returns the value of attribute berserk.
Attributes inherited from TextGame::Player
Instance Method Summary collapse
- #blam ⇒ Object
-
#initialize(name, health = 100) ⇒ BerserkPlayer
constructor
A new instance of BerserkPlayer.
- #woot ⇒ Object
Methods inherited from TextGame::Player
#each_treasure, #found_treasure, from_csv, #points_accumulated, #to_csv, #to_s
Methods included from Playable
Constructor Details
#initialize(name, health = 100) ⇒ BerserkPlayer
Returns a new instance of BerserkPlayer.
6 7 8 9 10 |
# File 'lib/text_game/berserk_player.rb', line 6 def initialize name, health=100 @berserk=false @berserk_count=0 super name, health end |
Instance Attribute Details
#berserk ⇒ Object (readonly)
Returns the value of attribute berserk.
5 6 7 |
# File 'lib/text_game/berserk_player.rb', line 5 def berserk @berserk end |
Instance Method Details
#blam ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/text_game/berserk_player.rb', line 16 def blam if @berserk woot else super end end |
#woot ⇒ Object
11 12 13 14 15 |
# File 'lib/text_game/berserk_player.rb', line 11 def woot @berserk_count+=1 @berserk = true if @berserk_count >=6 super end |