Class: Lich::Gemstone::Warcry
- Inherits:
-
Object
- Object
- Lich::Gemstone::Warcry
- Defined in:
- lib/gemstone/psms/warcry.rb
Overview
Represents a Warcry in the game.
Constant Summary collapse
- @@warcries =
{ "bellow" => { :regex => /You glare at .+ and let out a nerve-shattering bellow!/, }, "yowlp" => { :regex => /You throw back your shoulders and let out a resounding yowlp!/, :buff => "Yertie's Yowlp", }, "growl" => { :regex => /Your face contorts as you unleash a guttural, deep-throated growl at .+!/, }, "shout" => { :regex => /You let loose an echoing shout!/, :buff => 'Empowered (+20)', }, "cry" => { :regex => /You stare down .+ and let out an eerie, modulating cry!/, }, "holler" => { :regex => /You throw back your head and let out a thundering holler!/, :buff => 'Enh. Health (+20)', }, }
Class Method Summary collapse
-
.[](name) ⇒ Object
Retrieves the warcry associated with the given name.
-
.affordable?(name) ⇒ Boolean
Checks if the specified warcry is affordable.
-
.available?(name, min_rank: 1) ⇒ Boolean
Checks if the specified warcry is available for use.
-
.buffActive?(name) ⇒ Boolean
Checks if the specified warcry’s buff is currently active.
-
.known?(name, min_rank: 1) ⇒ Boolean
Checks if the specified warcry is known with a minimum rank.
-
.regexp(name) ⇒ Regexp
Retrieves the regex pattern associated with the specified warcry.
-
.use(name, target = "", results_of_interest: nil) ⇒ String?
Uses the specified warcry on a target.
-
.warcry_lookups ⇒ Array<Hash>
Provides a list of warcry lookups with their long names, short names, and costs.
Class Method Details
.[](name) ⇒ Object
Retrieves the warcry associated with the given name.
53 54 55 |
# File 'lib/gemstone/psms/warcry.rb', line 53 def Warcry.[](name) return PSMS.assess(name, 'Warcry') end |
.affordable?(name) ⇒ Boolean
Checks if the specified warcry is affordable.
77 78 79 |
# File 'lib/gemstone/psms/warcry.rb', line 77 def Warcry.affordable?(name) return PSMS.assess(name, 'Warcry', true) end |
.available?(name, min_rank: 1) ⇒ Boolean
Checks if the specified warcry is available for use.
89 90 91 |
# File 'lib/gemstone/psms/warcry.rb', line 89 def Warcry.available?(name, min_rank: 1) Warcry.known?(name, min_rank: min_rank) and Warcry.affordable?(name) and !Lich::Util.normalize_lookup('Cooldowns', name) and !Lich::Util.normalize_lookup('Debuffs', 'Overexerted') end |
.buffActive?(name) ⇒ Boolean
Checks if the specified warcry’s buff is currently active.
100 101 102 103 104 |
# File 'lib/gemstone/psms/warcry.rb', line 100 def Warcry.buffActive?(name) buff = @@warcries.fetch(PSMS.name_normal(name))[:buff] return false if buff.nil? Lich::Util.normalize_lookup('Buffs', buff) end |
.known?(name, min_rank: 1) ⇒ Boolean
Checks if the specified warcry is known with a minimum rank.
65 66 67 68 |
# File 'lib/gemstone/psms/warcry.rb', line 65 def Warcry.known?(name, min_rank: 1) min_rank = 1 unless min_rank >= 1 # in case a 0 or below is passed Warcry[name] >= min_rank end |
.regexp(name) ⇒ Regexp
Retrieves the regex pattern associated with the specified warcry.
163 164 165 |
# File 'lib/gemstone/psms/warcry.rb', line 163 def Warcry.regexp(name) @@warcries.fetch(PSMS.name_normal(name))[:regex] end |
.use(name, target = "", results_of_interest: nil) ⇒ String?
This method will wait for roundtime and casting roundtime before executing.
Uses the specified warcry on a target.
116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 |
# File 'lib/gemstone/psms/warcry.rb', line 116 def Warcry.use(name, target = "", results_of_interest: nil) return unless Warcry.available?(name) return if Warcry.buffActive?(name) name_normalized = PSMS.name_normal(name) technique = @@warcries.fetch(name_normalized) usage = name_normalized return if usage.nil? in_cooldown_regex = /^#{name} is still in cooldown\./i results_regex = Regexp.union( PSMS::FAILURES_REGEXES, /^#{name} what\?$/i, in_cooldown_regex, technique[:regex], /^Roundtime: [0-9]+ sec\.$/, ) if results_of_interest.is_a?(Regexp) results_regex = Regexp.union(results_regex, results_of_interest) end usage_cmd = "warcry #{usage}" if target.is_a?(GameObj) usage_cmd += " ##{target.id}" elsif target.is_a?(Integer) usage_cmd += " ##{target}" elsif target != "" usage_cmd += " #{target}" end waitrt? waitcastrt? usage_result = dothistimeout(usage_cmd, 5, results_regex) if usage_result == "You don't seem to be able to move to do that." 100.times { break if clear.any? { |line| line =~ /^You regain control of your senses!$/ }; sleep 0.1 } usage_result = dothistimeout(usage_cmd, 5, results_regex) end usage_result end |
.warcry_lookups ⇒ Array<Hash>
Provides a list of warcry lookups with their long names, short names, and costs.
13 14 15 16 17 18 19 20 |
# File 'lib/gemstone/psms/warcry.rb', line 13 def self.warcry_lookups [{ long_name: 'bertrandts_bellow', short_name: 'bellow', cost: 20 }, # @todo only 10 for single { long_name: 'carns_cry', short_name: 'cry', cost: 20 }, { long_name: 'gerrelles_growl', short_name: 'growl', cost: 14 }, # @todo only 7 for single { long_name: 'horlands_holler', short_name: 'holler', cost: 20 }, { long_name: 'seanettes_shout', short_name: 'shout', cost: 20 }, { long_name: 'yerties_yowlp', short_name: 'yowlp', cost: 10 }] end |