Module: Lich::Gemstone::Combat::Definitions::UCS

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

Constant Summary collapse

POSITION_PATTERN =

Pattern for position updates - use .+ not .* Example: "You have good positioning against a kobold." Pattern for position updates.

Matches strings indicating the positioning against a target.

Examples:

"You have good positioning against a kobold."

See Also:

/^You have (decent|good|excellent) positioning against.+<a exist="([0-9]+)"/i.freeze
TIERUP_PATTERN =

Pattern for tierup vulnerability Example: "Strike leaves foe vulnerable to a followup jab attack!" Pattern for tierup vulnerability.

Matches strings indicating a foe is vulnerable to a followup attack.

Examples:

"Strike leaves foe vulnerable to a followup jab attack!"
/Strike leaves foe vulnerable to a followup (jab|grapple|punch|kick) attack!/i.freeze
SMITE_APPLIED_PATTERN =

Pattern for smite applied (crimson mist) Use .+ not .* Pattern for smite applied (crimson mist).

Matches strings indicating a target is surrounded by a crimson mist.

Examples:

"A crimson mist suddenly surrounds the target."
/^ *A crimson mist suddenly surrounds .+<a exist="([0-9]+)"/i.freeze
SMITE_HELD_PATTERN =

Pattern for smite held in corporeal plane Pattern for smite held in corporeal plane.

Matches strings indicating a target's crimson mist is held in the corporeal plane.

Examples:

"The crimson mist surrounding the target is held in the corporeal plane."
/The crimson mist surrounding .+<a exist="([0-9]+)".+held in the corporeal plane/i.freeze
SMITE_REMOVED_PATTERN =

Pattern for smite removed Pattern for smite removed.

Matches strings indicating a target's crimson mist returns to an ethereal state.

Examples:

"The crimson mist surrounding the target returns to an ethereal state."
/^ *The crimson mist surrounding .+<a exist="([0-9]+)".+returns to an ethereal state/i.freeze

Class Method Summary collapse

Class Method Details

.parse(line) ⇒ Hash?

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Parses a line of text to extract combat-related information.

Examples:

parse("You have good positioning against a kobold.")
# => { type: :position, target_id: 123, value: "good" }

Parameters:

  • line (String)

    the line of text to parse.

Returns:

  • (Hash, nil)

    a hash containing parsed information or nil if no match is found.



67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
# File 'documented/gemstone/combat/defs/ucs.rb', line 67

def parse(line)
  # Position update
  if (match = POSITION_PATTERN.match(line))
    position = match[1]
    target_id = match[2].to_i
    return {
      type: :position,
      target_id: target_id,
      value: position
    }
  end

  # Tierup vulnerability
  if (match = TIERUP_PATTERN.match(line))
    attack_type = match[1]
    return {
      type: :tierup,
      value: attack_type
      # Note: target_id comes from most recent target in combat context
    }
  end

  # Smite applied or held
  if (match = SMITE_APPLIED_PATTERN.match(line))
    target_id = match[1].to_i
    return {
      type: :smite_on,
      target_id: target_id
    }
  end

  if (match = SMITE_HELD_PATTERN.match(line))
    target_id = match[1].to_i
    return {
      type: :smite_on,
      target_id: target_id
    }
  end

  # Smite removed
  if (match = SMITE_REMOVED_PATTERN.match(line))
    target_id = match[1].to_i
    return {
      type: :smite_off,
      target_id: target_id
    }
  end

  nil
end