Class: Lich::Gemstone::Overwatch
- Inherits:
-
Object
- Object
- Lich::Gemstone::Overwatch
- Defined in:
- documented/gemstone/overwatch.rb
Overview
Manages hidden creature detection and tracking in Gemstone IV. Automatically tracks when creatures hide and reveals them when they emerge. Integrates with GameObj and XMLData to maintain accurate target lists.
Defined Under Namespace
Modules: Observer
Class Method Summary collapse
-
.clear ⇒ nil
Clears the hidden targets tracking.
-
.debug=(value) ⇒ Boolean
Enables or disables debug output.
-
.debug? ⇒ Boolean
Checks if debug mode is enabled.
-
.hiders? ⇒ Boolean
Checks if the current room has hidden targets.
-
.push_revealed_targets(target_id, target_noun, target_name, silent_strike: false) ⇒ void
Adds a revealed target to GameObj and XMLData if not already present.
-
.room_with_hiders ⇒ Integer?
Gets the room ID where hidden targets were last detected.
-
.room_with_hiders_reset ⇒ nil
Clears hidden targets tracking.
-
.track_hidden_targets(room_id) ⇒ Integer
Sets the room where hidden targets were detected.
Class Method Details
.clear ⇒ nil
Clears the hidden targets tracking.
27 28 29 |
# File 'documented/gemstone/overwatch.rb', line 27 def self.clear @@hidden_targets = nil end |
.debug=(value) ⇒ Boolean
Enables or disables debug output.
66 67 68 |
# File 'documented/gemstone/overwatch.rb', line 66 def self.debug=(value) @@debug = value end |
.debug? ⇒ Boolean
Checks if debug mode is enabled.
73 74 75 |
# File 'documented/gemstone/overwatch.rb', line 73 def self.debug? @@debug end |
.hiders? ⇒ Boolean
Checks if the current room has hidden targets.
41 42 43 44 |
# File 'documented/gemstone/overwatch.rb', line 41 def self.hiders? return false if @@hidden_targets.nil? @@hidden_targets.eql?(XMLData.room_id) end |
.push_revealed_targets(target_id, target_noun, target_name, silent_strike: false) ⇒ void
This method returns an undefined value.
Adds a revealed target to GameObj and XMLData if not already present. Handles silent strike detection by checking recent game output.
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 117 118 119 120 121 122 123 124 |
# File 'documented/gemstone/overwatch.rb', line 85 def self.push_revealed_targets(target_id, target_noun, target_name, silent_strike: false) @@hidden_targets = nil if silent_strike respond "Checking for silent strike against #{target_id} #{target_name}." if @@debug result = reget(10, /fades into the surroundings\./, /slips into the shadows\./, /botch an attempt at concealing\./, /The figure quickly disappears from view\./, core: true) respond result if @@debug unless result.empty? case result[0] when /With a (?:barely audible hiss|sibilant exhalation), <pushBold\/>\w+ <a exist="(\d+)" noun=" ?\w+">[^<]+<\/a><popBold\/> (?:fades into the surroundings|slips into the shadows)\./ if target_id == Regexp.last_match[1] respond "Silent Strike Detected. Target #{target_id} #{target_name} is hidden." if @@debug return end when /The figure quickly disappears from view\./ respond "Silent Strike Detected. Target is hidden." if @@debug return when /You notice <pushBold\/>\w+ <a exist="(\d+)" noun=" ?\w+">[^<]+<\/a><popBold\/> botch an attempt at concealing <pushBold\/><a exist="\d+" noun=" ?\w+">\w+<\/a><popBold\/>\./ if target_id == Regexp.last_match[1] respond "Silent Strike Botched. Target #{target_id} #{target_name}." if @@debug end end end end respond "push_revealed_targets(#{target_id}, #{target_noun}, #{target_name}, silent_strike: #{silent_strike})" if @@debug # Add to GameObj.npcs if not already present unless GameObj.npcs.any? { |npc| npc.id == target_id } GameObj.new_npc(target_id, target_noun, target_name.gsub(/ /, " ")) respond "#{target_id} added to GameObj.npcs." if @@debug end # Add to XMLData.current_target_ids if not already present unless XMLData.current_target_ids.include?(target_id) XMLData.current_target_ids.unshift(target_id) respond "#{target_id} added to XMLData.current_target_ids." if @@debug end end |
.room_with_hiders ⇒ Integer?
Gets the room ID where hidden targets were last detected.
34 35 36 |
# File 'documented/gemstone/overwatch.rb', line 34 def self.room_with_hiders @@hidden_targets end |
.room_with_hiders_reset ⇒ nil
Clears hidden targets tracking. Alias for clear method.
58 59 60 |
# File 'documented/gemstone/overwatch.rb', line 58 def self.room_with_hiders_reset clear end |
.track_hidden_targets(room_id) ⇒ Integer
Sets the room where hidden targets were detected.
50 51 52 |
# File 'documented/gemstone/overwatch.rb', line 50 def self.track_hidden_targets(room_id) @@hidden_targets = room_id end |