mirror of
https://github.com/brues-code/SuperCleveRoidMacros.git
synced 2026-09-16 03:38:00 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
653f8db3d7 |
@@ -3100,15 +3100,17 @@ end
|
|||||||
-- PERFORMANCE: Module-level action to avoid closure allocation per call
|
-- PERFORMANCE: Module-level action to avoid closure allocation per call
|
||||||
local function _startAttackAction()
|
local function _startAttackAction()
|
||||||
if not UnitExists("target") or CleveRoids.IsUnitDead("target") then TargetNearestEnemy() end
|
if not UnitExists("target") or CleveRoids.IsUnitDead("target") then TargetNearestEnemy() end
|
||||||
-- Check both event-based flag AND action bar state for reliable detection
|
-- Ground truth is the real action-bar state, NOT the cached autoAttack flag.
|
||||||
|
-- The flag can drift stale-true (e.g. set optimistically after AttackTarget below,
|
||||||
|
-- or a target dying without PLAYER_LEAVE_COMBAT firing), which would make us wrongly
|
||||||
|
-- believe we're already swinging and skip the attack. Use the ORIGINAL API here:
|
||||||
|
-- the overridden global IsCurrentAction just echoes the cached flag for the attack
|
||||||
|
-- slot, so it can't detect drift. Fall back to the flag only if the slot is unknown.
|
||||||
local isAttacking = CleveRoids.CurrentSpell.autoAttack
|
local isAttacking = CleveRoids.CurrentSpell.autoAttack
|
||||||
if not isAttacking then
|
local slot = CleveRoids.GetProxyActionSlot(CleveRoids.Localized.Attack)
|
||||||
-- Fallback: check action bar state via IsCurrentAction
|
if slot then
|
||||||
local slot = CleveRoids.GetProxyActionSlot(CleveRoids.Localized.Attack)
|
isAttacking = CleveRoids.Hooks.IsCurrentAction(slot) and true or false
|
||||||
if slot and IsCurrentAction(slot) then
|
CleveRoids.CurrentSpell.autoAttack = isAttacking
|
||||||
CleveRoids.CurrentSpell.autoAttack = true
|
|
||||||
isAttacking = true
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
if not isAttacking and not CleveRoids.CurrentSpell.autoAttackLock and UnitExists("target") and UnitCanAttack("player", "target") then
|
if not isAttacking and not CleveRoids.CurrentSpell.autoAttackLock and UnitExists("target") and UnitCanAttack("player", "target") then
|
||||||
CleveRoids.CurrentSpell.autoAttackLock = true
|
CleveRoids.CurrentSpell.autoAttackLock = true
|
||||||
|
|||||||
Reference in New Issue
Block a user