v1.2.0: adjusted the secrets level feeling, prevents isolated rooms
This commit is contained in:
parent
3c8e5c48dd
commit
f34c6f3471
|
@ -28,6 +28,7 @@ import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.levels.Patch;
|
import com.shatteredpixel.shatteredpixeldungeon.levels.Patch;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
|
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.Room;
|
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.Room;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.connection.ConnectionRoom;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.special.SpecialRoom;
|
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.special.SpecialRoom;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.EntranceRoom;
|
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.EntranceRoom;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.StandardRoom;
|
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.StandardRoom;
|
||||||
|
@ -204,6 +205,38 @@ public abstract class RegularPainter extends Painter {
|
||||||
if (d.type == Room.Door.Type.REGULAR){
|
if (d.type == Room.Door.Type.REGULAR){
|
||||||
if (Random.Float() < hiddenDoorChance) {
|
if (Random.Float() < hiddenDoorChance) {
|
||||||
d.type = Room.Door.Type.HIDDEN;
|
d.type = Room.Door.Type.HIDDEN;
|
||||||
|
//all standard rooms must have an unbroken path to all other standard rooms
|
||||||
|
if (l.feeling != Level.Feeling.SECRETS){
|
||||||
|
Graph.buildDistanceMap(rooms, r);
|
||||||
|
if (n.distance == Integer.MAX_VALUE){
|
||||||
|
d.type = Room.Door.Type.UNLOCKED;
|
||||||
|
}
|
||||||
|
//on a secrets level, rooms just have to not be totally isolated
|
||||||
|
} else {
|
||||||
|
int roomsInGraph = 0;
|
||||||
|
Graph.buildDistanceMap(rooms, r);
|
||||||
|
for (Room rDest : rooms){
|
||||||
|
if (rDest.distance != Integer.MAX_VALUE
|
||||||
|
&& !(rDest instanceof ConnectionRoom)){
|
||||||
|
roomsInGraph++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (roomsInGraph < 2){
|
||||||
|
d.type = Room.Door.Type.UNLOCKED;
|
||||||
|
} else {
|
||||||
|
roomsInGraph = 0;
|
||||||
|
Graph.buildDistanceMap(rooms, n);
|
||||||
|
for (Room nDest : rooms){
|
||||||
|
if (nDest.distance != Integer.MAX_VALUE
|
||||||
|
&& !(nDest instanceof ConnectionRoom)){
|
||||||
|
roomsInGraph++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (roomsInGraph < 2){
|
||||||
|
d.type = Room.Door.Type.UNLOCKED;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Graph.buildDistanceMap(rooms, r);
|
Graph.buildDistanceMap(rooms, r);
|
||||||
//don't hide if it would make this room only accessible by hidden doors
|
//don't hide if it would make this room only accessible by hidden doors
|
||||||
//unless we're on a secrets depth
|
//unless we're on a secrets depth
|
||||||
|
|
Loading…
Reference in New Issue
Block a user