Class: Gemwarrior::Monster
- Defined in:
- lib/gemwarrior/entities/monster.rb
Direct Known Subclasses
Alexandrat, Amberoo, Amethystle, Apatiger, Aquamarine, Bloodstorm, Citrinaga, Coraliz, Cubicat, Diaman, Emerald, Garynetty, Jaspern
Constant Summary collapse
Instance Attribute Summary collapse
-
#battlecry ⇒ Object
Returns the value of attribute battlecry.
-
#is_boss ⇒ Object
Returns the value of attribute is_boss.
-
#is_dead ⇒ Object
Returns the value of attribute is_dead.
Attributes inherited from Creature
#atk_hi, #atk_lo, #defense, #dexterity, #face, #hands, #hp_cur, #hp_max, #inventory, #level, #mood, #rox, #speak, #use, #xp
Attributes inherited from Entity
#consumable, #describe, #description, #display_shopping_cart, #equippable, #equipped, #name, #name_display, #number_of_uses, #takeable, #talkable, #useable, #useable_battle, #used, #used_again
Instance Method Summary collapse
- #describe_detailed ⇒ Object
-
#initialize ⇒ Monster
constructor
A new instance of Monster.
Methods inherited from Creature
Methods inherited from Entity
Constructor Details
#initialize ⇒ Monster
Returns a new instance of Monster.
16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/gemwarrior/entities/monster.rb', line 16 def initialize super self.inventory = Inventory.new self.useable = true self.talkable = true self.is_dead = false 3.times do if [true, false].sample self.inventory.add_item(ITEM_POOL[rand(0..ITEM_POOL.length-1)]) end end end |
Instance Attribute Details
#battlecry ⇒ Object
Returns the value of attribute battlecry.
12 13 14 |
# File 'lib/gemwarrior/entities/monster.rb', line 12 def battlecry @battlecry end |
#is_boss ⇒ Object
Returns the value of attribute is_boss.
12 13 14 |
# File 'lib/gemwarrior/entities/monster.rb', line 12 def is_boss @is_boss end |
#is_dead ⇒ Object
Returns the value of attribute is_dead.
12 13 14 |
# File 'lib/gemwarrior/entities/monster.rb', line 12 def is_dead @is_dead end |
Instance Method Details
#describe_detailed ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/gemwarrior/entities/monster.rb', line 30 def describe_detailed desc_text = "\"#{name_display}\"".colorize(:yellow) desc_text << '(BOSS)'.ljust(13).colorize(:yellow) if is_boss desc_text << "\n" desc_text << "(#{name})\n".colorize(:green) desc_text << "#{description}\n".colorize(:white) desc_text << "FACE : #{face}\n".colorize(:white) desc_text << "HANDS: #{hands}\n".colorize(:white) desc_text << "MOOD : #{mood}\n".colorize(:white) desc_text << "LVL : #{level}\n".colorize(:white) desc_text << "HP : #{hp_cur}/#{hp_max}\n".colorize(:white) desc_text << "ATK : #{atk_lo}-#{atk_hi}\n".colorize(:white) desc_text << "DEF : #{defense}\n".colorize(:white) desc_text << "DEX : #{dexterity}\n".colorize(:white) desc_text << "ROX : #{rox}\n".colorize(:white) desc_text << "XP : #{xp}\n".colorize(:white) desc_text << "INV : #{inventory.contents}\n".colorize(:white) desc_text << "DEAD? #{is_dead}\n".colorize(:white) desc_text << "TALK? #{talkable}\n".colorize(:white) desc_text << "USE? #{useable}\n".colorize(:white) desc_text end |