fix range on self cast spells

This commit is contained in:
Jrc13245
2025-12-21 15:15:32 -05:00
parent 6c9f5f0dbd
commit 7f7e27ccf1
+11 -1
View File
@@ -1544,10 +1544,20 @@ function API.IsSpellInRange(spellIdentifier, unit)
local result = IsSpellInRange(checkValue, unit)
-- result == 1 (in range), 0 (out of range), -1 (invalid/non-unit-targeted), nil (error)
-- Only use native result for definitive answers (0 or 1)
-- Fall through to UnitXP fallback for -1 (ground-targeted spells like Blizzard)
if result == 0 or result == 1 then
return result
end
-- For -1 (non-unit-targeted), check if it's a self-only spell
-- Self-targeted spells (rangeIndex 0) should always be considered in range
if result == -1 and spellId and spellId > 0 then
local rangeIndex = API.GetSpellField(spellId, "rangeIndex")
-- rangeIndex 0 = Self Only, 14 = Self Only (alternate), 23 = Touch
if rangeIndex == 0 or rangeIndex == 14 or rangeIndex == 23 then
return 1 -- Self-targeted spells are always in range
end
-- For other -1 cases (ground-targeted like Blizzard), fall through to UnitXP
end
end
-- Fallback: Use spell range from record + UnitXP distance check