From a1d598f515cdebc42b0bff8cc81a9856670aca01 Mon Sep 17 00:00:00 2001 From: Jesse Sestito Date: Tue, 19 May 2026 07:00:29 -0500 Subject: [PATCH] [cpp] Stop actions against locked players Currently, AoE abilities (friendly and enemy) can still hit players who are locked. --- src/map/ai/helpers/targetfind.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/map/ai/helpers/targetfind.cpp b/src/map/ai/helpers/targetfind.cpp index 129362ac4a1..25a1ac9c85d 100644 --- a/src/map/ai/helpers/targetfind.cpp +++ b/src/map/ai/helpers/targetfind.cpp @@ -515,6 +515,15 @@ bool CTargetFind::validEntity(CBattleEntity* PTarget) return false; } + // m_Locked targets should not be able to be attacked or have any ability or spell cast on them, including AoEs. + // TODO: Should a locked player's pet or trust be excluded as well? Verify on retail. Can add that check by changing PTarget to findMaster(PTarget). + // m_Locked is only in a CCharEntity, not all CBattleEntity which do not have m_Locked. Need to account for that. + CCharEntity* PChar = dynamic_cast(PTarget); + if (PChar != nullptr && PChar->m_Locked) + { + return false; + } + // ------------------------------------------------- // IMPORTANT: Benediction/self-centered ally-only check // This must run BEFORE the "first target always allowed" short-circuit.