From 765256642affa2d2ae97d8e74ce5932fbc945009 Mon Sep 17 00:00:00 2001 From: Jrc13245 Date: Tue, 31 Mar 2026 20:04:13 -0400 Subject: [PATCH] update immunity of cc spells not mistaken for immunity to dmg type --- Conditionals.lua | 22 ++++++++++++++++++++-- Core.lua | 14 +++++++++----- Utility.lua | 29 +++++++++++++++++++++++++++++ 3 files changed, 58 insertions(+), 7 deletions(-) diff --git a/Conditionals.lua b/Conditionals.lua index 5259991..a345127 100644 --- a/Conditionals.lua +++ b/Conditionals.lua @@ -1178,8 +1178,26 @@ local function OnAuraCastSelf(spellId, casterGuid, targetGuid, effect, effectAur if not inVisibleSlot then local entry = CleveRoids.OverflowBuffs[spellId] if not entry then - entry = {} + entry = { stacks = 1 } CleveRoids.OverflowBuffs[spellId] = entry + else + -- Increment stacks on repeated AURA_CAST for the same overflow spell. + -- Cap at DBC stackAmount to handle refresh-at-max-stacks correctly. + local maxStacks + if _G.GetSpellRecField then + maxStacks = _G.GetSpellRecField(spellId, "stackAmount") + end + if maxStacks and maxStacks > 0 then + -- Stacking spell: increment up to cap + local cur = (entry.stacks or 1) + if cur < maxStacks then + entry.stacks = cur + 1 + end + elseif not maxStacks then + -- No DBC data: increment without cap (assume stacking) + entry.stacks = (entry.stacks or 1) + 1 + end + -- maxStacks == 0: non-stacking spell, leave stacks at 1 end entry.timestamp = now entry.durationSec = durationMs and (durationMs / 1000) or 0 @@ -3898,7 +3916,7 @@ function CleveRoids.ValidateAura(unit, args, isbuff) end if match then found = true - stacks = 0 + stacks = entry.stacks or 1 -- Compute remaining time from apply timestamp + duration if entry.durationSec and entry.durationSec > 0 then remaining = entry.durationSec - elapsed diff --git a/Core.lua b/Core.lua index 59f8e59..dc5c248 100644 --- a/Core.lua +++ b/Core.lua @@ -968,10 +968,10 @@ function CleveRoids.TestForActiveAction(actions) if IsSpellInRange then local unit = actions.active.conditionals and actions.active.conditionals.target or "target" if unit == "focus" then - unit = CleveRoids.GetFocusUnitId() or unit + unit = CleveRoids.GetFocusUnitId() elseif unit == "focustarget" then local focusUnit = CleveRoids.GetFocusUnitId() - if focusUnit then unit = focusUnit .. "target" end + unit = focusUnit and (focusUnit .. "target") or nil end local resolvedMark = CleveRoids.ResolveRaidMarkUnit(unit) if resolvedMark then unit = resolvedMark end @@ -1692,11 +1692,15 @@ end -- Resolves pfUI's emulated focus to a real unit token (e.g., "party2", "raid5") -- Returns the resolved token or nil if focus is not available -function CleveRoids.GetFocusUnitId() +-- warn: if true, prints a chat message when no focus addon is installed +function CleveRoids.GetFocusUnitId(warn) if pfUI and pfUI.uf and pfUI.uf.focus and pfUI.uf.focus.label and pfUI.uf.focus.id and UnitExists(pfUI.uf.focus.label .. pfUI.uf.focus.id) then return pfUI.uf.focus.label .. pfUI.uf.focus.id end + if warn and not pfUI and not ClassicFocus_CurrentFocus and not CURR_FOCUS_TARGET then + DEFAULT_CHAT_FRAME:AddMessage("|cffff6600SuperCleveRoidMacros:|r [focus] target requires pfUI or a compatible focus addon.", 1, 0.4, 0) + end return nil end @@ -2468,7 +2472,7 @@ function CleveRoids.DoWithConditionals(msg, hook, fixEmptyTargetFunc, targetBefo if conditionals.target == "focus" or conditionals.target == "focustarget" then local isFocusTarget = conditionals.target == "focustarget" - local focusUnitId = CleveRoids.GetFocusUnitId() + local focusUnitId = CleveRoids.GetFocusUnitId(true) if focusUnitId then -- Use the resolved pfUI unit token directly (avoids changing the player's target) @@ -2847,7 +2851,7 @@ function CleveRoids.DoTarget(msg) if unitTok == "focus" or unitTok == "focustarget" then local isFocusTarget = unitTok == "focustarget" - local fTok = CleveRoids.GetFocusUnitId() + local fTok = CleveRoids.GetFocusUnitId(true) if fTok then unitTok = fTok .. (isFocusTarget and "target" or "") if not UnitExists(unitTok) then unitTok = nil end diff --git a/Utility.lua b/Utility.lua index ba59446..827b2de 100644 --- a/Utility.lua +++ b/Utility.lua @@ -7644,6 +7644,23 @@ end -- Get CC type from a spell ID using the CCSpellMechanics table from Conditionals.lua -- Returns: CC type name (e.g., "stun", "fear") or nil if not a CC spell +-- EffectApplyAuraName → CC type mapping (fallback when mechanics are unset) +-- Uses vanilla 1.12.1 aura type enum values +-- Note: some CC types share aura IDs (e.g., sleep uses MOD_STUN + sleep mechanic, +-- horror uses MOD_FEAR + horror mechanic). Those are caught by mechanic lookup; +-- this table handles spells where mechanics are 0 but the aura effect is CC. +local AURA_NAME_TO_CC_TYPE = { + [1] = "charm", -- SPELL_AURA_BIND_SIGHT + [2] = "charm", -- SPELL_AURA_MOD_POSSESS_PET + [5] = "polymorph", -- SPELL_AURA_MOD_CONFUSE (disorient/polymorph) + [7] = "fear", -- SPELL_AURA_MOD_FEAR (also horror with mechanic 24) + [11] = "root", -- SPELL_AURA_MOD_ROOT + [12] = "stun", -- SPELL_AURA_MOD_STUN (also sleep/sap/banish with their mechanics) + [27] = "silence", -- SPELL_AURA_MOD_SILENCE + [31] = "charm", -- SPELL_AURA_MOD_POSSESS + [33] = "snare", -- SPELL_AURA_MOD_DECREASE_SPEED +} + local function GetSpellCCType(spellID) if not spellID or spellID <= 0 then return nil end @@ -7665,6 +7682,18 @@ local function GetSpellCCType(spellID) end end end + + -- Priority 1b: effectApplyAuraName fallback (catches spells with CC aura + -- effects but no mechanic set, e.g., Repentance applying MOD_STUN) + local auraNames = GetSpellRecField(spellID, "effectApplyAuraName") + if auraNames then + for i = 1, 3 do + local an = auraNames[i] + if an and an > 0 and AURA_NAME_TO_CC_TYPE[an] then + return AURA_NAME_TO_CC_TYPE[an] + end + end + end end -- Priority 2: Hardcoded table fallback (CCSpellMechanics in Conditionals.lua)