From b4a442e23aae13d887361f0e81966c727d99f6a0 Mon Sep 17 00:00:00 2001 From: Jrc13245 Date: Sun, 8 Mar 2026 12:49:52 -0400 Subject: [PATCH] fix target by class with no target selected --- Core.lua | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/Core.lua b/Core.lua index 880fc16..08dba97 100644 --- a/Core.lua +++ b/Core.lua @@ -2941,6 +2941,39 @@ function CleveRoids.DoTarget(msg) end end + -- TargetNearestEnemy() fallback: cycles through enemies via tab-targeting + -- Finds enemy players that UnitXP may miss (e.g. [class:Rogue harm]) + if not wantsFriendlyOnly then + TargetNearestEnemy() + if UnitExists("target") then + local firstGuid2 = CleveRoids.GetGUID("target") + if firstGuid2 then + if IsGuidValid("target", conditionals) then + return true + end + + for i = 1, 50 do + TargetNearestEnemy() + if not UnitExists("target") then break end + + local guid = CleveRoids.GetGUID("target") + if not guid or guid == firstGuid2 then break end + + if IsGuidValid("target", conditionals) then + return true + end + end + end + end + + -- No match found - restore original target + if originalTargetGuid and UnitExists(originalTargetGuid) then + TargetUnit(originalTargetGuid) + elseif not originalTargetGuid then + ClearTarget() + end + end + return true end