From 846ef37c0352e5d880bfdd8aee12a5e084576b78 Mon Sep 17 00:00:00 2001 From: ramon-bernardo Date: Tue, 17 Feb 2026 17:42:20 -0300 Subject: [PATCH 1/7] fix(monster): prevent spiral movement loop when overlaps creature --- src/monster.cpp | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/src/monster.cpp b/src/monster.cpp index 178ec172cd..cb6087db6a 100644 --- a/src/monster.cpp +++ b/src/monster.cpp @@ -527,30 +527,23 @@ void Monster::goToFollowCreature() FindPathParams fpp; getPathSearchParams(followCreature, fpp); - if (!isSummon()) { Direction dir = DIRECTION_NONE; - if (isFleeing()) { - getDistanceStep(followCreature->getPosition(), dir, true); - } else { // maxTargetDist > 1 - if (!getDistanceStep(followCreature->getPosition(), dir)) { - // if we can't get anything then let the A* calculate - updateFollowCreaturePath(fpp); - return; - } - } - - if (dir != DIRECTION_NONE) { + bool simpleStep = !isSummon() && (isFleeing() || fpp.maxTargetDist > 1); + if (simpleStep) { + if (getDistanceStep(followCreature->getPosition(), dir, isFleeing())) { listWalkDir.clear(); listWalkDir.push_back(dir); hasFollowPath = true; startAutoWalk(); + + onFollowCreatureComplete(); + return; } - } else { - updateFollowCreaturePath(fpp); } + updateFollowCreaturePath(fpp); onFollowCreatureComplete(); } From 59e468e0fb80375ddb41963b039df32f392cd452 Mon Sep 17 00:00:00 2001 From: ramon-bernardo Date: Tue, 17 Feb 2026 17:55:34 -0300 Subject: [PATCH 2/7] fix: indentation and use startAutoWalk method with dir param --- src/monster.cpp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/monster.cpp b/src/monster.cpp index cb6087db6a..2c147761eb 100644 --- a/src/monster.cpp +++ b/src/monster.cpp @@ -527,17 +527,13 @@ void Monster::goToFollowCreature() FindPathParams fpp; getPathSearchParams(followCreature, fpp); - Direction dir = DIRECTION_NONE; + auto direction = DIRECTION_NONE; - bool simpleStep = !isSummon() && (isFleeing() || fpp.maxTargetDist > 1); + const auto simpleStep = !isSummon() && (isFleeing() || fpp.maxTargetDist > 1); if (simpleStep) { - if (getDistanceStep(followCreature->getPosition(), dir, isFleeing())) { - listWalkDir.clear(); - listWalkDir.push_back(dir); - + if (getDistanceStep(followCreature->getPosition(), direction, isFleeing())) { hasFollowPath = true; - startAutoWalk(); - + startAutoWalk(direction); onFollowCreatureComplete(); return; } From 4e2b979f87e2bd457ec3c15ad3cb68e376d1e2e1 Mon Sep 17 00:00:00 2001 From: ramon-bernardo Date: Tue, 17 Feb 2026 20:12:13 -0300 Subject: [PATCH 3/7] refactor: move var to own context --- src/monster.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/monster.cpp b/src/monster.cpp index 2c147761eb..6ec96c1568 100644 --- a/src/monster.cpp +++ b/src/monster.cpp @@ -527,10 +527,9 @@ void Monster::goToFollowCreature() FindPathParams fpp; getPathSearchParams(followCreature, fpp); - auto direction = DIRECTION_NONE; - const auto simpleStep = !isSummon() && (isFleeing() || fpp.maxTargetDist > 1); if (simpleStep) { + auto direction = DIRECTION_NONE; if (getDistanceStep(followCreature->getPosition(), direction, isFleeing())) { hasFollowPath = true; startAutoWalk(direction); From 80d174c568be50aef51cdc2390b39dfd428f83bb Mon Sep 17 00:00:00 2001 From: ramon-bernardo Date: Wed, 18 Feb 2026 12:06:25 -0300 Subject: [PATCH 4/7] fix: walk on target same sqm --- src/monster.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/monster.cpp b/src/monster.cpp index 6ec96c1568..2a68b57be4 100644 --- a/src/monster.cpp +++ b/src/monster.cpp @@ -527,7 +527,7 @@ void Monster::goToFollowCreature() FindPathParams fpp; getPathSearchParams(followCreature, fpp); - const auto simpleStep = !isSummon() && (isFleeing() || fpp.maxTargetDist > 1); + const auto simpleStep = !isSummon() && (isFleeing() || fpp.maxTargetDist >= 1); if (simpleStep) { auto direction = DIRECTION_NONE; if (getDistanceStep(followCreature->getPosition(), direction, isFleeing())) { From 57954bd70ceda160ff6c0afa70b481a403cbaae3 Mon Sep 17 00:00:00 2001 From: ramon-bernardo Date: Wed, 18 Feb 2026 22:30:54 -0300 Subject: [PATCH 5/7] fix: check when none dir --- src/monster.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/monster.cpp b/src/monster.cpp index 2a68b57be4..8affa3dabf 100644 --- a/src/monster.cpp +++ b/src/monster.cpp @@ -531,8 +531,11 @@ void Monster::goToFollowCreature() if (simpleStep) { auto direction = DIRECTION_NONE; if (getDistanceStep(followCreature->getPosition(), direction, isFleeing())) { - hasFollowPath = true; - startAutoWalk(direction); + if (direction != DIRECTION_NONE) { + hasFollowPath = true; + startAutoWalk(direction); + } + onFollowCreatureComplete(); return; } From 3fc064976afa277326b51e06893301c3a18f9d89 Mon Sep 17 00:00:00 2001 From: ramon-bernardo Date: Wed, 18 Feb 2026 23:20:20 -0300 Subject: [PATCH 6/7] fix: walk on target same sqm --- src/monster.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/monster.cpp b/src/monster.cpp index 8affa3dabf..0074a0c346 100644 --- a/src/monster.cpp +++ b/src/monster.cpp @@ -527,7 +527,7 @@ void Monster::goToFollowCreature() FindPathParams fpp; getPathSearchParams(followCreature, fpp); - const auto simpleStep = !isSummon() && (isFleeing() || fpp.maxTargetDist >= 1); + const auto simpleStep = !isSummon() && (isFleeing() || fpp.maxTargetDist > 1); if (simpleStep) { auto direction = DIRECTION_NONE; if (getDistanceStep(followCreature->getPosition(), direction, isFleeing())) { From b7096e06b364c1afa04691f25badc9773f4a63eb Mon Sep 17 00:00:00 2001 From: ramon-bernardo Date: Thu, 19 Feb 2026 10:38:07 -0300 Subject: [PATCH 7/7] fix: ai bot suggestion --- src/monster.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/monster.cpp b/src/monster.cpp index 0074a0c346..2f0be22df5 100644 --- a/src/monster.cpp +++ b/src/monster.cpp @@ -531,8 +531,9 @@ void Monster::goToFollowCreature() if (simpleStep) { auto direction = DIRECTION_NONE; if (getDistanceStep(followCreature->getPosition(), direction, isFleeing())) { + hasFollowPath = true; + if (direction != DIRECTION_NONE) { - hasFollowPath = true; startAutoWalk(direction); }