Class: StudioGame::ClumsyPlayer

Inherits:
Player
  • Object
show all
Defined in:
lib/studio_game/Clumsy_player.rb

Instance Attribute Summary collapse

Attributes inherited from Player

#health, #name

Instance Method Summary collapse

Methods inherited from Player

#<=>, #each_treasure_found, #follow_up, from_csv, #points, #score, #to_s

Methods included from Playable

#strong?

Constructor Details

#initialize(name, health = 100, boost = 1) ⇒ ClumsyPlayer

Returns a new instance of ClumsyPlayer.



17
18
19
20
21
# File 'lib/studio_game/Clumsy_player.rb', line 17

def initialize (name, health=100, boost=1)
super(name, health)
@boost = boost
@times_sharted = 0
end

Instance Attribute Details

#boostObject (readonly)

Returns the value of attribute boost.



6
7
8
# File 'lib/studio_game/Clumsy_player.rb', line 6

def boost
  @boost
end

Instance Method Details

#found_treasure(treasure) ⇒ Object



8
9
10
11
12
13
14
15
# File 'lib/studio_game/Clumsy_player.rb', line 8

def found_treasure(treasure)
# points = treasure.points / 2
# @found_treasures[treasure.name] += points
# puts "#{@name} found a #{treasure.name} worth #{points} points."
# puts "#{@name}'s treasures: #{@found_treasures}"
damaged_treasure = Treasure.new(treasure.name, treasure.points/2)
super(damaged_treasure)
end

#high_fiveObject



23
24
25
# File 'lib/studio_game/Clumsy_player.rb', line 23

def high_five
@boost.times{super}
end

#rage?Boolean

Returns:

  • (Boolean)


27
28
29
# File 'lib/studio_game/Clumsy_player.rb', line 27

def rage?
@times_sharted > 5
end

#shartObject



31
32
33
34
35
36
37
38
39
# File 'lib/studio_game/Clumsy_player.rb', line 31

def shart
		@times_sharted += 1
		if rage?
 puts "#{@name} is raging!"
 high_five
		else
 super
		end
end