Skip to content

Commit

Permalink
Fix monter follow creature
Browse files Browse the repository at this point in the history
  • Loading branch information
ramon-bernardo committed Dec 7, 2024
1 parent ccfd367 commit c374984
Showing 1 changed file with 22 additions and 17 deletions.
39 changes: 22 additions & 17 deletions src/monster.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -584,26 +584,31 @@ void Monster::goToFollowCreature()
FindPathParams fpp;
getPathSearchParams(followCreature, fpp);

if (!isSummon()) {
Direction dir = DIRECTION_NONE;

if (isFleeing()) {
getDistanceStep(followCreature->getPosition(), dir, true);
} else if (fpp.maxTargetDist > 1) {
if (!getDistanceStep(followCreature->getPosition(), dir)) {
// if we can't get anything then let the A* calculate
updateFollowCreaturePath(fpp);
return;
}
}
if (isSummon()) {
// summon must follow the orders of master.
updateFollowCreaturePath(fpp);
onFollowCreatureComplete();
return;
}

if (dir != DIRECTION_NONE) {
listWalkDir.clear();
listWalkDir.push_back(dir);
auto dir = DIRECTION_NONE;

hasFollowPath = true;
startAutoWalk();
if (isFleeing()) {
getDistanceStep(followCreature->getPosition(), dir, true);
} else if (fpp.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) {
listWalkDir.clear();
listWalkDir.push_back(dir);

hasFollowPath = true;
startAutoWalk();
} else {
updateFollowCreaturePath(fpp);
}
Expand Down

0 comments on commit c374984

Please sign in to comment.