Class: Gemwarrior::Weapon

Inherits:
Item show all
Defined in:
lib/gemwarrior/entities/weapon.rb

Direct Known Subclasses

Dagger, Gun, Mace, Opalaser, Spear, Stalactite, Stone

Instance Attribute Summary collapse

Attributes inherited from Item

#is_armor

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

Methods inherited from Entity

#puts

Constructor Details

#initializeWeapon

Returns a new instance of Weapon.



13
14
15
16
17
18
19
20
21
22
# File 'lib/gemwarrior/entities/weapon.rb', line 13

def initialize
  super

  self.atk_lo       = 0
  self.atk_hi       = 0
  self.dex_mod      = 0
  self.takeable     = true
  self.equippable   = true
  self.is_weapon    = true
end

Instance Attribute Details

#atk_hiObject

Returns the value of attribute atk_hi.



8
9
10
# File 'lib/gemwarrior/entities/weapon.rb', line 8

def atk_hi
  @atk_hi
end

#atk_loObject

Returns the value of attribute atk_lo.



8
9
10
# File 'lib/gemwarrior/entities/weapon.rb', line 8

def atk_lo
  @atk_lo
end

#dex_modObject

Returns the value of attribute dex_mod.



8
9
10
# File 'lib/gemwarrior/entities/weapon.rb', line 8

def dex_mod
  @dex_mod
end

#is_weaponObject

Returns the value of attribute is_weapon.



8
9
10
# File 'lib/gemwarrior/entities/weapon.rb', line 8

def is_weapon
  @is_weapon
end

Instance Method Details

#describe_detailedObject



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/gemwarrior/entities/weapon.rb', line 28

def describe_detailed
  desc_text =  "\"#{name_display}\"\n".colorize(:yellow)
  desc_text << "(#{name})\n".colorize(:green)
  desc_text << "#{description}\n".colorize(:white)
  desc_text << "WEAPON?         #{is_weapon}\n".colorize(:white)
  desc_text << "ATTACK_RANGE  : #{atk_lo}-#{atk_hi}\n".colorize(:white)
  desc_text << "TAKEABLE?   #{takeable}\n".colorize(:white)
  desc_text << "USEABLE?    #{useable}\n".colorize(:white)
  desc_text << "TALKABLE?   #{talkable}\n".colorize(:white)
  desc_text << "CONSUMABLE? #{consumable}\n".colorize(:white)
  desc_text << "EQUIPPABLE? #{equippable}\n".colorize(:white)
  desc_text << "EQUIPPED?   #{equipped}\n".colorize(:white)
  desc_text << "USED?       #{used}\n".colorize(:white)
  desc_text << "USED AGAIN? #{used_again}\n".colorize(:white)
  desc_text << "USES LEFT?  #{number_of_uses}\n".colorize(:white) unless number_of_uses.nil?
  desc_text
end

#use(world) ⇒ Object



24
25
26
# File 'lib/gemwarrior/entities/weapon.rb', line 24

def use(world)
  'Save the brandishing of your weapon for battle.'
end