From 7dddf66cb07d73a56e717d125b47b66922ab415c Mon Sep 17 00:00:00 2001 From: Ryan Crockett Date: Wed, 8 Mar 2023 10:04:17 -0500 Subject: [PATCH] Some prot tweaks, modify kick & stop utils --- scripts/paladin/paladin_protection.lua | 6 +- src/MythicPlusUtils/MythicPlusUtils.lua | 689 ++++++++++++------------ 2 files changed, 334 insertions(+), 361 deletions(-) diff --git a/scripts/paladin/paladin_protection.lua b/scripts/paladin/paladin_protection.lua index 9493f6e..23c209e 100644 --- a/scripts/paladin/paladin_protection.lua +++ b/scripts/paladin/paladin_protection.lua @@ -16,7 +16,7 @@ local Judgement = Bastion.SpellBook:GetSpell(275779) local AvengersShield = Bastion.SpellBook:GetSpell(31935) local OfDuskAndDawn = Bastion.SpellBook:GetSpell(385125) local BlessingOfTheDusk = Bastion.SpellBook:GetSpell(385126) -local BlessingOfTheDawn = Bastion.SpellBook:GetSpell(337747) +local BlessingOfTheDawn = Bastion.SpellBook:GetSpell(385127) local ShieldOfTheRighteous = Bastion.SpellBook:GetSpell(53600) local BlessedHammer = Bastion.SpellBook:GetSpell(204019) local AutoAttack = Bastion.SpellBook:GetSpell(6603) @@ -51,7 +51,7 @@ local AvengersShieldTarget = Bastion.UnitManager:CreateCustomUnit('avengersshiel return false end - if unit:IsCastingOrChanneling() then + if unit:IsCastingOrChanneling() and unit:IsInterruptibleAt(5) then target = unit return true end @@ -124,7 +124,7 @@ local function CombatRotation() return Consecrate:Cast(Player) end - if WoG:IsKnownAndUsable() and Player:GetAuras():FindMy(ShinningLight):IsUp() and Player:GetHealthPercent() <= 51 and not Player:IsCastingOrChanneling() then + if WoG:IsKnownAndUsable() and Player:GetAuras():FindMy(ShinningLight):IsUp() and Player:GetHealthPercent() <= 50 and not Player:IsCastingOrChanneling() then return WoG:Cast(Player) end diff --git a/src/MythicPlusUtils/MythicPlusUtils.lua b/src/MythicPlusUtils/MythicPlusUtils.lua index e517e00..c570dba 100644 --- a/src/MythicPlusUtils/MythicPlusUtils.lua +++ b/src/MythicPlusUtils/MythicPlusUtils.lua @@ -2,12 +2,7 @@ local Tinkr, Bastion = ... ---@class MythicPlusUtils local MythicPlusUtils = { - debuffLogging = false, - castLogging = false, - random = '', - loggedCasts = {}, - loggedDebuffs = {}, - kickList = {}, + interruptList = {}, } MythicPlusUtils.__index = MythicPlusUtils @@ -16,463 +11,442 @@ MythicPlusUtils.__index = MythicPlusUtils function MythicPlusUtils:New() local self = setmetatable({}, MythicPlusUtils) - self.random = math.random(1000000, 9999999) - self.kickList = { - -- Ruby life pools - [372735] = { -- Techtonic Slam - [187969] = { - false, true, true -- Kick, Stun, Disorient + self.interruptList = { + -- kick, stun, disorient, incap + -- + -- Hals of Valor + -- + -- Thunder Caller + [95842] = { + -- Thunderous Blast + [198585] = { + true, true, true, true } }, - [384933] = { -- Ice Shield - [188067] = { - true, true, true + -- Mystic + [95834] = { + -- Holy Radiance + [215433] = { + true, true, true, true } }, - [372749] = { -- Ice Shield - [188067] = { - true, true, true + -- Runcarver + [96664] = { + -- Etch + [198959] = { + true, true, true, true } }, - [372743] = { -- Ice Shield - [188067] = { - true, true, true + -- Marksman + [96640] = { + -- Penetrating Shot + [199210] = { + false, true, true, true } }, - [371984] = { - [188067] = { - true, true, true + -- Shieldmaiden + [95832] = { + -- Mortal Hew + [199050] = { + false, true, true, false } }, - [373680] = { - [188252] = { - true, false, false + -- Shieldmaiden 2 + [101639] = { + -- Mortal Hew + [199050] = { + false, true, false, false } }, - [373688] = { - [188252] = { - true, false, false - } - }, - [385310] = { - [195119] = { - true, false, false + -- Odyn Add + [102019] = { + -- Surge + [198750] = { + true, false, false, false } }, - [384194] = { - [190207] = { + -- + -- Court of Stars + -- + -- Duskwatch Guard + [111563] = { + -- Fortification + [209033] = { true, true, true } }, - [384197] = { - [190207] = { - true, true, true + -- Duskwatch Guard 2 + [104246] = { + -- Fortification + [209033] = { + true, true, false, false } }, - [373017] = { - [189886] = { - true, false, false + -- Sentry + [104251] = { + -- Sound the Alarm + [210261] = { + true, true, true, true } }, - [392576] = { - [198047] = { + -- Construct + [104270] = { + -- Suppress + [209413] = { + true, false, false, false + }, + -- Charging Station + [225100] = { true, false, false } }, - [392451] = { - [197985] = { - true, true, false, - } - }, - [392452] = { - [197985] = { - true, true, false, - } - }, - -- Nokhud - [383823] = { - [192796] = { - false, true, true + -- Bound Energy + [105705] = { + -- Charged Blast + [212031] = { + true, true, false, false } }, - [384492] = { - [192794] = { - false, true, true + -- Arcane Manifestation + [105704] = { + -- Drain Magic + [209485] = { + true, false, false, false } }, - [384365] = { - [192800] = { - true, false, false + -- Watchful Inquisitor + [105715] = { + -- Searing Glare + [211299] = { + true, false, false, false }, - [191847] = { - true, false, false + -- Eye Storm + [212784] = { + false, true, false, false } }, - [386012] = { - [194317] = { - true, false, false + -- Blazing Imp + [104295] = { + -- Drifting Embers + [211401] = { + true, true, true, false }, - [195265] = { - true, false, false - }, - [194315] = { - true, false, false + -- Drifting Embers 2 + [211406] = { + true, true, true, false }, - [194316] = { - true, false, false - } - - }, - [386028] = { - [195696] = { - true, false, false - } - }, - [386024] = { - [194894] = { - true, true, true - } - }, - [386025] = { - [194894] = { - true, true, true - } - }, - [387629] = { - [195876] = { - false, true, true - } - }, - [387608] = { - [195842] = { - false, true, true - } - }, - [387611] = { - [195842] = { - false, true, true + -- Fireball + [211412] = { + true, true, true, false } }, - [387440] = { - [195878] = { - false, true, true + -- Shadow Mistress + [104300] = { + -- Bewitch + [211470] = { + true, true, true, false } }, - [373395] = { - [199717] = { - true, false, false - } - }, - [376725] = { - [190294] = { - true, true, true + -- Balgarr + [104274] = { + -- Disintegration Beam + [207980] = { + true, false, false, false }, - }, - [370764] = { - [187160] = { - false, true, true - }, - [196116] = { - false, true, true - }, - }, - [387564] = { - [196102] = { - true, true, true - } - }, - [375596] = { - [196115] = { - true, false, false + -- Disintigration Beam 2 + [207981] = { + true, false, false, false }, - [191164] = { - true, false, false + -- Impending Doom + [397907] = { + true, false, false, false }, - - }, - [386549] = { - [186741] = { - true, true, true + -- Impending Doom 2 + [397908] = { + true, false, false, false } }, - [386546] = { - [186741] = { - true, true, true + -- Talixae Flamewreath + [104217] = { + -- Withering Soul + [208165] = { + true, false, false, false } }, - [389804] = { - [187154] = { - true, false, false - } - }, - [377488] = { - [187155] = { - true, true, true + -- + -- RLP + -- + -- Earthshaper + [187969] = { + -- Tectonic Slam + [372735] = { + false, true, true, true } }, - [377105] = { - [190510] = { - false, true, true - } - }, - [373932] = { - [190187] = { - true, false, false - } - }, - -- AA - [387910] = { - [196200] = { - false, true, true - } - }, - [387975] = { - [196202] = { - true, true, true + -- Chillweaver + [188067] = { + -- Ice Shield + [384933] = { + true, true, true, true + }, + -- Ice Shield 2 + [372749] = { + true, true, true, true + }, + -- Ice Shield 3 + [372743] = { + true, true, true, true } }, - [388863] = { - [196045] = { - true, true, true + -- Meledrusa + [188252] = { + -- Frost Overload + [373680] = { + true, false, false, false + }, + -- Frost Overload 2 + [373688] = { + true, false, false, false } }, - [388392] = { - [196044] = { - true, true, true + -- Cinderweaver + [190207] = { + -- Cinderbolt 1 + [384194] = { + true, false, false, false + }, + -- Cinderbolt 2 + [384197] = { + true, false, false, false } }, - [396812] = { - [196576] = { - true, true, true + -- Flame Dancer + [190206] = { + -- Flame Dance + [385536] = { + false, true, true, true } }, - [377389] = { - [192333] = { - true, false, false + -- Blazebound Firestorm + [189886] = { + -- Roaring Blaze + [373017] = { + true, false, false, false } }, - [397888] = { - [200126] = { - true, true, true + -- Tempest Channeler + [198047] = { + -- Thunder Bolt + [392576] = { + true, false, false, false } }, - [397801] = { - [56448] = { - true, false, false - } - }, - [395859] = { - [59555] = { - true, true, true - } + -- Flame Channeler + [197985] = { + -- Flashfire + [392451] = { + true, true, false, false + }, + -- Flashfire + [392452] = { + true, true, false, false + }, }, - [395872] = { - [59546] = { - true, false, false + -- + -- NO + -- + -- Hornsounder + [192796] = { + -- Rally The Clan + [383823] = { + false, true, true, true } }, - [396018] = { - [59552] = { - true, false, false + -- Plainstomper + [191847] = { + -- Disruptive Shout + [384365] = { + true, false, false, false } }, - [396073] = { - [59544] = { - true, true, false + -- Lancemaster + [192800] = { + -- Disruptive Shout + [384365] = { + true, false, false, false } }, - [397899] = { - [200131] = { - false, true, true + -- Arcblade + [194898] = { + -- Arcing Strike + [387135] = { + false, true, true, true } }, - [397914] = { - [200137] = { - true, true, true + -- Stormcaller Botoo + [194317] = { + -- Stormbolt + [386012] = { + true, false, false, false } }, - -- sbg - [152818] = { - [75713] = { - true, true, false + -- Thunderbeast + [195696] = { + -- Chain Lightning + [387127] = { + true, false, false, false } }, - [398154] = { - [75451] = { - false, true, true + [194894] = { + -- Tempest + [386025] = { + true, true, true, true + }, + -- Tempest 2 + [386024] = { + true, true, true, true + }, + -- Summon Squall + [386015] = { + true, true, true, true + }, + -- Stormbolt + [386012] = { + true, true, true, true } }, - [156776] = { - [76446] = { - true, true, true + -- Squall + [194895] = { + -- Surge + [386026] = { + true, true, false, false } }, - [156772] = { - [77700] = { - true, false, false + -- Stormcaller Arynga + [195265] = { + -- Stormbolt + [386012] = { + true, false, false, false } }, - [153524] = { - [75459] = { - true, true, true + -- Nokhud Neophyte + [196263] = { + -- Stormbolt + [386012] = { + true, true, false, false } }, - [156718] = { - [76104] = { - true, false, false + -- Stormcaller Solongo + [194315] = { + -- Stormbolt + [386012] = { + true, false, false, false } }, - [225100] = { - [104270] = { - true, false, false + -- Stormcaller Zarii + [194316] = { + -- Stormbolt + [386012] = { + true, false, false, false } }, - [210261] = { - [104251] = { - true, true, true + -- Soulharvester Galtmaa + [195927] = { + -- Death Bolt Volley + [387411] = { + true, false, false, false } }, - [209027] = { - [104246] = { - false, true, true + -- Soulharvester Tumen + [195929] = { + -- Death Bolt Volley + [387411] = { + true, false, false, false } }, - [212031] = { - [105705] = { - false, true, false + -- Soulharvester Mandakh + [195930] = { + -- Death Bolt Volley + [387411] = { + true, false, false, false } }, - [212784] = { - [105715] = { - false, true, false + -- Soulharvester Duuren + [195928] = { + -- Death Bolt Volley + [387411] = { + true, false, false, false } }, - [198585] = { - [95842] = { - true, true, true + -- Beastcaller + [195878] = { + -- Desecrated Roar + [387440] = { + true, true, true, true + }, + -- Heavy Slash + [387826] = { + false, true, true, true } }, - [198959] = { - [96664] = { - true, true, true + -- Mystic + [195877] = { + -- Swift Wind + [387596] = { + true, true, true, false } }, - [215433] = { - [95834] = { - true, true, true + -- Risen Warrior + [195855] = { + -- Mortal Strike + [388801] = { + false, true, true, false } }, - [199210] = { - [96640] = { - false, true, true + -- Teera + [186339] = { + -- Guardian Wind + [384808] = { + true, false, false, false } }, - [199090] = { - [96611] = { - false, true, true + -- Batak + [193462] = { + -- Bloodcurdling Shout + [373395] = { + true, false, false, false } }, - [185425] = { - [96677] = { - false, true, false + -- Balakar Add + [190294] = { + -- Storm Bolt + [376725] = { + true, true, true, true } - }, + } } - Bastion.EventManager:RegisterWoWEvent('UNIT_AURA', function(unit, auras) - if not self.debuffLogging then - return - end - - if auras.addedAuras then - local addedAuras = auras.addedAuras - - if #addedAuras > 0 then - for i = 1, #addedAuras do - local aura = Bastion.Aura:CreateFromUnitAuraInfo(addedAuras[i]) - - if not self.loggedDebuffs[aura:GetSpell():GetID()] and not aura:IsBuff() then - WriteFile('bastion-MPlusDebuffs-' .. self.random .. '.lua', [[ - AuraName: ]] .. aura:GetName() .. [[ - AuraID: ]] .. aura:GetSpell():GetID() .. "\n" .. [[ - ]], true) - end - end - end - end - end) - - Bastion.EventManager:RegisterWoWEvent('UNIT_SPELLCAST_START', function(unitTarget, castGUID, spellID) - if not self.castLogging then - return - end - - if self.loggedCasts[spellID] then - return - end - - local name = GetSpellInfo(spellID) - - self.loggedCasts[spellID] = true - - WriteFile('bastion-MPlusCasts-' .. self.random .. '.lua', [[ - CastName: ]] .. name .. [[ - CastID: ]] .. spellID .. "\n" .. [[ - ]], true) - end) - - Bastion.EventManager:RegisterWoWEvent('UNIT_SPELLCAST_CHANNEL_START', function(unitTarget, castGUID, spellID) - if not self.castLogging then - return - end - - if self.loggedCasts[spellID] then - return - end - - local name = GetSpellInfo(spellID) - - self.loggedCasts[spellID] = true - - WriteFile('bastion-MPlusCasts-' .. self.random .. '.lua', [[ - CastName: ]] .. name .. [[ - CastID: ]] .. spellID .. "\n" .. [[ - ]], true) - end) - return self end ----@return nil -function MythicPlusUtils:ToggleDebuffLogging() - self.debuffLogging = not self.debuffLogging -end - ----@return nil -function MythicPlusUtils:ToggleCastLogging() - self.castLogging = not self.castLogging -end - ---@param unit Unit ---@param percent number ---@return boolean function MythicPlusUtils:CastingCriticalKick(unit, percent) local castingSpell = unit:GetCastingOrChannelingSpell() - if castingSpell then + local npcSpells = self.interruptList[unit:GetID()] + + if npcSpells and castingSpell then local spellID = castingSpell:GetID() - local kickEntry = self.kickList[spellID] - if not kickEntry then - return false - end - local npcTraits = kickEntry[unit:GetID()] + local spellTraits = npcSpells[spellID] - if not npcTraits then + if not spellTraits then return false end - local isKick, isStun, isDisorient = unpack(npcTraits) + local isKick, isStun, isDisorient, isIncap = table.unpack(spellTraits) if isKick and unit:IsInterruptibleAt(percent) then return true @@ -484,31 +458,30 @@ end ---@param unit Unit ---@param percent number ----@return boolean -function MythicPlusUtils:CastingCriticalStun(unit, percent) +---@return boolean, boolean, boolean +function MythicPlusUtils:CastingCriticalStop(unit, percent) local castingSpell = unit:GetCastingOrChannelingSpell() - if castingSpell then + local npcSpells = self.interruptList[unit:GetID()] + + if npcSpells and castingSpell then local spellID = castingSpell:GetID() - local kickEntry = self.kickList[spellID] - if not kickEntry then - return false - end - local npcTraits = kickEntry[unit:GetID()] + local spellTraits = npcSpells[spellID] - if not npcTraits then - return false + if not spellTraits then + return false, false, false end - local isKick, isStun, isDisorient = unpack(npcTraits) + local isKick, isStun, isDisorient, isIncap = table.unpack(spellTraits) - if (isStun or isDisorient) and not isKick and unit:IsInterruptibleAt(percent, true) then - return true + local castPercent = unit:GetChannelOrCastPercentComplete() + if (isStun or isDisorient or isIncap) and not isKick and castPercent >= percent then + return isStun, isDisorient, isIncap end end - return false + return false, false, false end return MythicPlusUtils