Class: BerserkPlayer

Inherits:
TextGame::Player show all
Defined in:
lib/text_game/berserk_player.rb

Instance Attribute Summary collapse

Attributes inherited from TextGame::Player

#health, #name, #score

Instance Method Summary collapse

Methods inherited from TextGame::Player

#each_treasure, #found_treasure, from_csv, #points_accumulated, #to_csv, #to_s

Methods included from Playable

#<=>, #strong?

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

#berserkObject (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

#blamObject



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

#wootObject



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