local Tinkr, Bastion = ... local ProtPaladinModule = Bastion.Module:New('ProtectionPaladin') local Player = Bastion.UnitManager:Get('player') local Target = Bastion.UnitManager:Get('target') local SpellBook = Bastion.SpellBook:New() -- Spells local Consecration = SpellBook:GetSpell(26573) local ShieldOfTheRighteous = SpellBook:GetSpell(53600) local Judgment = SpellBook:GetSpell(275779) local HammerOfWrath = SpellBook:GetSpell(24275) local AvengersShield = SpellBook:GetSpell(31935) local HammerOfTheRighteous = SpellBook:GetSpell(53595) local BlessedHammer = SpellBook:GetSpell(204019) local WordOfGlory = SpellBook:GetSpell(85673) local GuardianOfAncientKings = SpellBook:GetSpell(86659) local ArdentDefender = SpellBook:GetSpell(31850) local AvengingWrath = SpellBook:GetSpell(31884) local LayOnHands = SpellBook:GetSpell(633) local DivineShield = SpellBook:GetSpell(642) -- Buffs local ConsecrationBuff = SpellBook:GetSpell(188370) local ShiningLightBuff = SpellBook:GetSpell(327510) -- Create APLs local DefaultAPL = Bastion.APL:New('default') local CooldownAPL = Bastion.APL:New('cooldown') local DefensiveAPL = Bastion.APL:New('defensive') -- Defensive APL DefensiveAPL:AddSpell( ShieldOfTheRighteous:CastableIf(function(self) return self:IsKnownAndUsable() and Player:GetPower() >= 3 and Player:GetHP() < 80 end):SetTarget(Player) ) DefensiveAPL:AddSpell( WordOfGlory:CastableIf(function(self) return self:IsKnownAndUsable() and (Player:GetPower() >= 3 or Player:GetAuras():FindMy(ShiningLightBuff):IsUp()) and Player:GetHP() < 50 end):SetTarget(Player) ) DefensiveAPL:AddSpell( GuardianOfAncientKings:CastableIf(function(self) return self:IsKnownAndUsable() and Player:GetHP() < 40 end):SetTarget(Player) ) DefensiveAPL:AddSpell( ArdentDefender:CastableIf(function(self) return self:IsKnownAndUsable() and Player:GetHP() < 30 end):SetTarget(Player) ) DefensiveAPL:AddSpell( LayOnHands:CastableIf(function(self) return self:IsKnownAndUsable() and Player:GetHP() < 20 end):SetTarget(Player) ) -- Cooldown APL CooldownAPL:AddSpell( AvengingWrath:CastableIf(function(self) return self:IsKnownAndUsable() and Player:GetEnemies(8) >= 3 end):SetTarget(Player) ) -- Default APL DefaultAPL:AddSpell( Consecration:CastableIf(function(self) return self:IsKnownAndUsable() and not Player:GetAuras():FindMy(ConsecrationBuff):IsUp() end):SetTarget(Player) ) DefaultAPL:AddSpell( ShieldOfTheRighteous:CastableIf(function(self) return self:IsKnownAndUsable() and Player:GetPower() >= 3 end):SetTarget(Player) ) DefaultAPL:AddSpell( AvengersShield:CastableIf(function(self) return self:IsKnownAndUsable() and Player:GetEnemies(8) >= 3 end):SetTarget(Target) ) DefaultAPL:AddSpell( Judgment:CastableIf(function(self) return self:IsKnownAndUsable() end):SetTarget(Target) ) DefaultAPL:AddSpell( HammerOfWrath:CastableIf(function(self) return self:IsKnownAndUsable() end):SetTarget(Target) ) DefaultAPL:AddSpell( AvengersShield:CastableIf(function(self) return self:IsKnownAndUsable() end):SetTarget(Target) ) DefaultAPL:AddSpell( BlessedHammer:CastableIf(function(self) return self:IsKnownAndUsable() end):SetTarget(Target) ) DefaultAPL:AddSpell( HammerOfTheRighteous:CastableIf(function(self) return self:IsKnownAndUsable() and not BlessedHammer:IsKnown() end):SetTarget(Target) ) DefaultAPL:AddSpell( Consecration:CastableIf(function(self) return self:IsKnownAndUsable() end):SetTarget(Player) ) ProtPaladinModule:Sync(function() if not Player:IsAffectingCombat() then return end DefensiveAPL:Execute() CooldownAPL:Execute() DefaultAPL:Execute() end) Bastion:Register(ProtPaladinModule)