Detect Banish via C_UnitAuras.GetUnitAuraBySpellID, not slot scan

The Banish immunity check hand-scanned 16 debuff slots plus 32 buff slots
(NPC overflow) for spellID 710/18647. ClassicAPI.GetUnitAuraBySpellID walks
the whole aura array in one call per rank, so it finds the debuff wherever it
lands -- including an NPC's overflow buff slots -- dropping the two loops and
the UnitIsPlayer gate. Wrapper added alongside UnitHasDispelType.
This commit is contained in:
Brues
2026-07-28 09:12:29 -05:00
parent dd61767eb9
commit d82eeabf22
2 changed files with 19 additions and 25 deletions
+6 -25
View File
@@ -8629,31 +8629,12 @@ function CleveRoids.CheckImmunity(unitId, spellOrSchool)
-- Universal debuff-based immunities (Banish, etc.)
-- Banish makes target immune to most damage schools (not all spells)
do
local hasBanish = false
-- Check debuffs first (Banish: 710 = Rank 1, 18647 = Rank 2)
for i = 1, 16 do
local texture, stacks, dtype, spellID = UnitDebuff(unitId, i)
if not texture then break end
if spellID == 710 or spellID == 18647 then
hasBanish = true
break
end
end
-- Overflow handling: debuffs can overflow into buffs on NPCs
if not hasBanish and not UnitIsPlayer(unitId) then
for i = 1, 32 do
local texture, stacks, spellID = UnitBuff(unitId, i)
if not texture then break end
if spellID == 710 or spellID == 18647 then
hasBanish = true
break
end
end
end
-- Banish: 710 = Rank 1, 18647 = Rank 2. One by-spellID lookup each --
-- C_UnitAuras walks the whole aura array, so it finds the debuff even when
-- it has overflowed into an NPC's buff slots (no manual slot scan / overflow gate).
local API = CleveRoids.ClassicAPI
local hasBanish = (API.GetUnitAuraBySpellID(unitId, 710)
or API.GetUnitAuraBySpellID(unitId, 18647)) and true or false
-- If Banished, check what's being tested for immunity
if hasBanish then