v2.4.0: fixed wandmaker spawning in a variety of bad locations
This commit is contained in:
+6
-4
@@ -297,10 +297,10 @@ public class Wandmaker extends NPC {
|
|||||||
|
|
||||||
Wandmaker npc = new Wandmaker();
|
Wandmaker npc = new Wandmaker();
|
||||||
boolean validPos;
|
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 {
|
do {
|
||||||
validPos = true;
|
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()){
|
if (npc.pos == level.entrance()){
|
||||||
validPos = false;
|
validPos = false;
|
||||||
}
|
}
|
||||||
@@ -309,7 +309,9 @@ public class Wandmaker extends NPC {
|
|||||||
validPos = false;
|
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;
|
validPos = false;
|
||||||
}
|
}
|
||||||
} while (!validPos);
|
} while (!validPos);
|
||||||
@@ -339,7 +341,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 > 6)) {
|
||||||
|
|
||||||
// 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;
|
||||||
|
|||||||
Reference in New Issue
Block a user