diff --git a/scripts/protpaladin.lua b/scripts/protpaladin.lua index b7da67e..1c99087 100644 --- a/scripts/protpaladin.lua +++ b/scripts/protpaladin.lua @@ -1,4 +1,8 @@ -local Tinkr, Bastion = ... +local Tinkr = ... + +---@class Bastion +local Bastion = ... + local ProtModule = Bastion.Module:New('prot_paladin') local Evaluator = Tinkr.Util.Evaluator @@ -10,51 +14,62 @@ local DevoAura = Bastion.SpellBook:GetSpell(465) local PlayerSelfWOGPercent = 40 --- local WOGTarget = Bastion.UnitManager:CreateCustomUnit('wogtarget', function(unit) --- local lowest = nil --- local lowestHP = math.huge +local WOGTarget = Bastion.UnitManager:CreateCustomUnit('wogtarget', function(unit) + local lowest = nil + local lowestHP = math.huge --- Bastion.UnitManager:EnumFriends(function(unit) --- if unit:IsDead() then --- return false --- end + Bastion.UnitManager:EnumFriends(function(unit) + if unit:IsDead() then + return false + end --- if Player:GetDistance(unit) > 40 then --- return false --- end + if Player:GetDistance(unit) > 40 then + return false + end --- if not Player:CanSee(unit) then --- return false --- end + if not Player:CanSee(unit) then + return false + end --- local hp = unit:GetHP() --- if hp < lowestHP then --- lowest = unit --- lowestHP = hp --- end --- end) + local hp = unit:GetHP() + if hp < lowestHP then + lowest = unit + lowestHP = hp + end --- if not lowest or Player:GetHP() < lowest or Player:GetHealthPercent() <= PlayerSelfWOGPercent then --- lowest = Player --- end + return false + end) --- return lowest --- end) + if not lowest or Player:GetHP() < lowest then + lowest = Player + end + + return lowest +end) local isRunning = false ProtModule:Sync(function() if not isRunning then - Bastion:Print('Running Prot Pally Routine') + Bastion:Print('Prot Pally Started') isRunning = true end + + -- Cast Crusader Aura if talented and the player is mounted. if Player:IsMounted() and CrusaderAura:IsKnownAndUsable() and not Player:GetAuras():FindMy(CrusaderAura):IsUp() and not Player:IsCastingOrChanneling() then return CrusaderAura:Cast(Player) end + -- Cast Devo Aura if the player is not mounted. if not Player:IsMounted() and DevoAura:IsKnownAndUsable() and not Player:GetAuras():FindMy(DevoAura):IsUp() and not Player:IsCastingOrChanneling() then return DevoAura:Cast(Player) end + + if Player:IsAffectingCombat() then + -- Combat Rotation + else + -- Out Of Combat Rotation + end end) Bastion:Register(ProtModule) diff --git a/src/Spell/Spell.lua b/src/Spell/Spell.lua index c33d7c6..1bfdc9b 100644 --- a/src/Spell/Spell.lua +++ b/src/Spell/Spell.lua @@ -128,7 +128,7 @@ end -- Cast the spell ---@param unit Unit ----@param condition string +---@param condition? string ---@return boolean function Spell:Cast(unit, condition) if condition and not self:EvaluateCondition(condition) then