diff --git a/scripts/briefcombat.lic b/scripts/briefcombat.lic
index 3d6cbc2d9..e321b1dc8 100644
--- a/scripts/briefcombat.lic
+++ b/scripts/briefcombat.lic
@@ -16,9 +16,11 @@
contributors: Tysong, Ragz, Gemini AI
name: briefcombat
tags: brief, briefcombat, condensing, condense, combat, squelch
- version: 1.0.0
+ version: 1.0.1
changelog:
+ 1.0.1 (2026-01-29)
+ - Bugfix in @instance variable location
1.0.0 (2026-01-25)
- Refactor into a module instead of using global variables
- Refactor most regex patterns to the top of the file
@@ -67,174 +69,162 @@ module BriefCombat
class Engine
attr_accessor :extreme_mode, :excluded_players
- # --- Status Effects ---
- # If these strings match, the current target will be considered afflicted with a certain status
- @status_effects = {
- "stunned" => /stunned|strength of holy incantation/,
- "frozen" => /freezes|encased in a thick block of ice|stops all movement/,
- "knockdown" => /falls over|(?:dragged|knocked|down|flattening itself) to the (?:\w+)|collapses on/,
- "sympathized" => /eyes begin to glow (?:purple|dark)/,
- "pinned" => /pins? (?:.*) to the/,
- "webbed" => /ensnared in thick strands of webbing/,
- "buffeted" => /buffeted by/,
- "dead" => /tries to crawl away on the (?:ground|floor) but|
- rolls over on the (?:ground|floor) and goes still|
- body falls to the (?:ground|floor) as it is consumed by ethereal flame|
- (?:collapses|crashes) to the (?:ground|floor)|
- grows dim as s?he falls to the (?:ground|floor)|
- falls to the (ground|floor) motionless/x
- }.freeze
-
- @his_or_her = '(?:]+>)?(?:his|her)(?:<\/a>)?'
- @himself_or_herself = '(?:]+>)?(?:himself|herself)(?:<\/a>)?'
-
- # --- Verb Lists ---
- # these verbs match in standard order: "[Player] [verb] [target]" - where target is optional
- # when a line matches, it will begin a new "combat block", which we will try to shorten
- # this line will be the first line in the new shortened block, unless overridden by a "spell guess"
- @verbs_standard = [
- 'gestures? at', # generic spell casting
- 'gestures?\.', # generic spell casting without target
- 'channels? at',
- 'waves? (?:your|an?) .+? at', # wand casting (self: "wave your wand", others: "waves a wand")
- '(?:hurl|fire|swing|thrust)s? an? [\w \-\']+ at',
- 'swings? an? [\w \-\']+ at',
- 'slashes with an? [\w \-\']+ at', # Tenchin slashes with a rolaren-edged veil iron troll-claw at a deathsworn fanatic!
- 'thrusts?(?: with)? a [\w \-\']+ at',
- 'continues to sing a disruptive song',
- 'draws an intricately glowing pattern in the air before',
- 'chants a reverent litany',
- 'skillfully begins to weave another verse into (?:.*) harmony',
- 'voice carries the power of thunder as (?:.*) calls out an angry incantation in an unknown language',
- '(?:.*) directing the sound of (?:.*) voice at', # bardsong
- 'punches?(?: with)? an? [\w \-\']+ at', # brawling punch
- '(?:make a precise )?attempts? to (?:punch|jab|grapple|kick)', # uac verbs
- 'An obscuring brume descends', # i don't remember
- 'take aim and fire an? [\w \-\']+', # aimed ranged attack
- 'turns and sweeps', # executioner's stance follow up
- 'lashes out again and again with the force of a reaping whirlwind', # weapon whirlwind
- 'charges forward at', # shield charge
- 'lunges forward at', # shield bash
- 'takes a menacing step toward', # weapon pummel
- "brings #{@his_or_her} .+? around in a tight arc to batter", # weapon thrash cycle
- 'takes quick assessment and raises', # weapon pindown
- 'exhales a virulent green mist toward', # pestilence
- 'snap your arm forward', # shield throw
- "snaps #{@his_or_her} arm forward, (?:throwing|hurling) #{@his_or_her} .+? at", # shield throw
- 'looses arrow after arrow', # weapon volley
- "hurls #{@himself_or_herself} at", # cman tackle
- "slowly moves #{@his_or_her} hand in a (?:waving|pushing|throwing|slapping|clenching|pounding) motion" # 514
- ].freeze
-
- # Verbs that match in a reverse order: "[Player] ... [target] ... [verb]"
- # where the target is before the verb in the sentence
- @verbs_target_first = [
- 'calls? down(?: the)? excoriating power', # paladin feat excoriate
- 'deliver a sound thrashing', # weapon thrash
- ].freeze
-
- # Ambient damage messaging, verb first and then target, no player noun
- @verbs_ambient = [
- 'Fiery debris explodes from the ground', # earthen fury damage cycle
- 'Craggy debris explodes from the ground',
- 'The earth cracks beneath',
- 'Icy stalagmites burst from the ground',
- 'flies out of the shadows toward', # sniper attack
- 'Light and dark pockmarks appear', # pestilence
- 'sickly green miasma around',
- 'waves billow outward from', # Hallowed Reprisal
- 'long thorny vine lashes out', # vine
- 'charges forward and bites', # porcupine animal companion attack
- 'raging sandstorm swirls around', # 914
- 'burst of flame leaps from', # 915 fire
- 'devastating inferno of flaming rocks ignites the entire sky', # 525 meteor swarm cycle
- 'flaming rocks burst from the sky and smite the area', # 525
- 'Ripples of cold white flame flare up around', # cleric cycle
- 'several faintly glowing snowflakes settle upon', # 335 cycle
- ].freeze
-
- # Ambient damage messaging, target first and then verb, no player noun
- @verbs_ambient_2 = [
- 'convulses with a crippling affliction', # pestilence damage cycle
- 'as virulent green mist passes through',
- 'Large hailstones pound relentlessly',
- 'spiritual malady wracks',
- ].freeze
-
- # --- Spell Guessing Data Structure ---
- # Format: [Regex, Spell ID, Include Line?]
- # - Include Line? (boolean): this will save the matching line and include it in the compressed block
- # except on "extreme" mode
- #
- @spell_guess_patterns = [
- [/radiant burst of light/, '135', true],
- [/shoot strands of webbing/, 'ball', false], # treat 118 evoke as a ball spell- will use this sentence as the first message, replace generic "gesture"
- [/hazy film/, '119', false],
- [/appears more confident/, '211', false],
- [/scintillating, blue-white aura encompasses/, '302', false],
- [/ambient temperature abruptly plummets/, '309', false],
- [/manifests as an ethereal, pure golden censer/, '320', false],
- [/several faintly glowing snowflakes settle/, '335', false],
- [/hand before it takes the shape of an ethereal chain of keys|A cold mist drifts in, blanketing the area|thunderous din echoes all around as the very earth shudders beneath/, '335', true],
- [/dark ethereal (waves|sphere)/, '410', true],
- [/(?:waves?|sphere) of .* (?:expands|moves)/, '435', true],
- [/surrounded by a circle of flickering flame/, '502', false], # 502 fire
- [/a bolt of churning air/, 'ball', false],
- [/An airy mist rolls into the (?:area|room)/, '512', true],
- [/unleashes a compact swirling vortex/, '518', true],
- [/Wisps of black smoke swirl around/, '519', true],
- [/multitude of sharp pieces of debris splinter off from underfoot|The surroundings advance upon/, '635', true],
- [/arms snatch viciously|grotesque limbs/, '709', true],
- [/leaving behind a sucking void/, '720', false],
- [/gust of wind tugs at your sleeves/, '912', false],
- [/debris explodes from the ground beneath/, '917', true],
- [/force of the sonic vibrations/, '1030', false],
- [/reels under the force of the sonic vibrations/, '1030', false],
- [/pulse of pearlescent energy ripples/, '1106', false],
- [/A nebulous haze shimmers into view around/, '1115', true],
- [/eyes begin to glow (?:purple|dark)/, '1120', false],
- [/utters a pious chant (.*) Suddenly a divine force radiates out from/, '1618', true],
- [/(?:hurl|fire|hurtles forth)s? an? [\w \-\']+ at/, 'ball', false], # special case for "ball" spells, replace "gesture" line with this line
- [/an invisible force guides|considerably more powerful|feel the magic surge through you/, nil, false],
-
- ].freeze
-
- # --- Regex Components ---
- @pc_or_you_pattern = '[^<]+<\/a>|You'
- @target_pattern = '(.*?)'
-
- # --- Compiled Combat Regexes ---
- @combat_regex = /(#{@pc_or_you_pattern}) (#{@verbs_standard.join('|')})(?: (?:an? |the |some )?(#{@target_pattern}))?/
-
- # Alternative regex for sentences that show the target before the matching verbs
- @combat_target_first_regex = /(#{@pc_or_you_pattern}).*(#{@target_pattern}).*(#{@verbs_target_first.join('|')})/
-
- # Ambient damage or follow up attacks, tend to have no source
- @combat_ambient_regex = /^.*?(?:#{@verbs_ambient.join('|')}).*?(#{@target_pattern})/
-
- @combat_ambient_2_regex = /^.*?(#{@target_pattern}).*?(?:#{@verbs_ambient_2.join('|')})/
-
- # --- Filter Regexes ---
- @filter_self_spells_casttime = /()/
- @filter_self_spells_exist = /([\w ']+)<\/spell>/
- @filter_self_spells_msg = /Your spell(song)? is ready\.|You gesture\.|Cast Roundtime \d Seconds.?/
- @filter_self_search = /You search the |.* (had nothing of interest|didn't carry any silver|had nothing else of value)/
- @filter_other_search = /(\w+<\/a>) searches (.*)/
- @filter_other_spell_prep = /appears to be focusing (?:his|her) thoughts while chanting|traces a simple symbol as (?:he|she) reverently calls/
- @filter_sigils = /faint blue glow (?:fades|surrounds)|shimmering aura (?:fades|surrounds)/
-
- # Simple Squelch Filters: Any line matching these will be squelched
- @simple_filters = [
- /Roundtime:/,
- /incandescent veil fades/, # 1608
- /knobby layer of bark/, # 605
- /briefly before decaying into dust./, # 709 decay
- /In a breathtaking display of ability and combat mastery|spins about looking mighty stirred up|looks determined and focused/, # mstrike prep
- /removes a single(.*)from/, # get arrow
- /nocks? an?/, # arrow nock
- ].freeze
-
def initialize(script_vars)
+ # --- Status Effects ---
+ @status_effects = {
+ "stunned" => /stunned|strength of holy incantation/,
+ "frozen" => /freezes|encased in a thick block of ice|stops all movement/,
+ "knockdown" => /falls over|(?:dragged|knocked|down|flattening itself) to the (?:\w+)|collapses on/,
+ "sympathized" => /eyes begin to glow (?:purple|dark)/,
+ "pinned" => /pins? (?:.*) to the/,
+ "webbed" => /ensnared in thick strands of webbing/,
+ "buffeted" => /buffeted by/,
+ "dead" => /tries to crawl away on the (?:ground|floor) but|
+ rolls over on the (?:ground|floor) and goes still|
+ body falls to the (?:ground|floor) as it is consumed by ethereal flame|
+ (?:collapses|crashes) to the (?:ground|floor)|
+ grows dim as s?he falls to the (?:ground|floor)|
+ falls to the (ground|floor) motionless/x
+ }
+
+ his_or_her = '(?:]+>)?(?:his|her)(?:<\/a>)?'
+ himself_or_herself = '(?:]+>)?(?:himself|herself)(?:<\/a>)?'
+
+ # --- Verb Lists ---
+ @verbs_standard = [
+ 'gestures? at', # generic spell casting
+ 'gestures?\.', # generic spell casting without target
+ 'channels? at',
+ 'waves? (?:your|an?) .+? at', # wand casting (self: "wave your wand", others: "waves a wand")
+ '(?:hurl|fire|swing|thrust)s? an? [\w \-\']+ at',
+ 'swings? an? [\w \-\']+ at',
+ 'slashes with an? [\w \-\']+ at', # Tenchin slashes with a rolaren-edged veil iron troll-claw at a deathsworn fanatic!
+ 'thrusts?(?: with)? a [\w \-\']+ at',
+ 'continues to sing a disruptive song',
+ 'draws an intricately glowing pattern in the air before',
+ 'chants a reverent litany',
+ 'skillfully begins to weave another verse into (?:.*) harmony',
+ 'voice carries the power of thunder as (?:.*) calls out an angry incantation in an unknown language',
+ '(?:.*) directing the sound of (?:.*) voice at', # bardsong
+ 'punches?(?: with)? an? [\w \-\']+ at', # brawling punch
+ '(?:make a precise )?attempts? to (?:punch|jab|grapple|kick)', # uac verbs
+ 'An obscuring brume descends', # i don't remember
+ 'take aim and fire an? [\w \-\']+', # aimed ranged attack
+ 'turns and sweeps', # executioner's stance follow up
+ 'lashes out again and again with the force of a reaping whirlwind', # weapon whirlwind
+ 'charges forward at', # shield charge
+ 'lunges forward at', # shield bash
+ 'takes a menacing step toward', # weapon pummel
+ "brings #{his_or_her} .+? around in a tight arc to batter", # weapon thrash cycle
+ 'takes quick assessment and raises', # weapon pindown
+ 'exhales a virulent green mist toward', # pestilence
+ 'snap your arm forward', # shield throw
+ "snaps #{his_or_her} arm forward, (?:throwing|hurling) #{his_or_her} .+? at", # shield throw
+ 'looses arrow after arrow', # weapon volley
+ "hurls #{himself_or_herself} at", # cman tackle
+ "slowly moves #{his_or_her} hand in a (?:waving|pushing|throwing|slapping|clenching|pounding) motion" # 514
+ ]
+
+ # Verbs that match in a reverse order: "[Player] ... [target] ... [verb]"
+ # where the target is before the verb in the sentence
+ @verbs_target_first = [
+ 'calls? down(?: the)? excoriating power', # paladin feat excoriate
+ 'deliver a sound thrashing', # weapon thrash
+ ]
+
+ # Ambient damage messaging, verb first and then target, no player noun
+ @verbs_ambient = [
+ 'Fiery debris explodes from the ground', # earthen fury damage cycle
+ 'Craggy debris explodes from the ground',
+ 'The earth cracks beneath',
+ 'Icy stalagmites burst from the ground',
+ 'flies out of the shadows toward', # sniper attack
+ 'Light and dark pockmarks appear', # pestilence
+ 'sickly green miasma around',
+ 'waves billow outward from', # Hallowed Reprisal
+ 'long thorny vine lashes out', # vine
+ 'charges forward and bites', # porcupine animal companion attack
+ 'raging sandstorm swirls around', # 914
+ 'burst of flame leaps from', # 915 fire
+ 'devastating inferno of flaming rocks ignites the entire sky', # 525 meteor swarm cycle
+ 'flaming rocks burst from the sky and smite the area', # 525
+ 'Ripples of cold white flame flare up around', # cleric cycle
+ 'several faintly glowing snowflakes settle upon', # 335 cycle
+ ]
+
+ # Ambient damage messaging, target first and then verb, no player noun
+ @verbs_ambient_2 = [
+ 'convulses with a crippling affliction', # pestilence damage cycle
+ 'as virulent green mist passes through',
+ 'Large hailstones pound relentlessly',
+ 'spiritual malady wracks',
+ ]
+
+ # --- Spell Guessing Data Structure ---
+ # Format: [Regex, Spell ID, Include Line?]
+ # - Include Line? (boolean): this will save the matching line and include it in the compressed block
+ # except on "extreme" mode
+ #
+ @spell_guess_patterns = [
+ [/radiant burst of light/, '135', true],
+ [/shoot strands of webbing/, 'ball', false], # treat 118 evoke as a ball spell- will use this sentence as the first message, replace generic "gesture"
+ [/hazy film/, '119', false],
+ [/appears more confident/, '211', false],
+ [/scintillating, blue-white aura encompasses/, '302', false],
+ [/ambient temperature abruptly plummets/, '309', false],
+ [/manifests as an ethereal, pure golden censer/, '320', false],
+ [/several faintly glowing snowflakes settle/, '335', false],
+ [/hand before it takes the shape of an ethereal chain of keys|A cold mist drifts in, blanketing the area|thunderous din echoes all around as the very earth shudders beneath/, '335', true],
+ [/dark ethereal (waves|sphere)/, '410', true],
+ [/(?:waves?|sphere) of .* (?:expands|moves)/, '435', true],
+ [/surrounded by a circle of flickering flame/, '502', false], # 502 fire
+ [/a bolt of churning air/, 'ball', false],
+ [/An airy mist rolls into the (?:area|room)/, '512', true],
+ [/unleashes a compact swirling vortex/, '518', true],
+ [/Wisps of black smoke swirl around/, '519', true],
+ [/multitude of sharp pieces of debris splinter off from underfoot|The surroundings advance upon/, '635', true],
+ [/arms snatch viciously|grotesque limbs/, '709', true],
+ [/leaving behind a sucking void/, '720', false],
+ [/gust of wind tugs at your sleeves/, '912', false],
+ [/debris explodes from the ground beneath/, '917', true],
+ [/force of the sonic vibrations/, '1030', false],
+ [/reels under the force of the sonic vibrations/, '1030', false],
+ [/pulse of pearlescent energy ripples/, '1106', false],
+ [/A nebulous haze shimmers into view around/, '1115', true],
+ [/eyes begin to glow (?:purple|dark)/, '1120', false],
+ [/utters a pious chant (.*) Suddenly a divine force radiates out from/, '1618', true],
+ [/(?:hurl|fire|hurtles forth)s? an? [\w \-\']+ at/, 'ball', false], # special case for "ball" spells, replace "gesture" line with this line
+ [/an invisible force guides|considerably more powerful|feel the magic surge through you/, nil, false],
+ ]
+
+ # Simple Squelch Filters: Any line matching these will be squelched
+ @simple_filters = [
+ /Roundtime:/,
+ /incandescent veil fades/, # 1608
+ /knobby layer of bark/, # 605
+ /briefly before decaying into dust./, # 709 decay
+ /In a breathtaking display of ability and combat mastery|spins about looking mighty stirred up|looks determined and focused/, # mstrike prep
+ /removes a single(.*)from/, # get arrow
+ /nocks? an?/, # arrow nock
+ ]
+
+ # Build regex patterns
+ pc_or_you_pattern = '[^<]+<\/a>|You'
+ target_pattern = '(.*?)'
+
+ @combat_regex = /(#{pc_or_you_pattern}) (#{@verbs_standard.join('|')})(?: (?:an? |the |some )?(#{target_pattern}))?/
+ @combat_target_first_regex = /(#{pc_or_you_pattern}).*(#{target_pattern}).*(#{@verbs_target_first.join('|')})/
+ @combat_ambient_regex = /^.*?(?:#{@verbs_ambient.join('|')}).*?(#{target_pattern})/
+ @combat_ambient_2_regex = /^.*?(#{target_pattern}).*?(?:#{@verbs_ambient_2.join('|')})/
+
+ @filter_self_spells_casttime = /()/
+ @filter_self_spells_exist = /([\w ']+)<\/spell>/
+ @filter_self_spells_msg = /Your spell(song)? is ready\.|You gesture\.|Cast Roundtime \d Seconds.?/
+ @filter_self_search = /You search the |.* (had nothing of interest|didn't carry any silver|had nothing else of value)/
+ @filter_other_search = /(\w+<\/a>) searches (.*)/
+ @filter_other_spell_prep = /appears to be focusing (?:his|her) thoughts while chanting|traces a simple symbol as (?:he|she) reverently calls/
+ @filter_sigils = /faint blue glow (?:fades|surrounds)|shimmering aura (?:fades|surrounds)/
+
args = script_vars[1..-1] || []
# Handle --help first
@@ -664,7 +654,7 @@ module BriefCombat
@simple_filters.each { |regex| return nil if line =~ regex }
# Try compress_combat
- echo "DEBUG: Calling compress_combat for: #{line[0..100]}" if @debug
+ echo "DEBUG: Calling compress_combat for: #{line}" if @debug
compressed_result = compress_combat(line)
return compressed_result if compressed_result.nil?
@@ -690,8 +680,18 @@ module BriefCombat
# Debug: show what we're trying to match
if @debug && line =~ /wave.*wand/i
echo "DEBUG: Wand line detected!"
- echo " Original: #{line[0..120]}"
- echo " Cleaned: #{clean_line[0..120]}"
+ echo " Original: #{line}"
+ echo " Cleaned: #{clean_line}"
+ echo " @combat_regex class: #{@combat_regex.class}"
+ echo " @combat_regex nil?: #{@combat_regex.nil?}"
+ if @combat_regex
+ echo " Testing match..."
+ if clean_line =~ @combat_regex
+ echo " MATCHED! Groups: #{$~.to_a.inspect}"
+ else
+ echo " DID NOT MATCH"
+ end
+ end
end
if clean_line =~ @combat_regex