Class: Lich::Gemstone::Overwatch
- Inherits:
-
Object
- Object
- Lich::Gemstone::Overwatch
- Defined in:
- documented/gemstone/overwatch.rb
Overview
Manages the tracking of hidden targets in the game.
Defined Under Namespace
Modules: Observer
Class Method Summary collapse
-
.clear ⇒ void
Clears the list of hidden targets.
-
.debug=(value) ⇒ void
Sets the debug mode for tracking hidden targets.
-
.debug? ⇒ Boolean
Checks if debug mode is enabled.
-
.hiders? ⇒ Boolean
Checks if there are any hidden targets in the current room.
-
.push_revealed_targets(target_id, target_noun, target_name, silent_strike: false) ⇒ void
Pushes revealed targets into the tracking system.
-
.room_with_hiders ⇒ String?
Returns the room ID with hidden targets.
-
.room_with_hiders_reset ⇒ void
Resets the room with hidden targets by clearing the list.
-
.track_hidden_targets(room_id) ⇒ void
Tracks the specified room ID as having hidden targets.
Class Method Details
.clear ⇒ void
This method returns an undefined value.
Clears the list of hidden targets.
13 14 15 |
# File 'documented/gemstone/overwatch.rb', line 13 def self.clear @@hidden_targets = nil end |
.debug=(value) ⇒ void
This method returns an undefined value.
Sets the debug mode for tracking hidden targets.
46 47 48 |
# File 'documented/gemstone/overwatch.rb', line 46 def self.debug=(value) @@debug = value end |
.debug? ⇒ Boolean
Checks if debug mode is enabled.
52 53 54 |
# File 'documented/gemstone/overwatch.rb', line 52 def self.debug? @@debug end |
.hiders? ⇒ Boolean
Checks if there are any hidden targets in the current room.
25 26 27 28 |
# File 'documented/gemstone/overwatch.rb', line 25 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.
Pushes revealed targets into the tracking system.
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 |
# File 'documented/gemstone/overwatch.rb', line 62 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 ⇒ String?
Returns the room ID with hidden targets.
19 20 21 |
# File 'documented/gemstone/overwatch.rb', line 19 def self.room_with_hiders @@hidden_targets end |
.room_with_hiders_reset ⇒ void
This method returns an undefined value.
Resets the room with hidden targets by clearing the list.
39 40 41 |
# File 'documented/gemstone/overwatch.rb', line 39 def self.room_with_hiders_reset clear end |
.track_hidden_targets(room_id) ⇒ void
This method returns an undefined value.
Tracks the specified room ID as having hidden targets.
33 34 35 |
# File 'documented/gemstone/overwatch.rb', line 33 def self.track_hidden_targets(room_id) @@hidden_targets = room_id end |