local Tinkr, Bastion = ... local CiscOHSpec1467 = Bastion.Module:New("ciscoh_1467") local Evaluator = Tinkr.Util.Evaluator local Player = Bastion.UnitManager:Get('player') local None = Bastion.UnitManager:Get('none') local Target = Bastion.UnitManager:Get('target') local PowerType = Player:GetPowerType() local BlessingOfTheBronze = Bastion.SpellBook:GetSpell(364342) local BlessingOfTheBronzeBuff = Bastion.SpellBook:GetSpell(361748) local Burnout = Bastion.SpellBook:GetSpell(357213) local Disintegrate = Bastion.SpellBook:GetSpell(356995) local DragonRage = Bastion.SpellBook:GetSpell(357213) local EssenceBurst = Bastion.SpellBook:GetSpell(359618) local EternitySurge = Bastion.SpellBook:GetSpell(359073) local FireBreath = Bastion.SpellBook:GetSpell(357208) local LivingFlame = Bastion.SpellBook:GetSpell(361469) local ShatteringStar = Bastion.SpellBook:GetSpell(370452) local ClosestEnemy = Bastion.UnitManager:CreateCustomUnit('closestEnemy', function(unit) local leastDist = math.huge local closest = nil Bastion.UnitManager:EnumEnemies(function(unit) if unit:IsDead() then return false end if Player:GetDistance(unit) > 40 then return false end if not Player:CanSee(unit) then return false end local dist = Player:GetDistance(unit) if dist < leastDist then closest = unit leastDist = dist end end) if not closest then closest = None end return closest end) local DefaultAPL = Bastion.APL:New("default") local IdleAPL = Bastion.APL:New("idle") local HealingAPL = Bastion.APL:New("healing") IdleAPL:AddSpell( BlessingOfTheBronze:CastableIf(function(self) return self:IsKnownAndUsable() and not Player:IsCastingOrChanneling() and not Player:GetAuras():FindMyAura(BlessingOfTheBronzeBuff):IsUp() end):SetTarget(Player):PreCast(function(self) Bastion.Notifications:AddNotification(BlessingOfTheBronze:GetIcon(), "BlessingOfTheBronze") end) ) DefaultAPL:AddSpell( DragonRage:CastableIf(function(self) return Target:Exists() and self:IsKnownAndUsable() and not Player:IsCastingOrChanneling() and Player:GetEnemies(25) > 2 end):SetTarget(Player):PreCast(function(self) Bastion.Notifications:AddNotification(DragonRage:GetIcon(), "DragonRage") end) ) DefaultAPL:AddSpell( FireBreath:CastableIf(function(self) return ClosestEnemy:Exists() and ClosestEnemy:IsHostile() and not ClosestEnemy:IsDead() and self:IsKnownAndUsable() and not Player:IsCastingOrChanneling() end):SetTarget(ClosestEnemy):PreCast(function(self) Bastion.Notifications:AddNotification(FireBreath:GetIcon(), "FireBreath") if not Player:IsWithinCone(ClosestEnemy, 90, 40) then SetHeading(Player:GetAngle(ClosestEnemy)) end end) ) DefaultAPL:AddSpell( ShatteringStar:CastableIf(function(self) return ClosestEnemy:Exists() and self:IsKnownAndUsable() and not Player:IsCastingOrChanneling() end):SetTarget(ClosestEnemy):PreCast(function(self) Bastion.Notifications:AddNotification(ShatteringStar:GetIcon(), "ShatteringStar") if not Player:IsWithinCone(ClosestEnemy, 90, 40) then SetHeading(Player:GetAngle(ClosestEnemy)) end end) ) DefaultAPL:AddSpell( EssenceBurst:CastableIf(function(self) return ClosestEnemy:Exists() and self:IsKnownAndUsable() and not Player:IsCastingOrChanneling() end):SetTarget(ClosestEnemy):PreCast(function(self) Bastion.Notifications:AddNotification(EssenceBurst:GetIcon(), "EssenceBurst") if not Player:IsWithinCone(ClosestEnemy, 90, 40) then SetHeading(Player:GetAngle(ClosestEnemy)) end end) ) DefaultAPL:AddSpell( EternitySurge:CastableIf(function(self) return ClosestEnemy:Exists() and self:IsKnownAndUsable() and not Player:IsCastingOrChanneling() end):SetTarget(ClosestEnemy):PreCast(function(self) Bastion.Notifications:AddNotification(EternitySurge:GetIcon(), "EternitySurger") if not Player:IsWithinCone(ClosestEnemy, 90, 40) then SetHeading(Player:GetAngle(ClosestEnemy)) end end) ) DefaultAPL:AddSpell( LivingFlame:CastableIf(function(self) return ClosestEnemy:Exists() and self:IsKnownAndUsable() and not Player:IsCastingOrChanneling() and (Player:GetPower(PowerType) < Player:GetMaxPower(PowerType)) end):SetTarget(ClosestEnemy):PreCast(function(self) Bastion.Notifications:AddNotification(LivingFlame:GetIcon(), "LivingFlame") if not Player:IsWithinCone(ClosestEnemy, 90, 40) then SetHeading(Player:GetAngle(ClosestEnemy)) end end) ) DefaultAPL:AddSpell( Disintegrate:CastableIf(function(self) return ClosestEnemy:Exists() and self:IsKnownAndUsable() and not Player:IsCastingOrChanneling() end):SetTarget(ClosestEnemy):PreCast(function(self) Bastion.Notifications:AddNotification(Disintegrate:GetIcon(), "Disintegrate") if not Player:IsWithinCone(ClosestEnemy, 90, 40) then SetHeading(Player:GetAngle(ClosestEnemy)) end end) ) CiscOHSpec1467:Sync(function() if Player:GetCastingOrChannelingSpell() == FireBreath and Player:GetEmpoweredStage() == 2 then Bastion.Notifications:AddNotification(FireBreath:GetIcon(), "FireBreath Empowered Release") FireBreath:ForceCast(None) end if Player:GetCastingOrChannelingSpell() == EternitySurge and Player:GetEmpoweredStage() == 1 then Bastion.Notifications:AddNotification(EternitySurge:GetIcon(), "EternitySurge Empowered Release") EternitySurge:ForceCast(Target) end if Target:Exists() and Target:IsHostile() and not Target:IsDead() then SetHeading(Player:GetAngle(Target)) DefaultAPL:Execute() end IdleAPL:Execute() end) Bastion:Register(CiscOHSpec1467)