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

Defined in:
documented/gemstone/overwatch.rb

Overview

Provides functionality for observing and reacting to hidden targets.

Defined Under Namespace

Modules: Term

Class Method Summary collapse

Class Method Details

.consume(line, match_data) ⇒ void

This method returns an undefined value.

Consumes a line and processes it based on matching patterns.

Parameters:

  • line (String)

    the line to consume

  • match_data (MatchData)

    the data from the matched pattern



204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
# File 'documented/gemstone/overwatch.rb', line 204

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

Determines if the given line matches any hiding or revealing patterns.

Parameters:

  • line (String)

    the line to check

Returns:

  • (Boolean)

    true if the line matches any patterns, false otherwise



196
197
198
# File 'documented/gemstone/overwatch.rb', line 196

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