Module: DiabloGame::Playable

Included in:
Hero
Defined in:
lib/diablo_game/playable_mixin.rb

Instance Method Summary collapse

Instance Method Details

#dead?Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/diablo_game/playable_mixin.rb', line 14

def dead?
  @health <= 0
end

#healObject



9
10
11
12
# File 'lib/diablo_game/playable_mixin.rb', line 9

def heal
  @health += 15
  puts "#{@name} was healed. Health is now: #{@health}"
end

#hitObject



4
5
6
7
# File 'lib/diablo_game/playable_mixin.rb', line 4

def hit
  @health -= 30
  puts "#{@name} was hit! Health is now: #{@health}"
end