Module: Lich::Gemstone::Combat::Definitions::Sequences

Defined in:
documented/gemstone/combat/defs/sequences.rb

Overview

Namespace for sequence pattern definitions and parsing.

Sequences bracket multi-part combat actions: a start line announces it, per-target attack events unfold inside, and an end line closes it. Used to attribute spawned casts (e.g., a Blink flare firing an embedded Nature's Fury produces a full AoE sequence whose per-target events are children of the flare, not independent casts) and to bound multi-target attacks like mstrike and volley.

Defined Under Namespace

Classes: SequenceDef

Constant Summary collapse

SEQUENCE_DEFS =

Array of sequence pattern definitions.

Each SequenceDef contains a sequence name and the regex patterns that mark its start and end lines. Patterns use named captures to extract the target.

Returns:

[
  SequenceDef.new(:earthen_fury, [
    /The ground beneath (?<target>.+?) begins to boil violently!/,
    /The ground beneath (?<target>.+?) suddenly frosts and rumbles violently!/,
    /The ground beneath (?<target>.+?) boils with renewed vigor!/,
    /The ground beneath (?<target>.+?) rumbles with renewed vigor!/
  ].freeze, [/The ground beneath (?<target>.+?) suddenly calms\./].freeze),
  SequenceDef.new(:mstrike, [
    /With great haste, you let loose a volley of shots!/,
    /With instinctive motions, you weave to and fro striking with deliberate and unrelenting fury!/,
    /You explode into a fury of strikes and ripostes, moving with a singular purpose and will!/
  ].freeze, [
    /Your series of strikes and ripostes leaves you winded and out of position./,
    /Your series of strikes and ripostes leaves you off-balance and out of position./,
    /Your series of rapid shots and maneuvers leaves you off-balance and out of position./
  ].freeze),
  SequenceDef.new(:natures_fury, [
    /You close your eyes in a moment of intense concentration, channeling the pure natural power of your surroundings\./
  ].freeze, [/As swiftly as the chaos came to be, it recedes again into the surroundings\./].freeze),
  # Volley: the hail-shadow line opens EVERY round (rounds 2+ have
  # no bow line); per-arrow :volley attack events unfold inside.
  # The 2p bow-raise line is this sequence's PREFIX - not a def.
  SequenceDef.new(:volley, [
    /An ominous shadow falls over your surroundings as a whistling hail of arrows arcs down from above!/
  ].freeze, [/The air clears as the deadly volley of arrows abates\./].freeze)
].freeze
START_LOOKUP =

Lookup table mapping sequence start patterns to sequence names.

Built from SEQUENCE_DEFS for fast O(n) pattern matching of sequence starts.

Returns:

  • (Array<[Regexp, Symbol]>)
SEQUENCE_DEFS.flat_map { |d| d.start_patterns.map { |rx| [rx, d.name] } }.freeze
END_LOOKUP =

Lookup table mapping sequence end patterns to sequence names.

Built from SEQUENCE_DEFS for fast O(n) pattern matching of sequence ends.

Returns:

  • (Array<[Regexp, Symbol]>)
SEQUENCE_DEFS.flat_map { |d| d.end_patterns.map { |rx| [rx, d.name] } }.freeze

Class Method Summary collapse

Class Method Details

.parse_end(line) ⇒ Symbol?

Returns sequence name whose end line this is.

Returns:

  • (Symbol, nil) —

    sequence name whose end line this is



94
95
96
97
98
99
# File 'documented/gemstone/combat/defs/sequences.rb', line 94

def self.parse_end(line)
  return nil unless END_GATE.match?(line) || END_ALWAYS.any? { |rx| rx.match?(line) }

  END_LOOKUP.each { |rx, name| return name if rx.match?(line) }
  nil
end

.parse_start(line) ⇒ Symbol?

Returns sequence name whose start line this is.

Returns:

  • (Symbol, nil) —

    sequence name whose start line this is



86
87
88
89
90
91
# File 'documented/gemstone/combat/defs/sequences.rb', line 86

def self.parse_start(line)
  return nil unless START_GATE.match?(line) || START_ALWAYS.any? { |rx| rx.match?(line) }

  START_LOOKUP.each { |rx, name| return name if rx.match?(line) }
  nil
end