From 52b831c2c2b3ca63bf4c609415278342798c1ef5 Mon Sep 17 00:00:00 2001 From: Jrc13245 Date: Fri, 6 Mar 2026 20:14:08 -0500 Subject: [PATCH] stopattack and cleartarget conditionals --- Core.lua | 25 +++++++++++++++++++++++++ Init.lua | 2 ++ 2 files changed, 27 insertions(+) diff --git a/Core.lua b/Core.lua index e59b206..c6f9a1e 100644 --- a/Core.lua +++ b/Core.lua @@ -98,6 +98,8 @@ local BOOLEAN_CONDITIONALS = { nogroup = true, moving = true, nomoving = true, + stopattack = true, + cleartarget = true, } local requirementCheckFrame = CreateFrame("Frame") @@ -2574,6 +2576,29 @@ function CleveRoids.DoWithConditionals(msg, hook, fixEmptyTargetFunc, targetBefo TargetLastTarget() end + -- [stopattack] modifier: stop autoattack immediately after cast + -- Faster than /stopattack on a separate line because CastSpellByName starts + -- autoattack as a side effect and this runs in the same function call. + if conditionals.stopattack then + CleveRoids.CurrentSpell.autoAttack = false + CleveRoids.CurrentSpell.autoAttackLock = false + if UnitExists("target") then + local savedGuid = CleveRoids.GetGUID("target") + AttackTarget() + ClearTarget() + if savedGuid then + TargetUnit(savedGuid) + else + TargetLastTarget() + end + end + end + + -- [cleartarget] modifier: clear target after cast (e.g., prevent combo point loss on CC'd target) + if conditionals.cleartarget then + ClearTarget() + end + conditionals.target = origTarget return result end diff --git a/Init.lua b/Init.lua index b789c47..5423e0a 100644 --- a/Init.lua +++ b/Init.lua @@ -171,6 +171,8 @@ CleveRoids.ignoreKeywords = { _groups = true, -- Grouped conditional values for AND/OR evaluation multiscan = true, -- Processed before Keywords loop (target resolution) mouseuse = true, -- Post-cast modifier: auto-click AOE targeting circle at cursor + stopattack = true, -- Post-cast modifier: stop autoattack after cast + cleartarget = true, -- Post-cast modifier: clear target after cast (when used as conditional on /cast) } -- TODO: Localize?