From 2f698403e53b6f45e2c940a410884cdc585247b1 Mon Sep 17 00:00:00 2001 From: Jrc13245 Date: Fri, 6 Mar 2026 17:35:44 -0500 Subject: [PATCH] fix showtooltip icon for multiple evaluation keywords --- Conditionals.lua | 5 +++++ Core.lua | 11 +++++++++++ 2 files changed, 16 insertions(+) diff --git a/Conditionals.lua b/Conditionals.lua index 58f9266..ddf573e 100644 --- a/Conditionals.lua +++ b/Conditionals.lua @@ -2838,6 +2838,11 @@ end function CleveRoids.GetCountModeArgs(conditionalValue) if type(conditionalValue) ~= "table" then return nil end + -- During tooltip/icon evaluation (TestAction), skip count mode to avoid + -- target cycling side effects from CountEnemiesMatching. Keyword handlers + -- fall through to their single-target behavior instead. + if CleveRoids._isTestingAction then return nil end + local args = conditionalValue[1] if type(args) == "table" and args.operator and args.amount then return args diff --git a/Core.lua b/Core.lua index dde57a6..9e6644d 100644 --- a/Core.lua +++ b/Core.lua @@ -2255,11 +2255,18 @@ function CleveRoids.TestAction(cmd, args) CleveRoids.FixEmptyTarget(conditionals) + -- FIX: Set flag to prevent side effects (target cycling) during tooltip evaluation. + -- CountEnemiesMatching changes the player's actual target via UnitXP scanning, + -- which fires PLAYER_TARGET_CHANGED events and interferes with macro execution + -- when called from the periodic action bar update (TestForActiveAction). + CleveRoids._isTestingAction = true + -- PERFORMANCE: Use next() directly instead of pairs() to avoid iterator allocation local k, v = next(conditionals) while k do if not CleveRoids.ignoreKeywords[k] then if not CleveRoids.Keywords[k] or not CleveRoids.Keywords[k](conditionals) then + CleveRoids._isTestingAction = false conditionals.target = origTarget return end @@ -2267,11 +2274,15 @@ function CleveRoids.TestAction(cmd, args) k, v = next(conditionals, k) end + CleveRoids._isTestingAction = false conditionals.target = origTarget return CleveRoids.GetMacroNameFromAction(msg) or msg end function CleveRoids.DoWithConditionals(msg, hook, fixEmptyTargetFunc, targetBeforeAction, action) + -- Ensure TestAction flag is cleared for actual execution (safety net for error recovery) + CleveRoids._isTestingAction = false + -- Check macro stop flags (skip non-control commands when flag is set) -- This enables /stopmacro, /skipmacro, /firstaction, /nofirstaction to work without SuperMacro for vanilla macros if (CleveRoids.stopMacroFlag or CleveRoids.skipMacroFlag) and action ~= "STOPMACRO" and action ~= "SKIPMACRO" and action ~= "FIRSTACTION" and action ~= "NOFIRSTACTION" then