diff --git a/BMHunter.lua b/BMHunter.lua new file mode 100644 index 0000000..f8d6245 --- /dev/null +++ b/BMHunter.lua @@ -0,0 +1,158 @@ +local Tinkr, Bastion = ... +local BeastMasteryModule = Bastion.Module:New('BeastMasteryHunter') +local Player = Bastion.UnitManager:Get('player') +local Target = Bastion.UnitManager:Get('target') +local Pet = Bastion.UnitManager:Get('pet') +local Focus = Bastion.UnitManager:Get('focus') +local SpellBook = Bastion.SpellBook:New() + +-- Spells +local KillCommand = SpellBook:GetSpell(34026) +local BarbedShot = SpellBook:GetSpell(217200) +local CobraShot = SpellBook:GetSpell(193455) +local MultiShot = SpellBook:GetSpell(2643) +local BeastCleave = SpellBook:GetSpell(115939) +local AspectOfTheWild = SpellBook:GetSpell(193530) +local BestialWrath = SpellBook:GetSpell(19574) +local Bloodshed = SpellBook:GetSpell(321530) +local DireBeast = SpellBook:GetSpell(120679) +local Barrage = SpellBook:GetSpell(120360) +local CounterShot = SpellBook:GetSpell(147362) +local Intimidation = SpellBook:GetSpell(19577) +local BindingShot = SpellBook:GetSpell(109248) +local FreezingTrap = SpellBook:GetSpell(187650) +local TarTrap = SpellBook:GetSpell(187698) +local Exhilaration = SpellBook:GetSpell(109304) +local FeignDeath = SpellBook:GetSpell(5384) +local TranquilizingShot = SpellBook:GetSpell(19801) + +-- Buffs +local FrenzyBuff = SpellBook:GetSpell(272790) +local BeastCleaveBuff = SpellBook:GetSpell(268877) + +-- Create APLs +local DefaultAPL = Bastion.APL:New('default') +local CooldownAPL = Bastion.APL:New('cooldown') +local AoEAPL = Bastion.APL:New('aoe') +local DefensiveAPL = Bastion.APL:New('defensive') +local UtilityAPL = Bastion.APL:New('utility') + +-- Utility APL +UtilityAPL:AddSpell( + CounterShot:CastableIf(function(self) + return self:IsKnownAndUsable() and (Target:IsCasting() and Target:IsInterruptible() or + (Focus:Exists() and Focus:IsCasting() and Focus:IsInterruptible())) + end):SetTarget(function() return Focus:Exists() and Focus:IsCasting() and Focus or Target end) +) + +UtilityAPL:AddSpell( + Intimidation:CastableIf(function(self) + return self:IsKnownAndUsable() and Target:IsCasting() and not Target:IsInterruptible() + end):SetTarget(Target) +) + +UtilityAPL:AddSpell( + BindingShot:CastableIf(function(self) + return self:IsKnownAndUsable() and Player:GetEnemies(30) > 2 + end):SetTarget(Target) +) + +UtilityAPL:AddSpell( + TarTrap:CastableIf(function(self) + return self:IsKnownAndUsable() and Player:GetEnemies(40) > 2 + end):SetTarget(Target) +) + +UtilityAPL:AddSpell( + TranquilizingShot:CastableIf(function(self) + return self:IsKnownAndUsable() and Target:GetAuras():HasAnyStealableAura() + end):SetTarget(Target) +) + +-- Defensive APL +DefensiveAPL:AddSpell( + Exhilaration:CastableIf(function(self) + return self:IsKnownAndUsable() and Player:GetHP() < 30 + end):SetTarget(Player) +) + +DefensiveAPL:AddSpell( + FeignDeath:CastableIf(function(self) + return self:IsKnownAndUsable() and Player:GetHP() < 15 + end):SetTarget(Player) +) + +-- Cooldown APL +CooldownAPL:AddSpell( + AspectOfTheWild:CastableIf(function(self) + return self:IsKnownAndUsable() + end):SetTarget(Player) +) + +CooldownAPL:AddSpell( + BestialWrath:CastableIf(function(self) + return self:IsKnownAndUsable() + end):SetTarget(Player) +) + +CooldownAPL:AddSpell( + Bloodshed:CastableIf(function(self) + return self:IsKnownAndUsable() + end):SetTarget(Target) +) + +-- AoE APL +AoEAPL:AddSpell( + MultiShot:CastableIf(function(self) + return self:IsKnownAndUsable() and (not Pet:GetAuras():FindMy(BeastCleaveBuff):IsUp() or + Pet:GetAuras():FindMy(BeastCleaveBuff):GetRemainingTime() < 2) + end):SetTarget(Target) +) + +AoEAPL:AddSpell( + Barrage:CastableIf(function(self) + return self:IsKnownAndUsable() and Player:GetEnemies(10) >= 3 + end):SetTarget(Target) +) + +-- Default APL +DefaultAPL:AddSpell( + BarbedShot:CastableIf(function(self) + return self:IsKnownAndUsable() and + (Pet:GetAuras():FindMy(FrenzyBuff):GetRemainingTime() < 2 or self:GetCharges() == 2) + end):SetTarget(Target) +) + +DefaultAPL:AddSpell( + KillCommand:CastableIf(function(self) + return self:IsKnownAndUsable() + end):SetTarget(Target) +) + +DefaultAPL:AddSpell( + DireBeast:CastableIf(function(self) + return self:IsKnownAndUsable() + end):SetTarget(Target) +) + +DefaultAPL:AddSpell( + CobraShot:CastableIf(function(self) + return self:IsKnownAndUsable() and Player:GetPower() > 70 and KillCommand:GetCooldownRemaining() > 2 + end):SetTarget(Target) +) + +BeastMasteryModule:Sync(function() + if not Player:IsAffectingCombat() then return end + + UtilityAPL:Execute() + DefensiveAPL:Execute() + + if Player:GetEnemies(10) >= 3 then + AoEAPL:Execute() + end + + CooldownAPL:Execute() + DefaultAPL:Execute() +end) + +Bastion:Register(BeastMasteryModule) \ No newline at end of file