Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 11 additions & 19 deletions src/monster.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -527,30 +527,22 @@ 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;
}
}
const auto simpleStep = !isSummon() && (isFleeing() || fpp.maxTargetDist > 1);
if (simpleStep) {
auto direction = DIRECTION_NONE;
if (getDistanceStep(followCreature->getPosition(), direction, isFleeing())) {
hasFollowPath = true;

if (dir != DIRECTION_NONE) {
listWalkDir.clear();
listWalkDir.push_back(dir);
if (direction != DIRECTION_NONE) {
startAutoWalk(direction);
}

hasFollowPath = true;
startAutoWalk();
onFollowCreatureComplete();
return;
}
} else {
updateFollowCreaturePath(fpp);
}

updateFollowCreaturePath(fpp);
onFollowCreatureComplete();
}

Expand Down
Loading