Match buff-based immunity via C_UnitAuras.GetAuraDataBySpellName

Replaces the 32-slot UnitBuff + C_Spell.GetSpellName name-compare loop with a
single ClassicAPI.GetAuraDataBySpellName(unit, name, "HELPFUL") lookup.
Locale-identical to the old compare (both use the localized Spell.dbc name).
Wrapper added next to GetUnitAuraBySpellID.
This commit is contained in:
Brues
2026-07-28 09:16:33 -05:00
parent d82eeabf22
commit da8ea22998
2 changed files with 17 additions and 15 deletions
+4 -15
View File
@@ -8800,23 +8800,12 @@ function CleveRoids.CheckImmunity(unitId, spellOrSchool)
end
end
-- Check buff-based immunity (if NPC has the required buff)
-- Check buff-based immunity (if NPC has the required buff). One by-name
-- lookup across the unit's buffs via C_UnitAuras -- no 32-slot scan.
if immunityData.buff then
local requiredBuff = immunityData.buff
-- Check target's buffs
for i = 1, 32 do
local texture, stacks, spellID = UnitBuff(unitId, i)
if not texture then break end
if spellID then
local buffName = C_Spell.GetSpellName(spellID)
if buffName and buffName == requiredBuff then
return true
end
end
if CleveRoids.ClassicAPI.GetAuraDataBySpellName(unitId, immunityData.buff, "HELPFUL") then
return true
end
-- Buff not found, not currently immune
return false
end