v2.4.0: fixed wandmaker spawning in a variety of bad locations

This commit is contained in:
Evan Debenham
2024-05-02 17:22:55 -04:00
parent 969610dfd4
commit 5459819120

View File

@@ -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<Room> spawnRoom( ArrayList<Room> 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;