Module: FFXI::ElementFactory

Defined in:
lib/Vana/element.rb

Defined Under Namespace

Classes: Element

Constant Summary collapse

ELEMENTS =
["Fire", "Ice", "Wind", "Earth", "Thunder", "Water"]
ELEMENT_COLORS =
["red", "aqua", "green", "yellow", "purple", "blue"]
ELEMENT_ENFEEBLE =
["Burn", "Frost", "Choke", "Rasp", "Shock", "Drown"]
ELEMENT_ATTRIBUTE =
["STR", "INT", "AGI", "VIT", "DEX", "MND"]
ELEMENT_NINJUTSU =
["Katon", "Hyoton", "Huton", "Doton", "Raiton", "Suiton"]
ELEMENT_AVATAR =
["Ifrit", "Shiva", "Garuda", "Titan", "Ramuh", "Leviathan"]
ELEMENT_DIRECTION =
["North-West", "East", "South-East", "South",
"South-West", "West"]
SPECIAL_ELEMENTS =
["Light", "Darkness"]
SPECIAL_ELEMENT_COLORS =
["gray", "black"]
SPECIAL_ELEMENT_ENFEEBLE =
["Dia", "Bio"]
SPECIAL_ELEMENT_ATTRIBUTE =
["CHR", nil]
SPECIAL_ELEMENT_AVATAR =
["Carbuncle", ["Fenrir", "Diabolos"]]
SPECIAL_ELEMENT_DIRECTION =
["North-East", "North"]

Class Method Summary collapse

Class Method Details

.method_missing(name, *args) ⇒ Object



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/Vana/element.rb', line 22

def self.method_missing(name, *args)
 element = name.to_s.capitalize

 if SPECIAL_ELEMENTS.include? element
  index = SPECIAL_ELEMENTS.index element
  direction = SPECIAL_ELEMENT_DIRECTION[index]
  opposed = SPECIAL_ELEMENTS[(index - 1) % 2]
  color = SPECIAL_ELEMENT_COLORS[index]
  enfeeble = SPECIAL_ELEMENT_ENFEEBLE[index]
  attribute = SPECIAL_ELEMENT_ATTRIBUTE[index]
  avatar = SPECIAL_ELEMENT_AVATAR[index]

  Element.new(element, direction, opposed, opposed, color, enfeeble,
   attribute, nil, avatar)
 elsif ELEMENTS.include? element
  index = ELEMENTS.index element
  direction = ELEMENT_DIRECTION[index]
  weakness = ELEMENTS[(index - 1) % 6]
  strength = ELEMENTS[(index + 1) % 6]
  color = ELEMENT_COLORS[index]
  enfeeble = ELEMENT_ENFEEBLE[index]
  attribute = ELEMENT_ATTRIBUTE[index]
  ninjutsu = ELEMENT_NINJUTSU[index]
  avatar = ELEMENT_AVATAR[index]

  Element.new(element, direction, strength, weakness, color, enfeeble,
   attribute, ninjutsu, avatar)
 else
  raise "Unknown element"
 end
end