local Tinkr, _Bastion = ... ---@type Bastion local Bastion = _Bastion local BrewModule = Bastion.Module:New('brewmaster') local Player = Bastion.UnitManager:Get('player') local Target = Bastion.UnitManager:Get('target') local None = Bastion.UnitManager:Get('none') local PurifyingBrew = Bastion.SpellBook:GetSpell(119582) local CelestialBrew = Bastion.SpellBook:GetSpell(322507) local PurifiedChi = Bastion.SpellBook:GetSpell(325092) local AutoAttack = Bastion.SpellBook:GetSpell(6603) local ImpCelestialBrew = Bastion.SpellBook:GetSpell(322510) local ChiWave = Bastion.SpellBook:GetSpell(115098) local RushingJadeWind = Bastion.SpellBook:GetSpell(116847) local BreathOfFire = Bastion.SpellBook:GetSpell(115181) 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) end local Stagger = UnitStagger("player") if Stagger > 10000 and PurifyingBrew:IsKnownAndUsable() and PurifyingBrew:GetChargesRemaining() > 1 or (PurifyingBrew:GetNextChargeCooldown() <= 2.5 and PurifyingBrew:GetChargesRemaining() == 1) then PurifyingBrew:Cast(Player) end if CelestialBrew:IsKnownAndUsable() and (not ImpCelestialBrew:IsKnown() or (ImpCelestialBrew:IsKnown() and Player:GetAuras():FindMy(PurifiedChi):IsUp())) then 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) and Player:IsFacing(Target) then return ChiWave:Cast(Target) end end 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 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 return WeaponsOfOrder:Cast(Player) end -- Exploding Keg in AOE here -- Rising Sun Kick In AOE here 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) 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 ---@return boolean local function OutOfCombatRotation() return false end local isRunning = false BrewModule:Sync(function() if not isRunning then Bastion:Print('Brewmaster Started') isRunning = true end if not Player:IsAlive() or Player:IsMounted() then return false end if Player:IsAffectingCombat() or IsCurrentSpell(AutoAttack:GetID()) then -- Combat Rotation return CombatRotation() else -- Out Of Combat Rotation return OutOfCombatRotation() end end) Bastion:Register(BrewModule)