Module: Lich::Gemstone::Mana
- Defined in:
- documented/gemstone/mana.rb
Overview
Mana management utilities for the MANA PULSE verb (Mana Control).
Constant Summary collapse
- PULSE_RESULT =
Matches all possible server responses to the MANA PULSE command.
Regexp.union( /^An invigorating rush of mana pulses through you/i, /^You are too mentally fatigued to attempt this ability/i, /^You're already at full mana\./i, /^Your mana control skills are not yet advanced/i, ).freeze
- PULSED =
Matches the successful mana pulse server response.
/^An invigorating rush of mana pulses through you/i.freeze
Class Method Summary collapse
-
.pulse(spell = nil, timeout: 2) ⇒ Boolean
Send MANA PULSE, optionally only when it would help cast a given spell.
Class Method Details
.pulse(spell = nil, timeout: 2) ⇒ Boolean
Send MANA PULSE, optionally only when it would help cast a given spell.
44 45 46 47 48 49 50 51 52 53 |
# File 'documented/gemstone/mana.rb', line 44 def self.pulse(spell = nil, timeout: 2) unless spell.nil? spell = Spell[spell] unless spell.is_a?(Spell) return false if spell.nil? || !spell.known? || spell.affordable? end waitrt? result = dothistimeout('mana pulse', timeout, PULSE_RESULT) sleep 0.2 result.to_s =~ PULSED ? true : false end |