Module: Lich::Gemstone::Spells

Defined in:
lib/attributes/spells.rb

Constant Summary collapse

@@spell_lists =
%i(major_elemental major_spiritual minor_elemental minor_mental minor_spiritual bard cleric empath paladin ranger sorcerer wizard)

Class Method Summary collapse

Class Method Details

.activeArray<Spell>

Retrieves the active spells.

Examples:

Lich::Gemstone::Spells.active # => [<active spells>]

Returns:

  • (Array<Spell>)

    An array of active spells.



45
46
47
# File 'lib/attributes/spells.rb', line 45

def self.active
  Spell.active
end

.get_circle_name(num) ⇒ String

Retrieves the name of the spell circle based on the given number.

Examples:

Lich::Gemstone::Spells.get_circle_name(1) # => 'Minor Spirit'

Parameters:

  • num (Integer, String)

    The number representing the spell circle.

Returns:

  • (String)

    The name of the spell circle.



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/attributes/spells.rb', line 12

def self.get_circle_name(num)
  case num.to_s
  when '1' then 'Minor Spirit'
  when '2' then 'Major Spirit'
  when '3' then 'Cleric'
  when '4' then 'Minor Elemental'
  when '5' then 'Major Elemental'
  when '6' then 'Ranger'
  when '7' then 'Sorcerer'
  when '8' then 'Old Healing List'
  when '9' then 'Wizard'
  when '10' then 'Bard'
  when '11' then 'Empath'
  when '12' then 'Minor Mental'
  when '16' then 'Paladin'
  when '17' then 'Arcane'
  when '65' then 'Imbedded Enchantment'
  when '66' then 'Death'
  when '90' then 'Micellaneous'
  when '95' then 'Armor Specialization'
  when '96' then 'Combat Maneuvers'
  when '97' then 'Guardians of Sunfist'
  when '98' then 'Order of Voln'
  when '99' then 'Council of Light'
  else 'Unknown Circle'
  end
end

.knownArray<Spell>

Retrieves the known spells.

Examples:

Lich::Gemstone::Spells.known # => [<known spells>]

Returns:

  • (Array<Spell>)

    An array of known spells.



54
55
56
57
58
# File 'lib/attributes/spells.rb', line 54

def self.known
  known_spells = Array.new
  Spell.list.each { |spell| known_spells.push(spell) if spell.known? }
  return known_spells
end

.require_cooldown(spell) ⇒ Symbol

Requires cooldown for specific spells based on their number.

Examples:

Lich::Gemstone::Spells.require_cooldown(spell) # => :ok

Parameters:

  • spell (Spell)

    The spell for which to check cooldown.

Returns:

  • (Symbol)

    Returns :ok if no cooldown is required.

Raises:

  • (StandardError)

    If the spell number is invalid or not found.



67
68
69
70
71
72
73
74
75
76
# File 'lib/attributes/spells.rb', line 67

def self.require_cooldown(spell)
  if (spell.num.to_i > 9013) && (spell.num.to_i < 9042) # Assume Aspect: Ranger
    cooldown_spell = Spell[spell.num + 1]
    cooldown_spell.putup
  elsif (spell.num == 515) && (recovery = Spell[599]) # Rapid Fire: Major Elemental
    recovery.putup
  else
    :ok
  end
end

.serializeArray<Integer>

Serializes the spell lists into an array.

Examples:

Lich::Gemstone::Spells.serialize # => [<spell ranks>]

Returns:

  • (Array<Integer>)

    An array of spell ranks.



83
84
85
# File 'lib/attributes/spells.rb', line 83

def self.serialize
  [self.minor_elemental, self.major_elemental, self.minor_spiritual, self.major_spiritual, self.wizard, self.sorcerer, self.ranger, self.paladin, self.empath, self.cleric, self.bard, self.minormental]
end