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 RuneOfPower = Bastion.SpellBook:GetSpell(116011) local CDsEnabled = false local Command = Bastion.Command:New('frost') Command:Register('cooldowns', 'Toggle Frost CDs', function() CDsEnabled = not CDsEnabled Bastion:Print('Frost Cooldowns ' .. (CDsEnabled and 'enabled' or 'disabled')) end) ---@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) ---@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() or unit:GetAuras():FindMy(WintersChill):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) ---@return boolean local function CombatRotation() local targetCount = GetRangedTargetCount(40) if CDsEnabled and IcyVeins:IsKnownAndUsable() and not Player:IsCastingOrChanneling() then IcyVeins:Cast(Player) end if CDsEnabled and not Player:IsMoving() then end if IceLance:IsKnownAndUsable() and IceLanceTarget:Exists() then return IceLance:Cast(IceLanceTarget) end if Target:Exists() and Player:CanSee(Target) and IceLance:IsKnownAndUsable() and IceLance:IsInRange(Target) and (isUnitFrozen(Target) or Player:GetAuras():FindMy(FingersOfFrost):IsUp()) then return IceLance:Cast(Target) 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)