v3.1.0: fixed wandmaker sometimes spawning in doors in new prison entrs

This commit is contained in:
Evan Debenham
2025-05-17 13:37:31 -04:00
parent 815c0d80aa
commit 305b70d609
@@ -53,7 +53,7 @@ import com.shatteredpixel.shatteredpixeldungeon.windows.WndWandmaker;
import com.watabou.noosa.Game; import com.watabou.noosa.Game;
import com.watabou.utils.Bundle; import com.watabou.utils.Bundle;
import com.watabou.utils.Callback; import com.watabou.utils.Callback;
import com.watabou.utils.Point; import com.watabou.utils.PathFinder;
import com.watabou.utils.Random; import com.watabou.utils.Random;
import java.util.ArrayList; import java.util.ArrayList;
@@ -305,11 +305,11 @@ public class Wandmaker extends NPC {
do { do {
validPos = true; validPos = true;
npc.pos = level.pointToCell(room.random((room.width() > 6 && room.height() > 6) ? 2 : 1)); npc.pos = level.pointToCell(room.random((room.width() > 6 && room.height() > 6) ? 2 : 1));
if (npc.pos == level.entrance()){ if (npc.pos == level.entrance() || level.solid[npc.pos]){
validPos = false; validPos = false;
} }
for (Point door : room.connected.values()){ for (int i : PathFinder.NEIGHBOURS4){
if (level.trueDistance( npc.pos, level.pointToCell( door ) ) <= 1){ if (level.map[npc.pos+i] == Terrain.DOOR){
validPos = false; validPos = false;
} }
} }
@@ -345,7 +345,7 @@ public class Wandmaker extends NPC {
public static ArrayList<Room> spawnRoom( ArrayList<Room> rooms) { public static ArrayList<Room> spawnRoom( ArrayList<Room> rooms) {
questRoomSpawned = false; questRoomSpawned = false;
if (!spawned && (type != 0 || (Dungeon.depth > 6 && Random.Int( 10 - Dungeon.depth ) == 0))) { if (!spawned && (type != 0 || (Dungeon.depth == 7))) {
// decide between 1,2, or 3 for quest type. // decide between 1,2, or 3 for quest type.
if (type == 0) type = Random.Int(3)+1; if (type == 0) type = Random.Int(3)+1;