From 8052fba9e2751c0819126c0490e74fa1c89f455a Mon Sep 17 00:00:00 2001 From: Emlembow <36314674+Emlembow@users.noreply.github.com> Date: Tue, 3 Sep 2024 19:31:18 -0700 Subject: [PATCH] 4/10 Needs a lot of work but it works fo rnow --- MistweaverMonk.lua | 252 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 252 insertions(+) create mode 100644 MistweaverMonk.lua diff --git a/MistweaverMonk.lua b/MistweaverMonk.lua new file mode 100644 index 0000000..042910f --- /dev/null +++ b/MistweaverMonk.lua @@ -0,0 +1,252 @@ +--Talents: C4QAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGzCzsMmxMmxM2w2sMbjHAz2yyMzyCImZgZYmFDsMzMDzGzMMLzEAAAAAEgFLz22sNzMBAA2A + +local Tinkr, Bastion = ... + +local RestoMonkModule = Bastion.Module:New('MistweaverMonk') +local Player = Bastion.UnitManager:Get('player') +local Target = Bastion.UnitManager:Get('target') + +-- Initialize SpellBook +local SpellBook = Bastion.SpellBook:New() + +-- Spells +local RenewingMist = SpellBook:GetSpell(115151) +local EnvelopingMist = SpellBook:GetSpell(124682) +local Vivify = SpellBook:GetSpell(116670) +local RisingSunKick = SpellBook:GetSpell(107428) +local ThunderFocusTea = SpellBook:GetSpell(116680) +local TigerPalm = SpellBook:GetSpell(100780) +local BlackoutKick = SpellBook:GetSpell(100784) +local SpinningCraneKick = SpellBook:GetSpell(101546) +local Revival = SpellBook:GetSpell(115310) +local Restoral = SpellBook:GetSpell(388615) +local InvokeYulon = SpellBook:GetSpell(322118) +local InvokeChiJi = SpellBook:GetSpell(325197) +local SoothingMist = SpellBook:GetSpell(115175) +local ManaTea = SpellBook:GetSpell(197908) +local CelestialConduit = SpellBook:GetSpell(443028) +local FortifyingBrew = SpellBook:GetSpell(243435) +local DiffuseMagic = SpellBook:GetSpell(122783) +local LifeCocoon = SpellBook:GetSpell(116849) +local JadefireStomp = SpellBook:GetSpell(388193) +local SheilunsGift = SpellBook:GetSpell(399491) + + +-- Buffs +local TeachingsOfTheMonastery = SpellBook:GetSpell(202090) +local StrengthOfTheBlackOx = SpellBook:GetSpell(392883) + +-- Custom Units +local Lowest = Bastion.UnitManager:CreateCustomUnit('lowest', function(unit) + local lowest = nil + local lowestHP = math.huge + + Bastion.UnitManager:EnumFriends(function(unit) + if unit:IsDead() or Player:GetDistance(unit) > 40 or not Player:CanSee(unit) then + return false + end + + local hp = unit:GetHP() + if hp < lowestHP then + lowest = unit + lowestHP = hp + end + end) + + return lowest or Player +end) + +-- APLs +local DefaultAPL = Bastion.APL:New('default') +local CooldownAPL = Bastion.APL:New('cooldown') +local DefensiveAPL = Bastion.APL:New('defensive') +local DpsAPL = Bastion.APL:New('dps') + +-- Helper Functions +local function ShouldUseRenewingMist() + return RenewingMist:GetCharges() >= 2 +end + +local function ShouldUseEnvelopingMist() + return Player:GetAuras():FindMy(StrengthOfTheBlackOx):IsUp() +end + +local function NeedsUrgentHealing() + return Lowest:GetHP() < 70 or Player:GetPartyHPAround(30, 80) >= 3 +end + +-- Default APL +DefaultAPL:AddSpell( + SheilunsGift:CastableIf(function(self) + return self:IsKnownAndUsable() and not Player:IsCastingOrChanneling() + and Player:GetPartyHPAround(40, 80) >= 3 + end):SetTarget(Player) +) + +DefaultAPL:AddSpell( + Vivify:CastableIf(function(self) + return Lowest:Exists() and Lowest:GetHP() < 70 and self:IsKnownAndUsable() and not Player:IsCastingOrChanneling() + end):SetTarget(Lowest) +) + +DefaultAPL:AddSpell( + RenewingMist:CastableIf(function(self) + return ShouldUseRenewingMist() and self:IsKnownAndUsable() and not Player:IsCastingOrChanneling() + end):SetTarget(Lowest) +) + +DefaultAPL:AddSpell( + RisingSunKick:CastableIf(function(self) + return Target:Exists() and self:IsKnownAndUsable() and not Player:IsCastingOrChanneling() + end):SetTarget(Target) +) + +DefaultAPL:AddSpell( + ThunderFocusTea:CastableIf(function(self) + return self:IsKnownAndUsable() and not Player:IsCastingOrChanneling() + end):SetTarget(Player) +) + +DefaultAPL:AddSpell( + EnvelopingMist:CastableIf(function(self) + return Lowest:Exists() and ShouldUseEnvelopingMist() and self:IsKnownAndUsable() and not Player:IsCastingOrChanneling() + end):SetTarget(Lowest) +) + +DefaultAPL:AddSpell( + TigerPalm:CastableIf(function(self) + return Target:Exists() and self:IsKnownAndUsable() and not Player:IsCastingOrChanneling() + end):SetTarget(Target) +) + +-- Cooldown APL +CooldownAPL:AddSpell( + CelestialConduit:CastableIf(function(self) + return self:IsKnownAndUsable() and not Player:IsCastingOrChanneling() + and Player:GetPartyHPAround(40, 70) >= 3 + end):SetTarget(Player) +) + +CooldownAPL:AddSpell( + InvokeChiJi:CastableIf(function(self) + return self:IsKnownAndUsable() and not Player:IsCastingOrChanneling() + and Player:GetPartyHPAround(40, 85) >= 2 + end):SetTarget(Player) +) + +CooldownAPL:AddSpell( + InvokeYulon:CastableIf(function(self) + return self:IsKnownAndUsable() and not Player:IsCastingOrChanneling() + and Player:GetPartyHPAround(40, 75) >= 3 + end):SetTarget(Player) +) + +CooldownAPL:AddSpell( + ManaTea:CastableIf(function(self) + return self:IsKnownAndUsable() and not Player:IsCastingOrChanneling() + and Player:GetMana() < 50 + end):SetTarget(Player) +) + +-- Defensive APL +DefensiveAPL:AddSpell( + FortifyingBrew:CastableIf(function(self) + return self:IsKnownAndUsable() and not Player:IsCastingOrChanneling() + and Player:GetHP() < 50 + end):SetTarget(Player) +) + +DefensiveAPL:AddSpell( + DiffuseMagic:CastableIf(function(self) + return self:IsKnownAndUsable() and not Player:IsCastingOrChanneling() + and Player:GetHP() < 70 + end):SetTarget(Player) +) + +DefensiveAPL:AddSpell( + LifeCocoon:CastableIf(function(self) + return Lowest:Exists() and self:IsKnownAndUsable() and not Player:IsCastingOrChanneling() + and Lowest:GetHP() < 40 + end):SetTarget(Lowest) +) + +-- DPS APL +DpsAPL:AddSpell( + JadefireStomp:CastableIf(function(self) + return self:IsKnownAndUsable() and not Player:IsCastingOrChanneling() + end):SetTarget(Player) +) + +DpsAPL:AddSpell( + RisingSunKick:CastableIf(function(self) + return self:IsKnownAndUsable() and not Player:IsCastingOrChanneling() + and Player:IsWithinCombatDistance(Target, 5) -- Assuming 5 is melee range + end):SetTarget(Target) +) + +DpsAPL:AddSpell( + SpinningCraneKick:CastableIf(function(self) + return self:IsKnownAndUsable() and not Player:IsCastingOrChanneling() + and Player:GetEnemies(8) >= 2 + end):SetTarget(Player) +) + +DpsAPL:AddSpell( + BlackoutKick:CastableIf(function(self) + return self:IsKnownAndUsable() and not Player:IsCastingOrChanneling() + and Player:IsWithinCombatDistance(Target, 5) + end):SetTarget(Target) +) + +DpsAPL:AddSpell( + TigerPalm:CastableIf(function(self) + return self:IsKnownAndUsable() and not Player:IsCastingOrChanneling() + and Player:IsWithinCombatDistance(Target, 5) + and Player:GetAuras():FindMy(TeachingsOfTheMonastery):GetCount() < 3 + end):SetTarget(Target) +) + +DpsAPL:AddSpell( + SpinningCraneKick:CastableIf(function(self) + return self:IsKnownAndUsable() and not Player:IsCastingOrChanneling() + and Player:GetEnemies(8) >= 3 + end):SetTarget(Player) +) + + + +-- Module Sync +RestoMonkModule:Sync(function() + if Player:IsMounted() then + return + end + + if Player:IsAffectingCombat() then + DefensiveAPL:Execute() + + -- Prioritize DPS in Mythic+, but still maintain healing + if NeedsUrgentHealing() then + CooldownAPL:Execute() + DefaultAPL:Execute() + else + DpsAPL:Execute() + + -- Weave in essential healing abilities + if RenewingMist:GetCharges() >= 2 then + RenewingMist:Cast(Lowest) + end + + if Vivify:IsKnownAndUsable() and Lowest:GetHP() < 80 then + Vivify:Cast(Lowest) + end + end + else + -- Out of combat logic + if Lowest:GetHP() < 90 then + DefaultAPL:Execute() + end + end +end) + +Bastion:Register(RestoMonkModule) +