local Unlocker, Caffeine = ... local OpenEnhancement = Caffeine.Module:New('OpenEnhancement') -- Units local player = Caffeine.UnitManager:Get('player') local target = Caffeine.UnitManager:Get('target') local none = Caffeine.UnitManager:Get('none') -- Spells local astral_shift = Caffeine.Globals.SpellBook:GetSpell(108271) local chain_lightning = Caffeine.Globals.SpellBook:GetSpell(188443) local flame_shock = Caffeine.Globals.SpellBook:GetSpell(188389) local flametongue_weapon = Caffeine.Globals.SpellBook:GetSpell(318038) local frost_shock = Caffeine.Globals.SpellBook:GetSpell(196840) local ghost_wolf = Caffeine.Globals.SpellBook:GetSpell(2645) local healing_surge = Caffeine.Globals.SpellBook:GetSpell(8004) local lightning_bolt = Caffeine.Globals.SpellBook:GetSpell(188196) local wind_shear = Caffeine.Globals.SpellBook:GetSpell(57994) local crash_lightning = Caffeine.Globals.SpellBook:GetSpell(187874) local doom_winds = Caffeine.Globals.SpellBook:GetSpell(384352) local feral_spirit = Caffeine.Globals.SpellBook:GetSpell(51533) local ice_strike = Caffeine.Globals.SpellBook:GetSpell(342240) local stormstrike = Caffeine.Globals.SpellBook:GetSpell(17364) local sundering = Caffeine.Globals.SpellBook:GetSpell(197214) local windfury_totem = Caffeine.Globals.SpellBook:GetSpell(8512) local windfury_weapon = Caffeine.Globals.SpellBook:GetSpell(33757) local windstrike = Caffeine.Globals.SpellBook:GetSpell(115356) -- Auras local windfury_aura = Caffeine.Globals.SpellBook:GetSpell(327942) local maelstrom_weapon = Caffeine.Globals.SpellBook:GetSpell(344179) local crash_lightning_aura = Caffeine.Globals.SpellBook:GetSpell(187878) local ascendance_aura = Caffeine.Globals.SpellBook:GetSpell(114051) -- APLs local default_apl = Caffeine.APL:New('default') --[[ Talents BYQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAoVSSLJRJJkUQUCkIBAAAAAoFgUSiSaSIikkWAKJRAI ]] -- if no windfury aura, drop default_apl:AddSpell( windfury_totem:CastableIf(function(self) return self:IsKnownAndUsable() and not player:GetAuras():FindMy(windfury_aura):IsUp() end):Settarget(none) ) -- Cast Feral Spirit on CD default_apl:AddSpell( feral_spirit:CastableIf(function(self) return self:IsKnownAndUsable() end):Settarget(target) ) -- Cast Doom Winds on CD default_apl:AddSpell( doom_winds:CastableIf(function(self) return self:IsKnownAndUsable() end):Settarget(target) ) -- Cast Lightning Bolt at 5+ Maelstrom Weapon Stacks, Chain Lightning with 2+ targets default_apl:AddSpell( lightning_bolt:CastableIf(function(self) return self:IsKnownAndUsable() and player:GetAuras():FindMy(maelstrom_weapon):GetCount() > 4 and player:GetEnemies(8) < 2 end):Settarget(target) ) default_apl:AddSpell( chain_lightning:CastableIf(function(self) return self:IsKnownAndUsable() and player:GetAuras():FindMy(maelstrom_weapon):GetCount() > 4 and player:GetEnemies(8) > 1 end):Settarget(target) ) -- Maintain crash lightning buff with 2+ targets default_apl:AddSpell( crash_lightning:CastableIf(function(self) return self:IsKnownAndUsable() and not player:GetAuras():FindMy(crash_lightning_aura):IsUp() and player:GetEnemies(8) > 1 end):Settarget(target) ) -- Sundering on CD default_apl:AddSpell( sundering:CastableIf(function(self) return self:IsKnownAndUsable() end):Settarget(target) ) -- Windstrike if ascendance has proc'd default_apl:AddSpell( windstrike:CastableIf(function(self) return self:IsKnownAndUsable() and player:GetAuras():FindMy(ascendance_aura):IsUp() end):Settarget(target) ) -- Stormstrike default_apl:AddSpell( stormstrike:CastableIf(function(self) return self:IsKnownAndUsable() end):Settarget(target) ) -- Crash Lightning default_apl:AddSpell( crash_lightning:CastableIf(function(self) return self:IsKnownAndUsable() end):Settarget(target) ) -- Ice Strike default_apl:AddSpell( ice_strike:CastableIf(function(self) return self:IsKnownAndUsable() end):Settarget(target) ) -- Flame Shock default_apl:AddSpell( flame_shock:CastableIf(function(self) return self:IsKnownAndUsable() end):Settarget(target) ) -- Frost Shock default_apl:AddSpell( frost_shock:CastableIf(function(self) return self:IsKnownAndUsable() end):Settarget(target) ) local move_to_timer = 0 OpenEnhancement:Sync(function() if not player:IsFacing(target) and target:Exists() and not target:IsDead() then Caffeine.Util:FaceUnit(target) end if not player:InMelee(target) and target:Exists() and not target:IsDead() and target:IsHostile() then local tx, ty, tz = ObjectPosition('target') local px, py, pz = ObjectPosition('player') if GetTime() - move_to_timer > 0.5 and FastDistance(px, py, pz, tx, ty, tz) > 5 then MoveTo(tx, ty, tz) move_to_timer = GetTime() end end if player:IsAffectingCombat() and target:Exists() and target:IsHostile() and not target:IsDead() and player:IsFacing(target) then default_apl:Execute() end end) Caffeine:Register(OpenEnhancement)