diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java index 3ae9c9159..a649f0afd 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java @@ -1045,7 +1045,7 @@ public class Hero extends Char { } else { boolean newPath = false; - if (path == null || path.isEmpty()) + if (path == null || path.isEmpty() || !Dungeon.level.adjacent(pos, path.getFirst())) newPath = true; else if (path.getLast() != target) newPath = true; diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Mob.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Mob.java index dd6a32d54..9cd7d8bb4 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Mob.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Mob.java @@ -307,12 +307,13 @@ public abstract class Mob extends Char { } else { boolean newPath = false; - if (path == null || path.isEmpty()) + if (path == null || path.isEmpty() || !Dungeon.level.adjacent(pos, path.getFirst())) newPath = true; else if (path.getLast() != target) { //if the new target is adjacent to the end of the path, adjust for that - //rather than scrapping the whole path - if (Dungeon.level.adjacent(target, path.getLast())) { + //rather than scrapping the whole path. Unless the path is very long, + //in which case re-checking will likely result in a much better path + if (Dungeon.level.adjacent(target, path.getLast()) && path.size() < viewDistance) { int last = path.removeLast(); if (path.isEmpty()) {