Module: Lich::Gemstone::Overwatch::Observer Private

Defined in:
documented/gemstone/overwatch.rb

Overview

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

Observer module handles parsing of game output for Overwatch. Integrates with Infomon::XMLParser for pattern matching.

Defined Under Namespace

Modules: Term

Class Method Summary collapse

Class Method Details

.consume(line, match_data) ⇒ void

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.

This method returns an undefined value.

Processes a line of Overwatch-related game output. Updates hidden target tracking and reveals creatures as appropriate.

Parameters:

  • line (String)

    line of game output

  • match_data (MatchData)

    regex match data from the line



278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
# File 'documented/gemstone/overwatch.rb', line 278

def self.consume(line, match_data)
  case line
  when Term::HIDING
    Overwatch.track_hidden_targets(XMLData.room_id)
  when Term::ANY_REVEALED
    Overwatch.push_revealed_targets(
      match_data[:id],
      match_data[:noun],
      match_data[:name]
    )
  when Term::ANY_SILENT_STRIKE
    # Handle special case for unknown assailant
    name = match_data[:name] || "unknown assailant"
    Overwatch.push_revealed_targets(
      match_data[:id],
      match_data[:noun],
      name,
      silent_strike: true
    )
  end
end

.wants?(line) ⇒ Boolean, MatchData

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.

Checks if a line contains Overwatch-related information.

Parameters:

  • line (String)

    line of game output

Returns:

  • (Boolean, MatchData)

    match data if line matches, false otherwise



268
269
270
# File 'documented/gemstone/overwatch.rb', line 268

def self.wants?(line)
  line.match(Term::ANY)
end