module Core::Game

Characters use this class to manage spells and casting

TODO move to root?

FIXME policy = :recalc doesnt work

TODO move goal logic to mapobject

Constants

ASLEEP
DEAD
NORMAL

Character states

UNCONSCIOUS
WOUND_LOCATIONS

Public Class Methods

characters() click to toggle source
# File lib/game/character.rb, line 10
def self.characters
  return @characters
end
characters=(ary) click to toggle source
# File lib/game/character.rb, line 13
def self.characters=(ary)
  @characters = ary
end
enemies() click to toggle source
# File lib/game/combat/battle.rb, line 4
def self.enemies
  return @enemies
end
enemies=(ary) click to toggle source
# File lib/game/combat/battle.rb, line 8
def self.enemies=(ary)
  @enemies = ary
end
find_enemy(name) click to toggle source
# File lib/game/combat/battle.rb, line 12
def self.find_enemy(name)
  @enemies.each { |enemy|
    if enemy.name == name
      return enemy
    end
  }
  return nil
end
find_item(name) click to toggle source
# File lib/game/item.rb, line 17
def self.find_item(name)
  @items.each { |item|
    if item.name == name
      return item
    end
  }
end
find_skill(name) click to toggle source
# File lib/game/skills.rb, line 13
def self.find_skill(name)
  @skills.each { |skill|
    if skill.name == name
      return skill
    end
  }
end
find_spell(name) click to toggle source
# File lib/game/spell.rb, line 14
def self.find_spell(name)
  @spells.each { |spell|
    if spell.name == name
      return spell
    end
  }
  return nil
end
find_weapon(name) click to toggle source
# File lib/game/combat/battle.rb, line 29
def self.find_weapon(name)
  @weapons.each { |w|
    if w.name == name
      return w
    end
  }
end
items() click to toggle source
# File lib/game/item.rb, line 9
def self.items
  return @items
end
items=(ary) click to toggle source
# File lib/game/item.rb, line 13
def self.items=(ary)
  @items = ary
end
itemtype_to_locations(type, equip) click to toggle source
# File lib/game/item.rb, line 25
def self.itemtype_to_locations(type, equip)
  ary = []
  case type
  when :armor
    ary = [:torso]
  when :cloth
    ary = [:torso]
  when :melee
    ary = []
    if equip.at(:rarm) != nil and equip.at(:rarm).type != :ranged
      ary = [:larm, :rarm]
    elsif equip.at(:rarm) == nil
      ary = [:larm, :rarm]
    end
  when :pants
    ary = [:legs]
  when :boots
    ary = [:feet]
  when :ranged
    ary = [:back]
    if equip.at(:larm) == nil
      ary.push(:rarm)
    end
  when :ammo
    ary = [:back]
  end
  return ary
end
skills() click to toggle source
# File lib/game/skills.rb, line 5
def self.skills
  return @skills
end
skills=(ary) click to toggle source
# File lib/game/skills.rb, line 9
def self.skills=(ary)
  @skills = ary
end
spells() click to toggle source
# File lib/game/spell.rb, line 6
def self.spells
  return @spells
end
spells=(ary) click to toggle source
# File lib/game/spell.rb, line 10
def self.spells=(ary)
  @spells = ary
end
weapons() click to toggle source
# File lib/game/combat/battle.rb, line 21
def self.weapons
  return @weapons
end
weapons=(hash) click to toggle source
# File lib/game/combat/battle.rb, line 25
def self.weapons=(hash)
  @weapons = hash
end