Class: Lich::Gemstone::Societies::GuardiansOfSunfist
- Inherits:
-
Lich::Gemstone::Society
- Object
- Lich::Gemstone::Society
- Lich::Gemstone::Societies::GuardiansOfSunfist
- Defined in:
- documented/gemstone/societies/guardians_of_sunfist.rb
Overview
Represents the Guardians of Sunfist society.
Provides access to Guardians of Sunfist sigil data, cost calculation, usability checks, and dynamic method access for individual sigils.
Constant Summary collapse
- @@sunfist_sigils =
Metadata for each Sigil from the Guardians of Sunfist, including rank, costs, duration, etc. Some fields (e.g., ‘:summary`, `:duration`) may be defined as lambdas for dynamic content. These are automatically resolved at access time via `Society.resolve`.
{ "sigil_of_recognition" => { rank: 1, short_name: "recognition", long_name: "Sigil of Recognition", type: :utility, spell_number: 9701, cost: { stamina: 0, mana: 0 }, duration: nil, summary: "Detects members and/or foes of the Guardians of Sunfist in the same room." }, "sigil_of_location" => { rank: 2, short_name: "location", long_name: "Sigil of Location", spell_number: 9702, cost: { stamina: 0, mana: 0 }, duration: nil, summary: "Detects nearby foes and warcamps; reveals paths to them." }, "sigil_of_contact" => { rank: 3, short_name: "contact", long_name: "Sigil of Contact", spell_number: 9703, cost: { stamina: 0, mana: 1 }, duration: 1140, # 19 minutes summary: "Activates the ESP (amunet) network." }, "sigil_of_resolve" => { rank: 4, short_name: "resolve", long_name: "Sigil of Resolve", spell_number: 9704, cost: { stamina: 5, mana: 0 }, duration: 90, summary: -> { "Increases Climbing, Swimming, and Survival skills equal to half current rank (#{(Society.rank / 2).floor}) for 90 seconds." } }, "sigil_of_minor_bane" => { rank: 5, short_name: "minor bane", long_name: "Sigil of Minor Bane", spell_number: 9705, cost: { stamina: 3, mana: 3 }, duration: 60, summary: "Adds +5 AS (for any target) and grants heavy damage weighting (against foes) to melee, ranged and bolt attacks for 60 seconds." }, "sigil_of_bandages" => { rank: 6, short_name: "bandages", long_name: "Sigil of Bandages", spell_number: 9706, cost: { stamina: 10, mana: 0 }, duration: 300, summary: "Allows you to perform actions with bandaged wounds that would normally break them for 5 minutes." }, "sigil_of_defense" => { rank: 7, short_name: "defense", long_name: "Sigil of Defense", spell_number: 9707, cost: { stamina: 5, mana: 5 }, duration: 300, summary: -> { "Increases +1 DS per rank (#{Society.rank}) for 5 minutes." } }, "sigil_of_offense" => { rank: 8, short_name: "offense", long_name: "Sigil of Offense", spell_number: 9708, cost: { stamina: 5, mana: 5 }, duration: 300, summary: -> { "Increases +1 AS per rank (#{Society.rank}) for 5 minutes." } }, "sigil_of_distraction" => { rank: 9, short_name: "distraction", long_name: "Sigil of Distraction", spell_number: 9709, cost: { stamina: 10, mana: 5 }, ## TODO: Figure out how to calc room version cost instead duration: nil, summary: "Decreases enemies' chances to evade, parry, and block." }, "sigil_of_minor_protection" => { rank: 10, short_name: "minor protection", long_name: "Sigil of Minor Protection", spell_number: 9710, cost: { stamina: 10, mana: 5 }, duration: 60, summary: "Adds +5 DS and grants heavy damage padding for 1 minute. Can be stacked up to 3 minutes." }, "sigil_of_focus" => { rank: 11, short_name: "focus", long_name: "Sigil of Focus", spell_number: 9711, cost: { stamina: 5, mana: 5 }, duration: 60, summary: -> { "Increases +1 TD per rank (#{Society.rank}) for 1 minute. Can be stacked up to 3 minutes." } }, "sigil_of_intimidation" => { rank: 12, short_name: "intimidation", long_name: "Sigil of Intimidation", spell_number: 9712, cost: { stamina: 10, mana: 5 }, duration: nil, summary: "Decreases enemies' AS/DS by 20." }, "sigil_of_mending" => { rank: 13, short_name: "mending", long_name: "Sigil of Mending", spell_number: 9713, cost: { stamina: 15, mana: 10 }, duration: 600, summary: "Increases HP recovery by 15 and allows all healing herbs to be eaten in 3 seconds for 10 minutes." }, "sigil_of_concentration" => { rank: 14, short_name: "concentration", long_name: "Sigil of Concentration", spell_number: 9714, cost: { stamina: 30, mana: 0 }, duration: 600, summary: "Increases mana recovery by +5 mana per pulse for 10 minutes." }, "sigil_of_major_bane" => { rank: 15, short_name: "major bane", long_name: "Sigil of Major Bane", spell_number: 9715, cost: { stamina: 10, mana: 10 }, duration: 60, summary: "Adds +10 AS (all attacks) and grants heavy crit weighting to attacks (against foes) for 1 minute." }, "sigil_of_determination" => { rank: 16, short_name: "determination", long_name: "Sigil of Determination", spell_number: 9716, cost: { stamina: 30, mana: 0 }, duration: 300, summary: "Ignores penalties while performing tasks when a character has injuries for 5 minutes." }, "sigil_of_health" => { rank: 17, short_name: "health", long_name: "Sigil of Health", spell_number: 9717, cost: { stamina: 20, mana: 10 }, duration: nil, summary: -> { "Instantly recover 15 HP or half of your lost HP, whichever is greater (right now: #{[((Char.max_health - Char.health) / 2), 15].max})." } }, "sigil_of_power" => { rank: 18, short_name: "power", long_name: "Sigil of Power", spell_number: 9718, cost: { stamina: 50, mana: 0 }, duration: nil, summary: "Convert 50 stamina to 25 mana." }, "sigil_of_major_protection" => { rank: 19, short_name: "major protection", long_name: "Sigil of Major Protection", spell_number: 9719, cost: { stamina: 15, mana: 10 }, duration: 60, summary: "Adds +10 DS and grants heavy crit padding for 1 minute. Can be stacked up to 3 minutes." }, "sigil_of_escape" => { rank: 20, short_name: "escape", long_name: "Sigil of Escape", spell_number: 9720, cost: { stamina: 75, mana: 15 }, ## TODO: figure out higher cost? duration: nil, summary: "Teleports you to a safe location. The emergency version can be used while stunned, bound, in RT, etc., at higher cost." } }.freeze
Class Method Summary collapse
-
.[](name) ⇒ Hash?
Retrieves a sigil definition by short or long name.
-
.affordable?(sigil_name) ⇒ Boolean
Checks if the character can currently afford to use a given Guardians of Sunfist sigil, based on available stamina and mana.
-
.all ⇒ Array<Hash>
Returns all Guardians of Sunfist sigil metadata entries with evaluated fields.
-
.available?(sigil_name) ⇒ Boolean
Determines whether the specified Guardians of Sunfist sigil is currently available for use.
-
.known?(sigil_name) ⇒ Boolean
Determines if the character knows a given Sunfist sigil, based on society rank.
-
.master? ⇒ Boolean
Checks if the character is a Sunfist master (rank 20).
-
.member?(rank = nil) ⇒ Boolean
Checks if the character is a member of the Guardians of Sunfist, and optionally at a specific rank.
-
.rank ⇒ Integer
Provides the current rank of the character within the Guardians of Sunfist.
-
.sigil_lookups ⇒ Array<Hash>
Returns a simplified list of all sigils with key attributes used for lookup and UI.
-
.use(sigil_name, target = nil) ⇒ void
Attempts to use a Guardians of Sunfist sigil by issuing the appropriate command.
Methods inherited from Lich::Gemstone::Society
define_name_methods, favor, lookup, member, membership, resolve, serialize, status, step, task
Class Method Details
.[](name) ⇒ Hash?
Retrieves a sigil definition by short or long name.
Normalizes the provided name and attempts to match against both short and long names of all Guardians of Sunfist sigils. Returns the corresponding sigil metadata if found.
207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 |
# File 'documented/gemstone/societies/guardians_of_sunfist.rb', line 207 def self.[](name) lookup = Society.lookup(name, sigil_lookups) return nil unless lookup key = lookup[:short_name] sigil = @@sunfist_sigils.values.find { |entry| entry[:short_name] == key } return nil unless sigil sigil.transform_values do |v| if v.respond_to?(:call) v.arity == 1 ? v.call(sigil) : v.call else v end end end |
.affordable?(sigil_name) ⇒ Boolean
Checks if the character can currently afford to use a given Guardians of Sunfist sigil, based on available stamina and mana.
298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 |
# File 'documented/gemstone/societies/guardians_of_sunfist.rb', line 298 def self.affordable?(sigil_name) return false unless member? sigil = self[sigil_name] return false unless sigil cost = sigil[:cost] || {} stamina_cost = cost[:stamina].to_i mana_cost = cost[:mana].to_i unless stamina_cost.zero? return false unless Char.stamina >= stamina_cost end unless mana_cost.zero? return false unless Char.mana >= mana_cost end return true end |
.all ⇒ Array<Hash>
Returns all Guardians of Sunfist sigil metadata entries with evaluated fields.
337 338 339 |
# File 'documented/gemstone/societies/guardians_of_sunfist.rb', line 337 def self.all @@sunfist_sigils.values.map { |entry| entry.transform_values { |v| Society.resolve(v, entry) } } end |
.available?(sigil_name) ⇒ Boolean
Determines whether the specified Guardians of Sunfist sigil is currently available for use.
A sigil is considered available if:
-
The character knows the sigil (based on rank)
-
The character can afford the sigil (based on stamina and mana)
327 328 329 330 |
# File 'documented/gemstone/societies/guardians_of_sunfist.rb', line 327 def self.available?(sigil_name) return false unless member? known?(sigil_name) && affordable?(sigil_name) end |
.known?(sigil_name) ⇒ Boolean
Determines if the character knows a given Sunfist sigil, based on society rank.
Uses the unified ‘[]` method for normalized lookup by short or long name.
252 253 254 255 256 257 258 |
# File 'documented/gemstone/societies/guardians_of_sunfist.rb', line 252 def self.known?(sigil_name) return false unless member? sigil = self[sigil_name] return false unless sigil sigil[:rank] <= self.rank end |
.master? ⇒ Boolean
Checks if the character is a Sunfist master (rank 20).
358 359 360 361 |
# File 'documented/gemstone/societies/guardians_of_sunfist.rb', line 358 def self.master? return false unless member? Society.rank == 20 end |
.member?(rank = nil) ⇒ Boolean
Checks if the character is a member of the Guardians of Sunfist, and optionally at a specific rank.
348 349 350 351 |
# File 'documented/gemstone/societies/guardians_of_sunfist.rb', line 348 def self.member?(rank = nil) return false unless Society.membership == "Guardians of Sunfist" rank.nil? || Society.rank == rank end |
.rank ⇒ Integer
Provides the current rank of the character within the Guardians of Sunfist.
368 369 370 371 |
# File 'documented/gemstone/societies/guardians_of_sunfist.rb', line 368 def self.rank return 0 unless member? Society.rank end |
.sigil_lookups ⇒ Array<Hash>
Returns a simplified list of all sigils with key attributes used for lookup and UI.
Used internally to normalize and match against sigil names.
234 235 236 237 238 239 240 241 242 243 |
# File 'documented/gemstone/societies/guardians_of_sunfist.rb', line 234 def self.sigil_lookups @@sunfist_sigils.map do |_, sigil| { long_name: sigil[:long_name], short_name: sigil[:short_name], rank: sigil[:rank], cost: sigil[:cost], } end end |
.use(sigil_name, target = nil) ⇒ void
This method returns an undefined value.
Attempts to use a Guardians of Sunfist sigil by issuing the appropriate command.
If the sigil has a defined ‘:usage` string, it is used directly. Otherwise, defaults to `sigil of <short_name>`.
269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 |
# File 'documented/gemstone/societies/guardians_of_sunfist.rb', line 269 def self.use(sigil_name, target = nil) unless member? Lich::Messaging.msg("error", "Not a member of Guardians of Sunfist, can't use: #{sigil_name}") return end sigil = self[sigil_name] unless sigil Lich::Messaging.msg("error", "Unknown sigil: #{sigil_name}") return end if available?(sigil_name) command = sigil[:usage] || "sigil of #{sigil[:short_name]}" waitrt? waitcastrt? fput "#{command} #{target}".strip else Lich::Messaging.msg("warn", "You cannot use the #{sigil_name} sigil right now.") end end |