forked from Bastion/Bastion
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
206 lines
5.6 KiB
206 lines
5.6 KiB
local
|
|
Tinkr,
|
|
---@type Bastion
|
|
Bastion = ...
|
|
|
|
local FrostModule = Bastion.Module:New('frost')
|
|
|
|
local Player = Bastion.UnitManager:Get('player')
|
|
local Target = Bastion.UnitManager:Get('target')
|
|
local None = Bastion.UnitManager:Get('none')
|
|
|
|
local AutoAttack = Bastion.SpellBook:GetSpell(6603)
|
|
local Frostbolt = Bastion.SpellBook:GetSpell(116)
|
|
local IceLance = Bastion.SpellBook:GetSpell(30455)
|
|
local Flurry = Bastion.SpellBook:GetSpell(44614)
|
|
local BrainFreeze = Bastion.SpellBook:GetSpell(190446)
|
|
local FingersOfFrost = Bastion.SpellBook:GetSpell(44544)
|
|
local WintersChill = Bastion.SpellBook:GetSpell(228358)
|
|
local FrostNova = Bastion.SpellBook:GetSpell(122)
|
|
local IceNova = Bastion.SpellBook:GetSpell(157997)
|
|
local IcyVeins = Bastion.SpellBook:GetSpell(12472)
|
|
local FrozenOrb = Bastion.SpellBook:GetSpell(84714)
|
|
local Blizzard = Bastion.SpellBook:GetSpell(190356)
|
|
local RuneOfPower = Bastion.SpellBook:GetSpell(116011)
|
|
|
|
---@type GetRangedTargetCount
|
|
local GetRangedTargetCount = Tinkr:require("scripts/bastion/scripts/shared/get-ranged-target-count", Bastion)
|
|
|
|
local EnableDrawROP = Tinkr:require("scripts/bastion/scripts/shared/draw-rop", Bastion)
|
|
|
|
---@type GetFrostOption
|
|
local GetFrostOption = Tinkr:require("scripts/bastion/scripts/frost/frost-gui", Bastion)
|
|
|
|
---@param unit Unit
|
|
local function isUnitFrozen(unit)
|
|
if not unit:Exists() then return false end
|
|
|
|
if unit:GetAuras():FindMy(IceNova):IsUp() or unit:GetAuras():FindMy(FrostNova):IsUp() then
|
|
return true
|
|
end
|
|
|
|
return false
|
|
end
|
|
|
|
local IceLanceTarget = Bastion.UnitManager:CreateCustomUnit('icelance', function()
|
|
if not IceLance:IsKnownAndUsable() then return None end
|
|
|
|
local icelance_target = nil
|
|
|
|
Bastion.UnitManager:EnumEnemies(function(unit)
|
|
if unit:IsDead() then
|
|
return false
|
|
end
|
|
|
|
if not Player:CanSee(unit) then
|
|
return false
|
|
end
|
|
|
|
if not IceLance:IsInRange(unit) then
|
|
return false
|
|
end
|
|
|
|
if not Player:IsFacing(unit) then
|
|
return false
|
|
end
|
|
|
|
if IceLance:IsInFlightToUnit(unit) then
|
|
return false
|
|
end
|
|
|
|
if isUnitFrozen(unit) then
|
|
icelance_target = unit
|
|
return true
|
|
end
|
|
|
|
return false
|
|
end)
|
|
|
|
if icelance_target == nil then
|
|
icelance_target = None
|
|
end
|
|
|
|
return icelance_target
|
|
end)
|
|
|
|
local FrozenOrbTarget = Bastion.UnitManager:CreateCustomUnit('frozen_orb', function()
|
|
local unit = Bastion.UnitManager:GetEnemyWithMostEnemies(40, 10)
|
|
|
|
if not unit then
|
|
if Target:Exists() and Target:GetDistance(Player) <= 40 then
|
|
unit = Target
|
|
else
|
|
unit = None
|
|
end
|
|
end
|
|
|
|
return unit
|
|
end)
|
|
|
|
local HasRotatedForOrb = false
|
|
|
|
FrozenOrb:OnCast(function()
|
|
HasRotatedForOrb = false
|
|
end)
|
|
|
|
---@return boolean
|
|
local function CombatRotation()
|
|
local targetCount = GetRangedTargetCount(40)
|
|
|
|
if GetFrostOption("CdsEnabled") and IcyVeins:IsKnownAndUsable() and not Player:IsMoving() and Target:Exists() then
|
|
return IcyVeins:Cast(Player)
|
|
end
|
|
|
|
if GetFrostOption("CdsEnabled") and RuneOfPower:IsKnownAndUsable() and not Player:GetAuras():FindMy(RuneOfPower):IsUp() and not Player:IsMoving() and Target:Exists() and IcyVeins:GetLastCastTime() ~= false and GetTime() - IcyVeins:GetLastCastTime() > 5 then
|
|
return RuneOfPower:Cast(Player)
|
|
end
|
|
|
|
if FrozenOrb:IsKnownAndUsable() and GetFrostOption("FrozenOrbEnabled") and FrozenOrbTarget:Exists() then
|
|
if not HasRotatedForOrb then
|
|
print("TURNING TO ORB TARGET")
|
|
FaceObject(FrozenOrbTarget:GetGUID())
|
|
SendMovementHeartbeat()
|
|
HasRotatedForOrb = true
|
|
else
|
|
return FrozenOrb:Cast(Player)
|
|
end
|
|
end
|
|
|
|
if IceLanceTarget:Exists() then
|
|
return IceLance:Cast(IceLanceTarget)
|
|
end
|
|
|
|
if Target:Exists() and Player:CanSee(Target) and IceLance:IsKnownAndUsable() and IceLance:IsInRange(Target) then
|
|
-- Winters Chill
|
|
if Target:GetAuras():FindMy(WintersChill):IsUp() then
|
|
local winters_chill_stacks = Target:GetAuras():FindMy(WintersChill):GetCount()
|
|
print("WC STACKS: ", winters_chill_stacks)
|
|
if winters_chill_stacks == 1 and not IceLance:IsInFlightToUnit(Target) then
|
|
return IceLance:Cast(Target)
|
|
end
|
|
|
|
if winters_chill_stacks > 1 then
|
|
return IceLance:Cast(Target)
|
|
end
|
|
end
|
|
|
|
-- Fingers of Frost
|
|
if Player:GetAuras():FindMy(FingersOfFrost):IsUp() then
|
|
local fof_stacks = Player:GetAuras():FindMy(FingersOfFrost):GetCount()
|
|
print("FOF STACKS: ", fof_stacks)
|
|
if fof_stacks == 1 and not IceLance:IsInFlightToUnit(Target) then
|
|
return IceLance:Cast(Target)
|
|
end
|
|
|
|
if fof_stacks > 1 then
|
|
return IceLance:Cast(Target)
|
|
end
|
|
end
|
|
end
|
|
|
|
if Target:Exists() and Player:CanSee(Target) and Flurry:IsKnownAndUsable() and Player:GetAuras():FindMy(BrainFreeze):IsUp() then
|
|
local CastingSpell = Player:GetCastingOrChannelingSpell()
|
|
|
|
if Player:IsMoving() or (CastingSpell ~= nil and CastingSpell:GetID() == Frostbolt:GetID()) then
|
|
return Flurry:Cast(Target)
|
|
end
|
|
end
|
|
|
|
if Target:Exists() and Player:CanSee(Target) and not Player:IsMoving() and Frostbolt:IsKnownAndUsable() and Frostbolt:IsInRange(Target) then
|
|
return Frostbolt:Cast(Target)
|
|
end
|
|
|
|
return false
|
|
end
|
|
|
|
|
|
---@return boolean
|
|
local function OutOfCombatRotation()
|
|
return false
|
|
end
|
|
|
|
|
|
local isRunning = false
|
|
|
|
FrostModule:Sync(function()
|
|
if not isRunning then
|
|
Bastion:Print('Frost Started')
|
|
isRunning = true
|
|
end
|
|
|
|
EnableDrawROP()
|
|
|
|
if not Player:IsAlive() or Player:IsMounted() then
|
|
return false
|
|
end
|
|
|
|
if Player:IsAffectingCombat() or IsCurrentSpell(AutoAttack:GetID()) then
|
|
-- Combat Rotation
|
|
return CombatRotation()
|
|
else
|
|
-- Out Of Combat Rotation
|
|
return OutOfCombatRotation()
|
|
end
|
|
end)
|
|
|
|
Bastion:Register(FrostModule) |