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.”

/^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!”

/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 .*

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

Pattern for smite held in corporeal plane

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

Pattern for smite removed

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

Class Method Summary collapse

Class Method Details

.parse(line) ⇒ Object

Parse UCS-related events from a line Returns: { type: :position|:tierup|:smite_on|:smite_off, target_id: id, value: … }



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'documented/gemstone/combat/defs/ucs.rb', line 34

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