v0.2.3d: several tweaks to quest generation, should fix occasional crashing when using ankh on floors 1-9, and blacksmith rarely failing to spawn.

This commit is contained in:
Evan Debenham 2015-01-14 09:51:28 -05:00
parent 6457f0cf71
commit 58c3317b72
6 changed files with 15 additions and 16 deletions

View File

@ -303,7 +303,7 @@ public class Blacksmith extends NPC {
}
}
public static void spawn( Collection<Room> rooms ) {
public static boolean spawn( Collection<Room> rooms ) {
if (!spawned && Dungeon.depth > 11 && Random.Int( 15 - Dungeon.depth ) == 0) {
Room blacksmith = null;
@ -321,6 +321,7 @@ public class Blacksmith extends NPC {
}
}
}
return spawned;
}
}
}

View File

@ -209,7 +209,7 @@ public class Imp extends NPC {
}
}
public static void spawn( CityLevel level, Room room ) {
public static void spawn( CityLevel level ) {
if (!spawned && Dungeon.depth > 16 && Random.Int( 20 - Dungeon.depth ) == 0) {
Imp npc = new Imp();

View File

@ -59,10 +59,13 @@ public class CavesLevel extends RegularLevel {
}
@Override
protected void assignRoomType() {
super.assignRoomType();
Blacksmith.Quest.spawn( rooms );
protected boolean build() {
if (!super.build()) return false;
if (!Blacksmith.Quest.spawn( rooms ) && Dungeon.depth == 14)
return false;
return true;
}
@Override

View File

@ -88,7 +88,7 @@ public class CityLevel extends RegularLevel {
protected void createItems() {
super.createItems();
Imp.Quest.spawn( this, roomEntrance );
Imp.Quest.spawn( this );
}
@Override

View File

@ -66,8 +66,8 @@ public class PrisonLevel extends RegularLevel {
}
@Override
protected void createMobs() {
super.createMobs();
protected void createItems() {
super.createItems();
Wandmaker.Quest.spawn( this, roomEntrance );
}

View File

@ -102,19 +102,14 @@ public class SewerLevel extends RegularLevel {
}
}
@Override
protected void createMobs() {
super.createMobs();
Ghost.Quest.spawn( this );
}
@Override
protected void createItems() {
if (Dungeon.dewVial && Random.Int( 4 - Dungeon.depth ) == 0) {
addItemToSpawn( new DewVial() );
Dungeon.dewVial = false;
}
Ghost.Quest.spawn( this );
super.createItems();
}