From 5459819120cd772e37439bd96bef5b6a371a9958 Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Thu, 2 May 2024 17:22:55 -0400 Subject: [PATCH] v2.4.0: fixed wandmaker spawning in a variety of bad locations --- .../actors/mobs/npcs/Wandmaker.java | 10 ++++++---- 1 file changed, 6 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 45ac83813..1cbf5aa88 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 @@ -297,10 +297,10 @@ public class Wandmaker extends NPC { Wandmaker npc = new Wandmaker(); boolean validPos; - //Do not spawn wandmaker on the entrance, a trap, or in front of a door. + //Do not spawn wandmaker on the entrance, in front of a door, or on bad terrain. do { validPos = true; - npc.pos = level.pointToCell(room.random()); + npc.pos = level.pointToCell(room.random((room.width() > 6 && room.height() > 6) ? 2 : 1)); if (npc.pos == level.entrance()){ validPos = false; } @@ -309,7 +309,9 @@ public class Wandmaker extends NPC { validPos = false; } } - if (level.traps.get(npc.pos) != null || level.map[npc.pos] == Terrain.CHASM){ + if (level.traps.get(npc.pos) != null + || !level.passable[npc.pos] + || level.map[npc.pos] == Terrain.EMPTY_SP){ validPos = false; } } while (!validPos); @@ -339,7 +341,7 @@ public class Wandmaker extends NPC { public static ArrayList spawnRoom( ArrayList rooms) { questRoomSpawned = false; - if (!spawned && (type != 0 || (Dungeon.depth > 6 && Random.Int( 10 - Dungeon.depth ) == 0))) { + if (!spawned && (type != 0 || Dungeon.depth > 6)) { // decide between 1,2, or 3 for quest type. if (type == 0) type = Random.Int(3)+1;