From 7f7e27ccf1264f70744478e7a52ee4b65cf60d8a Mon Sep 17 00:00:00 2001 From: Jrc13245 Date: Sun, 21 Dec 2025 15:15:32 -0500 Subject: [PATCH] fix range on self cast spells --- NampowerAPI.lua | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/NampowerAPI.lua b/NampowerAPI.lua index 85d445b..6e9ef0c 100644 --- a/NampowerAPI.lua +++ b/NampowerAPI.lua @@ -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