Class: PAUL::ClumsyPlayer
Instance Attribute Summary
Attributes inherited from Player
Instance Method Summary collapse
-
#found_treasure(treasure) ⇒ Object
def found_treasure(treasure) points = treasure.points / 2.0 @found_treasures += points puts “#@name found a #treasuretreasure.name worth #Player#points points.” end.
Methods inherited from Player
#each_found_treasure, #initialize, #points, #to_s
Methods included from Paul
#blam, #name, #score, #strong?, #w00t
Constructor Details
This class inherits a constructor from PAUL::Player
Instance Method Details
#found_treasure(treasure) ⇒ Object
def found_treasure(treasure)
points = treasure.points / 2.0
@found_treasures[treasure.name] += points
puts "#{@name} found a #{treasure.name} worth #{points} points."
end
12 13 14 15 |
# File 'lib/PAUL/exercise20.rb', line 12 def found_treasure(treasure) damaged_treasure = Treasure.new(treasure.name, treasure.points / 2.0) super(damaged_treasure) end |