module ClasslessMud::Character
This module is included in both player and NPC
Public Instance Methods
affect_health(amount)
click to toggle source
# File lib/classless_mud/character.rb, line 23 def affect_health amount self.health += amount if amount > 0 self.puts "You are healed for #{amount} health." self.puts "You have #{health} health" else self.puts "You take #{amount.abs} damage." self.puts "You have #{health} health" die if dead? end end
dead?()
click to toggle source
# File lib/classless_mud/character.rb, line 35 def dead? health <= 0 end
game=(game)
click to toggle source
# File lib/classless_mud/character.rb, line 19 def game= game @game = game end