Class: Gemwarrior::Creature
- Defined in:
- lib/gemwarrior/entities/creature.rb
Instance Attribute Summary collapse
-
#atk_hi ⇒ Object
Returns the value of attribute atk_hi.
-
#atk_lo ⇒ Object
Returns the value of attribute atk_lo.
-
#defense ⇒ Object
Returns the value of attribute defense.
-
#dexterity ⇒ Object
Returns the value of attribute dexterity.
-
#face ⇒ Object
Returns the value of attribute face.
-
#hands ⇒ Object
Returns the value of attribute hands.
-
#hp_cur ⇒ Object
Returns the value of attribute hp_cur.
-
#hp_max ⇒ Object
Returns the value of attribute hp_max.
-
#inventory ⇒ Object
Returns the value of attribute inventory.
-
#level ⇒ Object
Returns the value of attribute level.
-
#mood ⇒ Object
Returns the value of attribute mood.
-
#rox ⇒ Object
Returns the value of attribute rox.
-
#speak(s, no_end_quote = false, no_line_feed = false) ⇒ Object
readonly
Returns the value of attribute speak.
-
#use(world) ⇒ Object
readonly
Returns the value of attribute use.
-
#xp ⇒ Object
Returns the value of attribute xp.
Attributes inherited from Entity
#consumable, #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 ⇒ Object
- #describe_detailed ⇒ Object
-
#initialize ⇒ Creature
constructor
A new instance of Creature.
Methods inherited from Entity
Constructor Details
#initialize ⇒ Creature
Returns a new instance of Creature.
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/gemwarrior/entities/creature.rb', line 25 def initialize super self.name = 'creature' self.name_display = Formatting::upstyle(name) self.description = 'A creature.' self.face = 'face-y' self.hands = 'handsy' self.mood = 'moody' self.level = 1 self.xp = 0 self.hp_cur = 10 self.hp_max = 10 self.atk_lo = 1 self.atk_hi = 1 self.defense = 1 self.dexterity = 1 self.inventory = Inventory.new self.rox = 0 self.talkable = true self.used = false end |
Instance Attribute Details
#atk_hi ⇒ Object
Returns the value of attribute atk_hi.
8 9 10 |
# File 'lib/gemwarrior/entities/creature.rb', line 8 def atk_hi @atk_hi end |
#atk_lo ⇒ Object
Returns the value of attribute atk_lo.
8 9 10 |
# File 'lib/gemwarrior/entities/creature.rb', line 8 def atk_lo @atk_lo end |
#defense ⇒ Object
Returns the value of attribute defense.
8 9 10 |
# File 'lib/gemwarrior/entities/creature.rb', line 8 def defense @defense end |
#dexterity ⇒ Object
Returns the value of attribute dexterity.
8 9 10 |
# File 'lib/gemwarrior/entities/creature.rb', line 8 def dexterity @dexterity end |
#face ⇒ Object
Returns the value of attribute face.
8 9 10 |
# File 'lib/gemwarrior/entities/creature.rb', line 8 def face @face end |
#hands ⇒ Object
Returns the value of attribute hands.
8 9 10 |
# File 'lib/gemwarrior/entities/creature.rb', line 8 def hands @hands end |
#hp_cur ⇒ Object
Returns the value of attribute hp_cur.
8 9 10 |
# File 'lib/gemwarrior/entities/creature.rb', line 8 def hp_cur @hp_cur end |
#hp_max ⇒ Object
Returns the value of attribute hp_max.
8 9 10 |
# File 'lib/gemwarrior/entities/creature.rb', line 8 def hp_max @hp_max end |
#inventory ⇒ Object
Returns the value of attribute inventory.
8 9 10 |
# File 'lib/gemwarrior/entities/creature.rb', line 8 def inventory @inventory end |
#level ⇒ Object
Returns the value of attribute level.
8 9 10 |
# File 'lib/gemwarrior/entities/creature.rb', line 8 def level @level end |
#mood ⇒ Object
Returns the value of attribute mood.
8 9 10 |
# File 'lib/gemwarrior/entities/creature.rb', line 8 def mood @mood end |
#rox ⇒ Object
Returns the value of attribute rox.
8 9 10 |
# File 'lib/gemwarrior/entities/creature.rb', line 8 def rox @rox end |
#speak(s, no_end_quote = false, no_line_feed = false) ⇒ Object (readonly)
Returns the value of attribute speak.
22 23 24 |
# File 'lib/gemwarrior/entities/creature.rb', line 22 def speak @speak end |
#use(world) ⇒ Object (readonly)
Returns the value of attribute use.
22 23 24 |
# File 'lib/gemwarrior/entities/creature.rb', line 22 def use @use end |
#xp ⇒ Object
Returns the value of attribute xp.
8 9 10 |
# File 'lib/gemwarrior/entities/creature.rb', line 8 def xp @xp end |
Instance Method Details
#describe ⇒ Object
52 53 54 55 56 57 |
# File 'lib/gemwarrior/entities/creature.rb', line 52 def describe desc_text = "#{description}".colorize(:white) desc_text << "\n" desc_text << "The creature has several distinguishing features, as well: face is #{face.colorize(:yellow)}, hands are #{hands.colorize(:yellow)}, and mood is, generally, #{mood.colorize(:yellow)}." desc_text end |
#describe_detailed ⇒ Object
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/gemwarrior/entities/creature.rb', line 59 def describe_detailed desc_text = "\"#{name_display}\"\n".colorize(:yellow) 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 << "LEVEL : #{level}\n".colorize(:white) desc_text << "XP : #{xp}\n".colorize(:white) desc_text << "HP : #{hp_cur}/#{hp_max}\n".colorize(:white) desc_text << "ATK_RANGE : #{atk_lo}-#{atk_hi}\n".colorize(:white) desc_text << "DEFENSE : #{defense}\n".colorize(:white) desc_text << "DEXTERITY : #{dexterity}\n".colorize(:white) desc_text << "ROX : #{rox}\n".colorize(:white) desc_text << "INVENTORY : #{inventory.contents}\n".colorize(:white) desc_text end |