Module: Lich::Gemstone::Armaments
- Defined in:
- documented/gemstone/armaments.rb,
documented/gemstone/armaments/armor_stats.rb,
documented/gemstone/armaments/shield_stats.rb,
documented/gemstone/armaments/weapon_stats.rb,
documented/gemstone/armaments/weapon_stats_blunt.rb,
documented/gemstone/armaments/weapon_stats_edged.rb,
documented/gemstone/armaments/weapon_stats_hybrid.rb,
documented/gemstone/armaments/weapon_stats_ranged.rb,
documented/gemstone/armaments/weapon_stats_thrown.rb,
documented/gemstone/armaments/weapon_stats_natural.rb,
documented/gemstone/armaments/weapon_stats_polearm.rb,
documented/gemstone/armaments/weapon_stats_unarmed.rb,
documented/gemstone/armaments/weapon_stats_brawling.rb,
documented/gemstone/armaments/weapon_stats_runestave.rb,
documented/gemstone/armaments/weapon_stats_two_handed.rb
Overview
Contains constants and methods related to armaments in the game.
Defined Under Namespace
Modules: ArmorStats, ShieldStats, WeaponStats
Constant Summary collapse
- AG_INDEX_TO_NAME =
{ 1 => "Cloth", 2 => "Soft Leather", 3 => "Rigid Leather", 4 => "Chain", 5 => "Plate" }.freeze
- ASG_INDEX_TO_NAME =
{ 1 => "Robes", 2 => "Light Leather", 3 => "Full Leather", 4 => "Double Leather", 5 => "Leather Breastplate", 6 => "Cuirbouilli", 7 => "Studded Leather", 8 => "Reinforced Leather", 9 => "Hardened Leather", 10 => "Brigandine", 11 => "Chain Mail", 12 => "Double Chain", 13 => "Augmented Chain", 14 => "Chain Hauberk", 15 => "Metal Breastplate", 16 => "Augmented Breastplate", 17 => "Half Plate", 18 => "Full Plate", 19 => "Field Plate", 20 => "Augmented Plate" }.freeze
- SPELL_CIRCLE_INDEX_TO_NAME =
{ 0 => { name: "Action", abbr: "Act" }, 1 => { name: "Minor Spiritual", abbr: "MinSp" }, 2 => { name: "Major Spiritual", abbr: "MajSp" }, 3 => { name: "Cleric", abbr: "Clerc" }, 4 => { name: "Minor Elemental", abbr: "MinEl" }, 5 => { name: "Major Elemental", abbr: "MajEl" }, 6 => { name: "Ranger", abbr: "Rngr" }, 7 => { name: "Sorcerer", abbr: "Sorc" }, 8 => { name: "Old Empath (Deprecated)", abbr: "OldEm" }, 9 => { name: "Wizard", abbr: "Wiz" }, 10 => { name: "Bard", abbr: "Bard" }, 11 => { name: "Empath", abbr: "Emp" }, 12 => { name: "Minor Mental", abbr: "MinMn" }, 13 => { name: "Major Mental", abbr: "MajMn" }, 14 => { name: "Savant", abbr: "Sav" }, 15 => { name: "Unused", abbr: " - " }, 16 => { name: "Paladin", abbr: "Pal" }, 17 => { name: "Arcane Spells", abbr: "Arcne" }, 18 => { name: "Unused", abbr: " - " }, 19 => { name: "Lost Arts", abbr: "Lost" }, }.freeze
Class Method Summary collapse
-
.categories(type = nil) ⇒ Array<String>
Retrieves a list of armament categories, optionally filtered by type.
-
.category_for(name) ⇒ String?
Retrieves the category of an armament based on its name.
-
.find(name) ⇒ Hash?
Finds an armament by its name.
-
.names(type = nil) ⇒ Array<String>
Retrieves a list of armament names, optionally filtered by type.
-
.type_for(name) ⇒ Symbol?
Determines the type of armament based on its name.
-
.valid_name?(name) ⇒ Boolean
Checks if the given name corresponds to a valid armament.
Class Method Details
.categories(type = nil) ⇒ Array<String>
Retrieves a list of armament categories, optionally filtered by type.
140 141 142 143 144 145 146 147 148 |
# File 'documented/gemstone/armaments.rb', line 140 def self.categories(type = nil) case type when :weapon then WeaponStats.categories when :armor then ArmorStats.categories when :shield then ShieldStats.categories else WeaponStats.categories + ArmorStats.categories + ShieldStats.categories end.uniq end |
.category_for(name) ⇒ String?
Retrieves the category of an armament based on its name.
174 175 176 177 178 179 180 181 182 183 184 185 186 187 |
# File 'documented/gemstone/armaments.rb', line 174 def self.category_for(name) name = name.downcase.strip category = WeaponStats.category_for(name) return category unless category.nil? category = ArmorStats.category_for(name) return category unless category.nil? category = ShieldStats.category_for(name) return category unless category.nil? nil end |
.find(name) ⇒ Hash?
Finds an armament by its name.
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
# File 'documented/gemstone/armaments.rb', line 80 def self.find(name) name = name.downcase.strip if (data = WeaponStats.find(name)) return { type: :weapon, data: data } end if (data = ArmorStats.find(name)) return { type: :armor, data: data } end if (data = ShieldStats.find(name)) return { type: :shield, data: data } end nil end |
.names(type = nil) ⇒ Array<String>
Retrieves a list of armament names, optionally filtered by type.
121 122 123 124 125 126 127 128 129 |
# File 'documented/gemstone/armaments.rb', line 121 def self.names(type = nil) case type when :weapon then WeaponStats.names when :armor then ArmorStats.names when :shield then ShieldStats.names else WeaponStats.names + ArmorStats.names + ShieldStats.names end.uniq end |
.type_for(name) ⇒ Symbol?
Determines the type of armament based on its name.
157 158 159 160 161 162 163 164 165 |
# File 'documented/gemstone/armaments.rb', line 157 def self.type_for(name) name = name.downcase.strip return :weapon if WeaponStats.find(name) return :armor if ArmorStats.find(name) return :shield if ShieldStats.find(name) nil end |
.valid_name?(name) ⇒ Boolean
Checks if the given name corresponds to a valid armament.
105 106 107 108 109 110 |
# File 'documented/gemstone/armaments.rb', line 105 def self.valid_name?(name) name = name.downcase.strip return true unless Armaments.find(name).nil? # if we found it, then it's valid return false # if nil, then the name was not found and it's not a valid name end |