forked from Bastion/Bastion
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
58 lines
1.3 KiB
58 lines
1.3 KiB
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:IsInterruptibleAt(10) 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 Rebuke fun():boolean
|
|
|
|
---@type Rebuke
|
|
function Rebuke()
|
|
if RebukeTarget:Exists() and not Player:IsCastingOrChanneling() and _Rebuke:IsKnownAndUsable() then
|
|
return _Rebuke:Cast(RebukeTarget)
|
|
end
|
|
return false
|
|
end
|
|
|
|
return Rebuke |