From e6a29d96c88f42564ec5fc2ad45a323a9269ee73 Mon Sep 17 00:00:00 2001 From: Benjamin Jackson <38561765+heyitsbench@users.noreply.github.com> Date: Fri, 30 May 2025 09:35:28 -0400 Subject: [PATCH] fix(Core/Creature): Use home position for leash distance check for creatures with no movement. (#22245) --- src/server/game/Entities/Creature/Creature.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp index c2209bc5b..3115dbf6a 100644 --- a/src/server/game/Entities/Creature/Creature.cpp +++ b/src/server/game/Entities/Creature/Creature.cpp @@ -2690,9 +2690,11 @@ bool Creature::CanCreatureAttack(Unit const* victim, bool skipDistCheck) const return true; float x, y, z; - GetMotionMaster()->GetMotionSlot(MOTION_SLOT_IDLE)->GetResetPosition(x, y, z); - - return IsInDist2d(x, y, dist); + x = y = z = 0.0f; + if (GetMotionMaster()->GetMotionSlot(MOTION_SLOT_IDLE)->GetResetPosition(x, y, z)) + return IsInDist2d(x, y, dist); + else + return IsInDist2d(&m_homePosition, dist); } CreatureAddon const* Creature::GetCreatureAddon() const