From 6bc6d72b347d0476c9a640c1788590b3140763ab Mon Sep 17 00:00:00 2001 From: Emlembow <36314674+Emlembow@users.noreply.github.com> Date: Sat, 31 Aug 2024 21:15:04 -0700 Subject: [PATCH] Improved Killshot --- BMHunter.lua | 36 +++++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/BMHunter.lua b/BMHunter.lua index e9a3c71..5fe419c 100644 --- a/BMHunter.lua +++ b/BMHunter.lua @@ -69,6 +69,18 @@ local InterruptTarget = Bastion.UnitManager:CreateCustomUnit('interrupttarget', return target or BestTarget end) +local ExecuteTarget = Bastion.UnitManager:CreateCustomUnit('executetarget', function() + local target = nil + Bastion.UnitManager:EnumEnemies(function(unit) + if unit:IsAffectingCombat() and unit:GetDistance(Player) <= 40 and Player:CanSee(unit) + and unit:GetHP() < 20 then + target = unit + return true + end + end) + return target or Bastion.UnitManager:Get('none') +end) + -- APLs local DefaultAPL = Bastion.APL:New('default') local CooldownAPL = Bastion.APL:New('cooldown') @@ -78,6 +90,7 @@ local InterruptAPL = Bastion.APL:New('interrupt') local DefensiveAPL = Bastion.APL:New('defensive') local BossAPL = Bastion.APL:New('boss') local TranqAPL = Bastion.APL:New('tranq') +local ExecuteAPL = Bastion.APL:New('execute') -- Helper Functions local function GetBarbedShotCharges() @@ -196,13 +209,6 @@ DefaultAPL:AddSpell( end):SetTarget(BestTarget) ) -DefaultAPL:AddSpell( - KillShot:CastableIf(function(self) - return BestTarget:Exists() and self:IsKnownAndUsable() and not Player:IsCastingOrChanneling() - and BestTarget:GetHP() < 20 - end):SetTarget(BestTarget) -) - DefaultAPL:AddSpell( CobraShot:CastableIf(function(self) return BestTarget:Exists() and self:IsKnownAndUsable() and not Player:IsCastingOrChanneling() @@ -308,13 +314,6 @@ AoEAPL:AddSpell( end):SetTarget(BestTarget) ) -AoEAPL:AddSpell( - KillShot:CastableIf(function(self) - return BestTarget:Exists() and self:IsKnownAndUsable() and not Player:IsCastingOrChanneling() - and IsVenomsBiteTalented() and BestTarget:GetHP() < 20 - end):SetTarget(BestTarget) -) - AoEAPL:AddSpell( ExplosiveShot:CastableIf(function(self) return BestTarget:Exists() and self:IsKnownAndUsable() and not Player:IsCastingOrChanneling() @@ -388,6 +387,12 @@ BossAPL:AddSpell( end):SetTarget(Player) ) +ExecuteAPL:AddSpell( + KillShot:CastableIf(function(self) + return ExecuteTarget:Exists() and self:IsKnownAndUsable() and not Player:IsCastingOrChanneling() + end):SetTarget(ExecuteTarget) +) + -- Module Sync BMHunterModule:Sync(function() if Player:IsMounted() then @@ -396,9 +401,10 @@ BMHunterModule:Sync(function() DefensiveAPL:Execute() PetAPL:Execute() - TranqAPL:Execute() -- This will now respect the random reaction delay + TranqAPL:Execute() if Player:IsAffectingCombat() then + ExecuteAPL:Execute() -- Add this line InterruptAPL:Execute() if BestTarget:Exists() and BestTarget:IsBoss() then