Class: Gemwarrior::Entity

Inherits:
Object
  • Object
show all
Defined in:
lib/gemwarrior/entities/entity.rb

Direct Known Subclasses

Creature, Item, Location

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeEntity

Returns a new instance of Entity.



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

def initialize
  self.name           = 'entity'
  self.name_display   = Formatting::upstyle(name)
  self.description    = 'An entity.'
  self.useable        = true
  self.useable_battle = false
  self.talkable       = false
  self.consumable     = false
  self.takeable       = true
  self.equippable     = false
  self.equipped       = false
  self.used           = false
  self.used_again     = false
  self.number_of_uses = nil
end

Instance Attribute Details

#consumableObject

Returns the value of attribute consumable.



10
11
12
# File 'lib/gemwarrior/entities/entity.rb', line 10

def consumable
  @consumable
end

#describe(world) ⇒ Object (readonly)

Returns the value of attribute describe.



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

def describe
  @describe
end

#describe_detailed(world) ⇒ Object (readonly)

Returns the value of attribute describe_detailed.



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

def describe_detailed
  @describe_detailed
end

#descriptionObject

Returns the value of attribute description.



10
11
12
# File 'lib/gemwarrior/entities/entity.rb', line 10

def description
  @description
end

#display_shopping_cart(cart) ⇒ Object (readonly)

Returns the value of attribute display_shopping_cart.



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

def display_shopping_cart
  @display_shopping_cart
end

#equippableObject

Returns the value of attribute equippable.



10
11
12
# File 'lib/gemwarrior/entities/entity.rb', line 10

def equippable
  @equippable
end

#equippedObject

Returns the value of attribute equipped.



10
11
12
# File 'lib/gemwarrior/entities/entity.rb', line 10

def equipped
  @equipped
end

#nameObject

Returns the value of attribute name.



10
11
12
# File 'lib/gemwarrior/entities/entity.rb', line 10

def name
  @name
end

#name_displayObject

Returns the value of attribute name_display.



10
11
12
# File 'lib/gemwarrior/entities/entity.rb', line 10

def name_display
  @name_display
end

#number_of_usesObject

Returns the value of attribute number_of_uses.



10
11
12
# File 'lib/gemwarrior/entities/entity.rb', line 10

def number_of_uses
  @number_of_uses
end

#takeableObject

Returns the value of attribute takeable.



10
11
12
# File 'lib/gemwarrior/entities/entity.rb', line 10

def takeable
  @takeable
end

#talkableObject

Returns the value of attribute talkable.



10
11
12
# File 'lib/gemwarrior/entities/entity.rb', line 10

def talkable
  @talkable
end

#useableObject

Returns the value of attribute useable.



10
11
12
# File 'lib/gemwarrior/entities/entity.rb', line 10

def useable
  @useable
end

#useable_battleObject

Returns the value of attribute useable_battle.



10
11
12
# File 'lib/gemwarrior/entities/entity.rb', line 10

def useable_battle
  @useable_battle
end

#usedObject

Returns the value of attribute used.



10
11
12
# File 'lib/gemwarrior/entities/entity.rb', line 10

def used
  @used
end

#used_againObject

Returns the value of attribute used_again.



10
11
12
# File 'lib/gemwarrior/entities/entity.rb', line 10

def used_again
  @used_again
end

Instance Method Details

#puts(s = '', width = GameOptions.data['wrap_width']) ⇒ Object



73
74
75
# File 'lib/gemwarrior/entities/entity.rb', line 73

def puts(s = '', width = GameOptions.data['wrap_width'])
  super s.gsub(/(.{1,#{width}})(\s+|\Z)/, "\\1\n") unless s.nil?
end

#use(world) ⇒ Object



44
45
46
# File 'lib/gemwarrior/entities/entity.rb', line 44

def use(world)
  'That does not appear to be useable.'
end