From 9912c5e1eead923e3a1ec13d1f0eea98d872b635 Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Tue, 5 May 2020 12:16:42 -0400 Subject: [PATCH] v0.8.0b: various fixes for levelgen freezing: - Wandmaker rarely not having a place to go in a 3*3 room with 4 doors - Nowhere to place the hero if they fall from a chasm into a boss floor --- .../shatteredpixeldungeon/actors/mobs/npcs/Wandmaker.java | 4 ++-- .../shatteredpixel/shatteredpixeldungeon/levels/Level.java | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/Wandmaker.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/Wandmaker.java index 4a4cf0a33..3a4386d68 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/Wandmaker.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/Wandmaker.java @@ -278,7 +278,7 @@ public class Wandmaker extends NPC { Wandmaker npc = new Wandmaker(); boolean validPos; - //Do not spawn wandmaker on the entrance, or next to a door. + //Do not spawn wandmaker on the entrance, or in front of a door. do { validPos = true; npc.pos = level.pointToCell(room.random()); @@ -286,7 +286,7 @@ public class Wandmaker extends NPC { validPos = false; } for (Point door : room.connected.values()){ - if (level.adjacent( npc.pos, level.pointToCell( door ) )){ + if (level.trueDistance( npc.pos, level.pointToCell( door ) ) <= 1){ validPos = false; } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/Level.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/Level.java index 3da34cd12..cc03fc160 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/Level.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/Level.java @@ -863,8 +863,7 @@ public abstract class Level implements Bundlable { do { result = randomRespawnCell( null ); } while (traps.get(result) != null - || findMob(result) != null - || heaps.get(result) != null); + || findMob(result) != null); return result; }