Skip to content

Commit

Permalink
fix typo
Browse files Browse the repository at this point in the history
  • Loading branch information
kaleohanopahala authored Sep 29, 2024
1 parent 36a9bc9 commit 0dbf81d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/creatures/monsters/monster.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1341,14 +1341,15 @@ void Monster::doWalkBack(uint32_t &flags, Direction &nextDirection, bool &result
updateMapCache();
}

// Return if the distance is less than or equal to 10
int32_t distance = std::max(Position::getDistanceX(position, masterPos), Position::getDistanceY(position, masterPos));
if (distance == 0 || !spawnMonster) {
if (distance <= 10 || !spawnMonster) {
isWalkingBack = false;
return;
}

std::vector<Direction> listDir;
if (getPathTo(masterPos, listDir, 0, std::max(0, distance - 5), true, true, distance)) {
if (getPathTo(masterPos, listDir, 0, distance - 10, true, true, distance)) {
startAutoWalk(listDir);
} else {
isWalkingBack = false;
Expand Down

0 comments on commit 0dbf81d

Please sign in to comment.