forked from Bastion/Bastion
parent
9406772384
commit
df988ab750
@ -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…
Reference in new issue