Class: StudioGame::BerserkPlayer
- Defined in:
- lib/studio_game/berserk_player.rb
Overview
A berserk player whose treasures are worth half the normal amount
Instance Attribute Summary
Attributes inherited from Player
#found_treasures, #health, #name
Instance Method Summary collapse
- #berserk? ⇒ Boolean
- #boost ⇒ Object
- #drain ⇒ Object
-
#initialize(name, health = 25) ⇒ BerserkPlayer
constructor
A new instance of BerserkPlayer.
Methods inherited from Player
#found_treasure, from_csv, #points, #score, #to_s
Constructor Details
#initialize(name, health = 25) ⇒ BerserkPlayer
Returns a new instance of BerserkPlayer.
6 7 8 9 10 |
# File 'lib/studio_game/berserk_player.rb', line 6 def initialize(name, health = 25) name = "#{name} 😈" @boost_count = 0 super(name, health) end |
Instance Method Details
#berserk? ⇒ Boolean
12 13 14 |
# File 'lib/studio_game/berserk_player.rb', line 12 def berserk? @boost_count >= 5 end |
#boost ⇒ Object
16 17 18 19 |
# File 'lib/studio_game/berserk_player.rb', line 16 def boost super berserk? ? puts('😈😈😈') : @boost_count += 1 end |
#drain ⇒ Object
21 22 23 |
# File 'lib/studio_game/berserk_player.rb', line 21 def drain berserk? ? boost : super end |