Seperate out rebuke logic

main
Ryan Crockett 2 years ago
parent 9406772384
commit df988ab750
  1. 46
      scripts/paladin/paladin_protection.lua
  2. 58
      scripts/paladin/shared/should-rebuke.lua

@ -16,12 +16,13 @@ local Judgement = Bastion.SpellBook:GetSpell(275779)
local AvengersShield = Bastion.SpellBook:GetSpell(31935)
local OfDuskAndDawn = Bastion.SpellBook:GetSpell(385125)
local BlessingOfTheDawn = Bastion.SpellBook:GetSpell(385127)
local BlessingOfTheDusk = Bastion.SpellBook:GetSpell(385126)
local ShieldOfTheRighteous = Bastion.SpellBook:GetSpell(53600)
local BlessedHammer = Bastion.SpellBook:GetSpell(204019)
local Rebuke = Bastion.SpellBook:GetSpell(96231)
local AutoAttack = Bastion.SpellBook:GetSpell(6603)
---@type ShouldRebuke
local ShouldRebuke = Tinkr:require("scripts/bastion/scripts/paladin/shared/should-rebuke", Bastion)
local AvengersShieldTarget = Bastion.UnitManager:CreateCustomUnit('avengers_shield', function()
local target = nil
@ -57,43 +58,6 @@ local AvengersShieldTarget = Bastion.UnitManager:CreateCustomUnit('avengers_shie
return target
end)
local KickTarget = Bastion.UnitManager:CreateCustomUnit('kick', function()
local kick = nil
Bastion.UnitManager:EnumEnemies(function(unit)
if unit:IsDead() then
return false
end
if not Player:CanSee(unit) then
return false
end
if Player:GetDistance(unit) > 40 then
return false
end
if unit:IsInterruptible() and Rebuke:IsInRange(unit) then
kick = unit
return true
end
-- TODO: Only consider this if the player is in an M+ dungeon
-- if Player:InMelee(unit) and Player:IsFacing(unit) and Bastion.MythicPlusUtils:CastingCriticalKick(unit, 5) then
-- kick = unit
-- return true
-- end
return false
end)
if kick == nil then
kick = None
end
return kick
end)
---@return boolean
local function CombatRotation()
-- Attack the target is auto attack isnt active.
@ -102,9 +66,7 @@ local function CombatRotation()
end
-- Kick
if KickTarget:Exists() and not Player:IsCastingOrChanneling() and Rebuke:IsKnownAndUsable() then
Rebuke:Cast(KickTarget)
end
if ShouldRebuke() then return true end
-- Cast Consecrate if an enemy is in range, and the player isnt moving.
if Consecrate:IsKnownAndUsable() and not Player:IsMoving() and not Player:GetAuras():FindMy(ConsecrateAura):IsUp() and Player:GetEnemies(10) >= 1 then

@ -0,0 +1,58 @@
local Tinkr, _Bastion = ...
---@type Bastion
local Bastion = _Bastion
local Player = Bastion.UnitManager:Get('player')
local None = Bastion.UnitManager:Get('none')
local Rebuke = Bastion.SpellBook:GetSpell(96231)
local RebukeTarget = Bastion.UnitManager:CreateCustomUnit('rebuke', function()
local kick = nil
Bastion.UnitManager:EnumEnemies(function(unit)
if unit:IsDead() then
return false
end
if not Player:CanSee(unit) then
return false
end
if Player:GetDistance(unit) > 40 then
return false
end
if unit:IsInterruptible() and Rebuke:IsInRange(unit) and Player:IsFacing(unit) then
kick = unit
return true
end
-- TODO: Only consider this if the player is in an M+ dungeon
-- if Player:InMelee(unit) and Player:IsFacing(unit) and Bastion.MythicPlusUtils:CastingCriticalKick(unit, 5) then
-- kick = unit
-- return true
-- end
return false
end)
if kick == nil then
kick = None
end
return kick
end)
---@alias ShouldRebuke fun():boolean
---@return boolean
function ShouldRebuke()
if RebukeTarget:Exists() and not Player:IsCastingOrChanneling() and Rebuke:IsKnownAndUsable() then
print('HAS KICK TARGET, KICKING')
return Rebuke:Cast(RebukeTarget)
end
return false
end
return ShouldRebuke
Loading…
Cancel
Save