Class: Gemwarrior::Monster
- Defined in:
- lib/gemwarrior/entities/monster.rb
Direct Known Subclasses
Alexandrat, Amberoo, Amethystle, Apatiger, Aquamarine, Bloodstorm, Boss, Citrinaga, Coraliz, Cubicat, Diaman, Emerald, Garynetty
Constant Summary collapse
Instance Attribute Summary collapse
-
#battlecry ⇒ Object
Returns the value of attribute battlecry.
-
#inventory ⇒ Object
Returns the value of attribute inventory.
-
#is_boss ⇒ Object
Returns the value of attribute is_boss.
Attributes inherited from Creature
#atk_hi, #atk_lo, #defense, #dexterity, #face, #hands, #hp_cur, #hp_max, #level, #mood, #rox, #xp
Attributes inherited from Entity
Instance Method Summary collapse
- #describe ⇒ Object
-
#initialize ⇒ Monster
constructor
A new instance of Monster.
Methods inherited from Entity
Constructor Details
#initialize ⇒ Monster
Returns a new instance of Monster.
13 14 15 16 17 18 19 |
# File 'lib/gemwarrior/entities/monster.rb', line 13 def initialize if [true, false].sample self.inventory = Inventory.new([INVENTORY_ITEMS_DEFAULT[rand(0..INVENTORY_ITEMS_DEFAULT.length-1)]]) else self.inventory = Inventory.new end end |
Instance Attribute Details
#battlecry ⇒ Object
Returns the value of attribute battlecry.
11 12 13 |
# File 'lib/gemwarrior/entities/monster.rb', line 11 def battlecry @battlecry end |
#inventory ⇒ Object
Returns the value of attribute inventory.
11 12 13 |
# File 'lib/gemwarrior/entities/monster.rb', line 11 def inventory @inventory end |
#is_boss ⇒ Object
Returns the value of attribute is_boss.
11 12 13 |
# File 'lib/gemwarrior/entities/monster.rb', line 11 def is_boss @is_boss end |
Instance Method Details
#describe ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/gemwarrior/entities/monster.rb', line 21 def describe status_text = name.upcase.ljust(13).colorize(:green) status_text << "#{description}\n".colorize(:white) if is_boss status_text << '(BOSS)'.ljust(13).colorize(:yellow) else status_text << ''.ljust(13) end status_text << "LEVEL: #{level.to_s.rjust(2)}, ".colorize(:white) status_text << "HP: #{hp_cur.to_s.rjust(3)}/#{hp_max.to_s.rjust(3)} ".colorize(:white) status_text << "ATK: #{atk_lo.to_s.rjust(2)}-#{atk_hi.to_s.rjust(2)} ".colorize(:white) status_text << "DEF: #{defense.to_s.rjust(2)} ".colorize(:white) status_text << "DEX: #{dexterity.to_s.rjust(2)} ".colorize(:white) status_text << "ROX: #{rox.to_s.rjust(3)} ".colorize(:white) status_text << "XP: #{xp.to_s.rjust(3)} ".colorize(:white) status_text << "\n".ljust(14) status_text << "FACE: #{face} ".colorize(:white) status_text << "HANDS: #{hands} ".colorize(:white) status_text << "MOOD: #{mood} ".colorize(:white) status_text << "INV: #{inventory.list_contents}".colorize(:white) status_text << "\n" end |