From 1009d109fdb27d3a6324813d2192b52db3734b1d Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Mon, 3 Oct 2016 20:24:21 -0400 Subject: [PATCH] v0.4.3: improved mob pathfinding --- .../shatteredpixeldungeon/actors/mobs/Mob.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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 0de6158db..51c4dbea2 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 @@ -312,9 +312,9 @@ public abstract class Mob extends Char { 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. 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) { + //rather than scrapping the whole path. Unless the path is too long, + //in which case re-checking will likely result in a better path + if (Dungeon.level.adjacent(target, path.getLast()) && path.size() < Dungeon.level.distance(pos, target)) { int last = path.removeLast(); if (path.isEmpty()) {