Module: Lich::Gemstone::Spells
- Defined in:
- documented/attributes/spells.rb
Overview
Provides methods to handle spells in the Gemstone game
This module includes methods for retrieving spell circles, active spells, and known spells.
Constant Summary collapse
- @@spell_lists =
List of spell types for the Gemstone game
This constant holds the symbols representing different spell lists.
%i(major_elemental major_spiritual minor_elemental minor_mental minor_spiritual bard cleric empath paladin ranger sorcerer wizard)
Class Method Summary collapse
-
.active ⇒ Array<Spell>
Retrieves the currently active spells.
-
.get_circle_name(num) ⇒ String
Retrieves the name of the spell circle based on the given number.
-
.known ⇒ Array<Spell>
Retrieves a list of known spells.
-
.require_cooldown(spell) ⇒ Symbol
Checks if a cooldown is required for the given spell.
-
.serialize ⇒ Array<Integer>
Serializes the spell lists into an array.
Class Method Details
.active ⇒ Array<Spell>
Retrieves the currently active spells
55 56 57 |
# File 'documented/attributes/spells.rb', line 55 def self.active Spell.active end |
.get_circle_name(num) ⇒ String
Circle numbers are predefined and should be within the valid range.
Retrieves the name of the spell circle based on the given number
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 |
# File 'documented/attributes/spells.rb', line 23 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 |
.known ⇒ Array<Spell>
Retrieves a list of known spells
63 64 65 66 67 |
# File 'documented/attributes/spells.rb', line 63 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
This method assumes specific spell number ranges for cooldown logic.
Checks if a cooldown is required for the given spell
75 76 77 78 79 80 81 82 83 84 |
# File 'documented/attributes/spells.rb', line 75 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 |
.serialize ⇒ Array<Integer>
Serializes the spell lists into an array
90 91 92 |
# File 'documented/attributes/spells.rb', line 90 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., self.minormental] end |