Module: ClasslessMud::Character
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/classless_mud/character.rb
Overview
This module is included in both player and NPC
Instance Method Summary collapse
Instance Method Details
#affect_health(amount) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 |
# 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? ⇒ Boolean
35 36 37 |
# File 'lib/classless_mud/character.rb', line 35 def dead? health <= 0 end |
#game=(game) ⇒ Object
19 20 21 |
# File 'lib/classless_mud/character.rb', line 19 def game= game @game = game end |