Class: PAUL::ClumsyPlayer

Inherits:
Player
  • Object
show all
Defined in:
lib/PAUL/exercise20.rb

Instance Attribute Summary

Attributes inherited from Player

#health, #name

Instance Method Summary collapse

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