Class: BattleRoyal::AdvantagedPlayer
- Inherits:
-
Player
- Object
- Player
- BattleRoyal::AdvantagedPlayer
show all
- Defined in:
- lib/battle_royal/advantaged_player.rb
Instance Attribute Summary
Attributes inherited from Player
#health, #name
Instance Method Summary
collapse
Methods inherited from Player
#attack, #each_found_weapon, #found_weapon, from_csv, #points, #score, #to_s
Methods included from Playable
#strong?
Constructor Details
#initialize(name, health = 100) ⇒ AdvantagedPlayer
Returns a new instance of AdvantagedPlayer.
4
5
6
7
|
# File 'lib/battle_royal/advantaged_player.rb', line 4
def initialize(name, health = 100)
super(name, health)
@power_up_count = 0
end
|
Instance Method Details
#advantaged? ⇒ Boolean
9
10
11
|
# File 'lib/battle_royal/advantaged_player.rb', line 9
def advantaged?
@power_up_count > 5
end
|
#damage ⇒ Object
19
20
21
|
# File 'lib/battle_royal/advantaged_player.rb', line 19
def damage
advantaged? ? power_up : super
end
|
#power_up ⇒ Object
13
14
15
16
17
|
# File 'lib/battle_royal/advantaged_player.rb', line 13
def power_up
super
@power_up_count += 1
puts "#{@name} is advantaged!" if advantaged?
end
|