Added Tranq Shot

main
Emlembow 5 months ago
parent 0c1d11c772
commit d22f8961ed
  1. 46
      BMHunter.lua

@ -29,6 +29,7 @@ local CounterShot = SpellBook:GetSpell(147362)
local MendPet = SpellBook:GetSpell(136)
local Exhilaration = SpellBook:GetSpell(109304)
local SurvivalOfTheFittest = SpellBook:GetSpell(264735)
local TranquilizingShot = SpellBook:GetSpell(19801)
-- Buffs and Debuffs
local FrenzyBuff = SpellBook:GetSpell(272790)
@ -76,6 +77,7 @@ local PetAPL = Bastion.APL:New('pet')
local InterruptAPL = Bastion.APL:New('interrupt')
local DefensiveAPL = Bastion.APL:New('defensive')
local BossAPL = Bastion.APL:New('boss')
local TranqAPL = Bastion.APL:New('tranq')
-- Helper Functions
local function GetBarbedShotCharges()
@ -129,6 +131,43 @@ local function ShouldInterrupt(unit)
return castPercentage >= randomThreshold
end
-- Variables to manage the random delay for Tranquilizing Shot
local tranqTargetTime = 0 -- Tracks when a valid target was first identified
local tranqReactionDelay = 0 -- Stores the random reaction delay
-- Function to generate a random reaction delay between 400ms and 2 seconds
local function GetRandomReactionDelay()
return math.random(400, 2000) / 1000 -- Convert milliseconds to seconds
end
-- Function to check if the reaction delay has passed
local function ShouldUseTranquilizingShot()
local currentTime = GetTime()
if tranqTargetTime == 0 then return false end
return currentTime - tranqTargetTime >= tranqReactionDelay
end
local TranqTarget = Bastion.UnitManager:CreateCustomUnit('tranqtarget', function()
local target = nil
Bastion.UnitManager:EnumEnemies(function(unit)
if unit:IsAffectingCombat() and unit:GetDistance(Player) <= 40 and Player:CanSee(unit)
and unit:GetAuras():HasAnyDispelableAura(TranquilizingShot) then
target = unit
-- Set the target identification time if it hasn't been set
if tranqTargetTime == 0 then
tranqTargetTime = GetTime()
tranqReactionDelay = GetRandomReactionDelay()
end
return true
end
end)
-- Reset the target time if no valid target is found
if not target then
tranqTargetTime = 0
end
return target or Bastion.UnitManager:Get('none')
end)
-- Default APL
DefaultAPL:AddSpell(
AutoShot:CastableIf(function(self)
@ -356,11 +395,16 @@ BMHunterModule:Sync(function()
end
DefensiveAPL:Execute()
DefensiveAPL:Execute() -- Add this line to check defensives
PetAPL:Execute()
TranqAPL:Execute() -- This will now respect the random reaction delay
if Player:IsAffectingCombat() then
InterruptAPL:Execute()
if BestTarget:Exists() and BestTarget:IsBoss() then
BossAPL:Execute()
end
local enemyCount = Player:GetEnemies(8)
if enemyCount >= 2 then
AoEAPL:Execute()

Loading…
Cancel
Save