v0.6.0: re-added traps not being allowed in connection rooms on floor 1

This commit is contained in:
Evan Debenham 2017-05-01 15:11:32 -04:00
parent 045e398d8f
commit 2852d94c5d

View File

@ -24,8 +24,10 @@ package com.shatteredpixel.shatteredpixeldungeon.levels.painters;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.levels.Patch;
import com.shatteredpixel.shatteredpixeldungeon.levels.RegularLevel;
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.Room;
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.connection.ConnectionRoom;
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.StandardRoom;
import com.shatteredpixel.shatteredpixeldungeon.levels.traps.Trap;
import com.watabou.utils.PathFinder;
@ -259,8 +261,16 @@ public class RegularPainter extends Painter {
for (int i = 0; i < l.length(); i ++) {
if (l.map[i] == Terrain.EMPTY){
//TODO rooms should probably be able to handle trap placement
if (Dungeon.depth == 1){
Room r = ((RegularLevel)l).room(i);
if (r != null && !(r instanceof ConnectionRoom)){
validCells.add(i);
}
} else {
validCells.add(i);
}
}
}
//no more than one trap every 5 valid tiles.