diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/Generator.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/Generator.java
index b2da35beb..d21b495c5 100644
--- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/Generator.java
+++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/Generator.java
@@ -196,12 +196,12 @@ public class Generator {
FOOD ( 0, Food.class ),
POTION ( 20, Potion.class ),
- SEED ( 0, Plant.Seed.class ),
+ SEED ( 0, Plant.Seed.class ), //dropped by grass
SCROLL ( 20, Scroll.class ),
- STONE ( 0, Runestone.class),
+ STONE ( 5, Runestone.class),
- GOLD ( 20, Gold.class );
+ GOLD ( 15, Gold.class );
public Class>[] classes;
public float[] probs;
@@ -278,7 +278,7 @@ public class Generator {
SCROLL.probs = new float[]{ 0, 6, 4, 3, 3, 3, 2, 2, 2, 2, 2, 1 };
STONE.classes = new Class>[]{
- StoneOfEnchantment.class, //1 is garunteed to drop on floors 6-19
+ StoneOfEnchantment.class, //1 is guaranteed to drop on floors 6-19
StoneOfAugmentation.class, //1 is sold in each shop
StoneOfIntuition.class, //1 additional stone is also dropped on floors 1-3
StoneOfAggression.class,
diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/RegularLevel.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/RegularLevel.java
index 0e32401d9..4870b838e 100644
--- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/RegularLevel.java
+++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/RegularLevel.java
@@ -390,6 +390,11 @@ public abstract class RegularLevel extends Level {
}
+ //FIXME pit rooms shouldn't be problematic enough to warrant this
+ public boolean hasPitRoom(){
+ return randomRoom(PitRoom.class) != null;
+ }
+
protected Room randomRoom( Class type ) {
Random.shuffle( rooms );
for (Room r : rooms) {
diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/secret/SecretRunestoneRoom.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/secret/SecretRunestoneRoom.java
index 2d49ca6f8..715fe9e57 100644
--- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/secret/SecretRunestoneRoom.java
+++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/secret/SecretRunestoneRoom.java
@@ -21,6 +21,7 @@
package com.shatteredpixel.shatteredpixeldungeon.levels.rooms.secret;
+import com.shatteredpixel.shatteredpixeldungeon.items.Generator;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfLiquidFlame;
import com.shatteredpixel.shatteredpixeldungeon.items.stones.StoneOfEnchantment;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
@@ -63,6 +64,17 @@ public class SecretRunestoneRoom extends SecretRoom {
level.addItemToSpawn(new PotionOfLiquidFlame());
int dropPos;
+
+ do{
+ dropPos = level.pointToCell(random());
+ } while (level.map[dropPos] != Terrain.EMPTY);
+ level.drop( Generator.random(Generator.Category.STONE), dropPos);
+
+ do{
+ dropPos = level.pointToCell(random());
+ } while (level.map[dropPos] != Terrain.EMPTY && level.heaps.get(dropPos) != null);
+ level.drop( Generator.random(Generator.Category.STONE), dropPos);
+
do{
dropPos = level.pointToCell(random());
} while (level.map[dropPos] != Terrain.EMPTY_SP);
diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/special/LaboratoryRoom.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/special/LaboratoryRoom.java
index 812d32bce..a0452d8e2 100644
--- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/special/LaboratoryRoom.java
+++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/special/LaboratoryRoom.java
@@ -25,8 +25,10 @@ import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Alchemy;
import com.shatteredpixel.shatteredpixeldungeon.items.Generator;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
+import com.shatteredpixel.shatteredpixeldungeon.items.keys.IronKey;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.Potion;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
+import com.shatteredpixel.shatteredpixeldungeon.levels.RegularLevel;
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
import com.shatteredpixel.shatteredpixeldungeon.levels.painters.Painter;
import com.watabou.utils.Point;
@@ -58,7 +60,7 @@ public class LaboratoryRoom extends SpecialRoom {
alchemy.seed( level, pot.x + level.width() * pot.y, chapter*10 + Random.IntRange(0, 20) );
level.blobs.put( Alchemy.class, alchemy );
- int n = Random.IntRange( 1, 2 );
+ int n = Random.IntRange( 2, 3 );
for (int i=0; i < n; i++) {
int pos;
do {
@@ -69,14 +71,20 @@ public class LaboratoryRoom extends SpecialRoom {
level.drop( prize( level ), pos );
}
- entrance.set( Door.Type.REGULAR );
+ if (level instanceof RegularLevel && ((RegularLevel)level).hasPitRoom()){
+ entrance.set( Door.Type.REGULAR );
+ } else {
+ entrance.set( Door.Type.LOCKED );
+ level.addItemToSpawn( new IronKey( Dungeon.depth ) );
+ }
+
}
private static Item prize( Level level ) {
Item prize = level.findPrizeItem( Potion.class );
if (prize == null)
- prize = Generator.random( Generator.Category.POTION );
+ prize = Generator.random( Random.oneOf( Generator.Category.POTION, Generator.Category.STONE ));
return prize;
}
diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/special/RunestoneRoom.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/special/RunestoneRoom.java
new file mode 100644
index 000000000..2ef323278
--- /dev/null
+++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/special/RunestoneRoom.java
@@ -0,0 +1,66 @@
+/*
+ * Pixel Dungeon
+ * Copyright (C) 2012-2015 Oleg Dolya
+ *
+ * Shattered Pixel Dungeon
+ * Copyright (C) 2014-2018 Evan Debenham
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see
+ */
+
+package com.shatteredpixel.shatteredpixeldungeon.levels.rooms.special;
+
+import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
+import com.shatteredpixel.shatteredpixeldungeon.items.Generator;
+import com.shatteredpixel.shatteredpixeldungeon.items.Item;
+import com.shatteredpixel.shatteredpixeldungeon.items.keys.IronKey;
+import com.shatteredpixel.shatteredpixeldungeon.items.stones.Runestone;
+import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
+import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
+import com.shatteredpixel.shatteredpixeldungeon.levels.painters.Painter;
+import com.watabou.utils.Random;
+
+public class RunestoneRoom extends SpecialRoom {
+
+ @Override
+ public void paint( Level level) {
+
+ Painter.fill( level, this, Terrain.WALL );
+ Painter.fill( level, this, 1, Terrain.CHASM );
+
+ Painter.drawInside( level, this, entrance(), 2, Terrain.EMPTY_SP);
+ Painter.fill( level, this, 2, Terrain.EMPTY );
+
+ int n = Random.NormalIntRange(2, 4);
+ int dropPos;
+ for (int i = 0; i < n; i++) {
+ do {
+ dropPos = level.pointToCell(random());
+ } while (level.map[dropPos] != Terrain.EMPTY);
+ level.drop(prize(level), dropPos);
+ }
+
+ entrance().set( Door.Type.LOCKED );
+ level.addItemToSpawn( new IronKey( Dungeon.depth ) );
+ }
+
+ private static Item prize( Level level ) {
+
+ Item prize = level.findPrizeItem( Runestone.class );
+ if (prize == null)
+ prize = Generator.random( Generator.Category.STONE );
+
+ return prize;
+ }
+}
diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/special/SpecialRoom.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/special/SpecialRoom.java
index a571af730..8e7e83e4d 100644
--- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/special/SpecialRoom.java
+++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/special/SpecialRoom.java
@@ -59,7 +59,7 @@ public class SpecialRoom extends Room {
private static final ArrayList> ALL_SPEC = new ArrayList<>( Arrays.asList(
WeakFloorRoom.class, MagicWellRoom.class, CryptRoom.class, PoolRoom.class, GardenRoom.class, LibraryRoom.class, ArmoryRoom.class,
- TreasuryRoom.class, TrapsRoom.class, StorageRoom.class, StatueRoom.class, VaultRoom.class
+ TreasuryRoom.class, TrapsRoom.class, StorageRoom.class, StatueRoom.class, VaultRoom.class, RunestoneRoom.class
) );
public static ArrayList> runSpecials = new ArrayList<>();
@@ -101,6 +101,7 @@ public class SpecialRoom extends Room {
floorSpecials.remove( ArmoryRoom.class );
floorSpecials.remove( CryptRoom.class );
floorSpecials.remove( LibraryRoom.class );
+ floorSpecials.remove( RunestoneRoom.class );
floorSpecials.remove( StatueRoom.class );
floorSpecials.remove( TreasuryRoom.class );
floorSpecials.remove( VaultRoom.class );