From bef53be50e682db3e04f08c1e4c1c7b5db5c4cce Mon Sep 17 00:00:00 2001 From: Ryan Crockett Date: Wed, 15 Mar 2023 08:10:55 -0400 Subject: [PATCH] More brew spells --- scripts/brewmaster.lua | 98 ++++++++++++++++++++++++++++++++++++++---- 1 file changed, 90 insertions(+), 8 deletions(-) diff --git a/scripts/brewmaster.lua b/scripts/brewmaster.lua index 342e8dc..256a368 100644 --- a/scripts/brewmaster.lua +++ b/scripts/brewmaster.lua @@ -20,11 +20,38 @@ local KegSmash = Bastion.SpellBook:GetSpell(121253) local WeaponsOfOrder = Bastion.SpellBook:GetSpell(387184) local BlackoutKick = Bastion.SpellBook:GetSpell(205523) local RisingSunKick = Bastion.SpellBook:GetSpell(107428) +local TigerPalm = Bastion.SpellBook:GetSpell(100780) +local SpinningCraneKick = Bastion.SpellBook:GetSpell(322729) +local ExpelHarm = Bastion.SpellBook:GetSpell(322101) +local GiftOfTheOx = Bastion.SpellBook:GetSpell(124502) local CDsEnabled = false +local Command = Bastion.Command:New('brewmaster') + +Command:Register('cooldowns', 'Toggle Brewmaster CDs', function() + CDsEnabled = not CDsEnabled + Bastion:Print('Brewmaster Cooldowns ' .. (CDsEnabled and 'enabled' or 'disabled')) +end) + +---@return number | nil +local function GetExpelHarmHealAmount() + -- Gift of the Ox orbs + local OrbCount = GetSpellCount(ExpelHarm:GetID()) or 0 + local OrbHeal = tonumber((GetSpellDescription(GiftOfTheOx:GetID()):match("%d+%S+%d"):gsub("%D",""))) + + print(GetSpellDescription(GiftOfTheOx:GetID()):match("%d+%S+%d")) + + -- expel harm + local ExpelHeal = tonumber((GetSpellDescription(ExpelHarm:GetID()):match("%d+%S+%d"):gsub("%D",""))) + + return ExpelHeal + (OrbHeal * OrbCount) +end + ---@return boolean local function CombatRotation() + local isAoe = Player:GetEnemies(8) > 1 + -- Attack the target is auto attack isnt active. if AutoAttack:IsKnownAndUsable() and not IsCurrentSpell(AutoAttack:GetID()) and Player:InMelee(Target) and not Target:IsDead() then AutoAttack:Cast(Target) @@ -32,7 +59,7 @@ local function CombatRotation() local Stagger = UnitStagger("player") - if Stagger > 10000 and PurifyingBrew:IsKnownAndUsable() and PurifyingBrew:GetChargesRemaining() > 1 or (PurifyingBrew:GetNextChargeCooldown() <= 3 and PurifyingBrew:GetChargesRemaining() == 1) then + if Stagger > 10000 and PurifyingBrew:IsKnownAndUsable() and PurifyingBrew:GetChargesRemaining() > 1 or (PurifyingBrew:GetNextChargeCooldown() <= 2.5 and PurifyingBrew:GetChargesRemaining() == 1) then PurifyingBrew:Cast(Player) end @@ -40,21 +67,28 @@ local function CombatRotation() return CelestialBrew:Cast(Player) end + local ExpelHarmHeal = GetExpelHarmHealAmount() + if not Player:InMelee(Target) then if not Player:GetAuras():FindMy(RushingJadeWind):IsUp() and RushingJadeWind:IsKnownAndUsable() then return RushingJadeWind:Cast(Player) end - if ChiWave:IsKnownAndUsable() and Target:Exists() and ChiWave:IsInRange(Target) then + if ChiWave:IsKnownAndUsable() and Target:Exists() and ChiWave:IsInRange(Target) and Player:IsFacing(Target) then return ChiWave:Cast(Target) end end - if BreathOfFire:IsKnownAndUsable() and BreathOfFire:IsInRange(Target) then + if BreathOfFire:IsKnownAndUsable() and BreathOfFire:IsInRange(Target) and Player:IsFacing(Target) then return BreathOfFire:Cast(Player) end - if KegSmash:IsKnownAndUsable() and Target:Exists() and KegSmash:IsInRange(Target) and (KegSmash:GetChargesRemaining() == KegSmash:GetMaxCharges() or (KegSmash:GetChargesRemaining() == (KegSmash:GetMaxCharges() - 1)) and KegSmash:GetNextChargeCooldown() <= 2) then - return KegSmash:Cast(Target) + if KegSmash:IsKnownAndUsable() and Target:Exists() and KegSmash:IsInRange(Target) and Player:IsFacing(Target) then + if KegSmash:GetChargesRemaining() == KegSmash:GetMaxCharges() then + return KegSmash:Cast(Target) + end + if KegSmash:GetChargesRemaining() == KegSmash:GetMaxCharges() - 1 and KegSmash:GetNextChargeCooldown() <= 3 then + return KegSmash:Cast(Target) + end end if WeaponsOfOrder:IsKnownAndUsable() and CDsEnabled then @@ -64,16 +98,64 @@ local function CombatRotation() -- Exploding Keg in AOE here -- Rising Sun Kick In AOE here - if BlackoutKick:IsKnownAndUsable() and Target:Exists() and BlackoutKick:IsInRange(Target) then + if BlackoutKick:IsKnownAndUsable() and Target:Exists() and BlackoutKick:IsInRange(Target) and Player:IsFacing(Target) then return BlackoutKick:Cast(Target) end - if RisingSunKick:IsKnownAndUsable() and Target:Exists() and RisingSunKick:IsInRange(Target) then + if RisingSunKick:IsKnownAndUsable() and Target:Exists() and RisingSunKick:IsInRange(Target) and Player:IsFacing(Target) then return RisingSunKick:Cast(Target) end -- Exploding Keg in ST here + if ChiWave:IsKnownAndUsable() and Target:Exists() and ChiWave:IsInRange(Target) then + return ChiWave:Cast(Target) + end + + if RushingJadeWind:IsKnownAndUsable() and (not Player:GetAuras():FindMy(RushingJadeWind):IsUp() or Player:GetAuras():FindMy(RushingJadeWind):GetRemainingTime() <= 2) then + return RushingJadeWind:Cast(Player) + end + + if not isAoe and TigerPalm:IsKnownAndUsable() and Target:Exists() and TigerPalm:IsInRange(Target) and Player:IsFacing(Target) then + if not KegSmash:IsKnown() then + return TigerPalm:Cast(Target) + else + local TigerPalmCost = GetSpellPowerCost(TigerPalm:GetID())[1]['cost'] + local KegSmashCost = GetSpellPowerCost(KegSmash:GetID())[1]['cost'] + local CurrentEnergy = Player:GetPower(Enum.PowerType.Energy) + + local CanKegSmash = KegSmash:GetChargesRemaining() > 0 or KegSmash:GetNextChargeCooldown() >= 2.5 + + if CanKegSmash then + if (CurrentEnergy - KegSmashCost) >= TigerPalmCost then + return TigerPalm:Cast(Target) + end + else + return TigerPalm:Cast(Target) + end + end + end + + if isAoe and SpinningCraneKick:IsKnownAndUsable() then + if not KegSmash:IsKnown() then + return SpinningCraneKick:Cast(Player) + else + local SpinningCraneKickCost = GetSpellPowerCost(SpinningCraneKick:GetID())[1]['cost'] + local KegSmashCost = GetSpellPowerCost(KegSmash:GetID())[1]['cost'] + local CurrentEnergy = Player:GetPower(Enum.PowerType.Energy) + + local CanKegSmash = KegSmash:GetChargesRemaining() > 0 or KegSmash:GetNextChargeCooldown() >= 2.5 + + if CanKegSmash then + if (CurrentEnergy - KegSmashCost) >= SpinningCraneKickCost then + return SpinningCraneKick:Cast(Player) + end + else + return SpinningCraneKick:Cast(Player) + end + end + end + return false end @@ -93,7 +175,7 @@ BrewModule:Sync(function() if not Player:IsAlive() or Player:IsMounted() then return false end - + if Player:IsAffectingCombat() or IsCurrentSpell(AutoAttack:GetID()) then -- Combat Rotation return CombatRotation()