mirror of
https://github.com/brues-code/SuperCleveRoidMacros.git
synced 2026-09-16 03:38:00 +00:00
update immunity of cc spells not mistaken for immunity to dmg type
This commit is contained in:
+20
-2
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
+29
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user