From 58c3317b728830e50c81be88bd960766da0d523d Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Wed, 14 Jan 2015 09:51:28 -0500 Subject: [PATCH] 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. --- .../actors/mobs/npcs/Blacksmith.java | 3 ++- .../shatteredpixeldungeon/actors/mobs/npcs/Imp.java | 2 +- .../shatteredpixeldungeon/levels/CavesLevel.java | 11 +++++++---- .../shatteredpixeldungeon/levels/CityLevel.java | 2 +- .../shatteredpixeldungeon/levels/PrisonLevel.java | 4 ++-- .../shatteredpixeldungeon/levels/SewerLevel.java | 9 ++------- 6 files changed, 15 insertions(+), 16 deletions(-) diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/Blacksmith.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/Blacksmith.java index ef801f787..fa517875f 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/Blacksmith.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/Blacksmith.java @@ -303,7 +303,7 @@ public class Blacksmith extends NPC { } } - public static void spawn( Collection rooms ) { + public static boolean spawn( Collection 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; } } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/Imp.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/Imp.java index 8d37cca07..4c78e2261 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/Imp.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/Imp.java @@ -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(); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/levels/CavesLevel.java b/src/com/shatteredpixel/shatteredpixeldungeon/levels/CavesLevel.java index 37c5b717c..555e5241d 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/levels/CavesLevel.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/levels/CavesLevel.java @@ -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 diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/levels/CityLevel.java b/src/com/shatteredpixel/shatteredpixeldungeon/levels/CityLevel.java index 32ef09b78..0fd7c886e 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/levels/CityLevel.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/levels/CityLevel.java @@ -88,7 +88,7 @@ public class CityLevel extends RegularLevel { protected void createItems() { super.createItems(); - Imp.Quest.spawn( this, roomEntrance ); + Imp.Quest.spawn( this ); } @Override diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/levels/PrisonLevel.java b/src/com/shatteredpixel/shatteredpixeldungeon/levels/PrisonLevel.java index b82c78fe5..504340edf 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/levels/PrisonLevel.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/levels/PrisonLevel.java @@ -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 ); } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/levels/SewerLevel.java b/src/com/shatteredpixel/shatteredpixeldungeon/levels/SewerLevel.java index 4cae64e12..16bd72946 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/levels/SewerLevel.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/levels/SewerLevel.java @@ -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(); }