v2.2.0: CavesPainter no longer walls up corners if there is a connection
This commit is contained in:
@@ -60,7 +60,8 @@ public class CavesPainter extends RegularPainter {
|
||||
|
||||
if (Random.Int( s ) > 8) {
|
||||
int corner = (room.left + 1) + (room.top + 1) * w;
|
||||
if (map[corner - 1] == Terrain.WALL && map[corner - w] == Terrain.WALL) {
|
||||
if (map[corner-1] == Terrain.WALL && !room.connected.containsValue(level.cellToPoint(corner-1))
|
||||
&& map[corner-w] == Terrain.WALL && !room.connected.containsValue(level.cellToPoint(corner-w))) {
|
||||
map[corner] = Terrain.WALL;
|
||||
level.traps.remove(corner);
|
||||
}
|
||||
@@ -68,7 +69,8 @@ public class CavesPainter extends RegularPainter {
|
||||
|
||||
if (Random.Int( s ) > 8) {
|
||||
int corner = (room.right - 1) + (room.top + 1) * w;
|
||||
if (map[corner + 1] == Terrain.WALL && map[corner - w] == Terrain.WALL) {
|
||||
if (map[corner+1] == Terrain.WALL && !room.connected.containsValue(level.cellToPoint(corner+1))
|
||||
&& map[corner-w] == Terrain.WALL && !room.connected.containsValue(level.cellToPoint(corner-w))) {
|
||||
map[corner] = Terrain.WALL;
|
||||
level.traps.remove(corner);
|
||||
}
|
||||
@@ -76,7 +78,8 @@ public class CavesPainter extends RegularPainter {
|
||||
|
||||
if (Random.Int( s ) > 8) {
|
||||
int corner = (room.left + 1) + (room.bottom - 1) * w;
|
||||
if (map[corner - 1] == Terrain.WALL && map[corner + w] == Terrain.WALL) {
|
||||
if (map[corner-1] == Terrain.WALL && !room.connected.containsValue(level.cellToPoint(corner-1))
|
||||
&& map[corner+w] == Terrain.WALL && !room.connected.containsValue(level.cellToPoint(corner+w))) {
|
||||
map[corner] = Terrain.WALL;
|
||||
level.traps.remove(corner);
|
||||
}
|
||||
@@ -84,7 +87,8 @@ public class CavesPainter extends RegularPainter {
|
||||
|
||||
if (Random.Int( s ) > 8) {
|
||||
int corner = (room.right - 1) + (room.bottom - 1) * w;
|
||||
if (map[corner + 1] == Terrain.WALL && map[corner + w] == Terrain.WALL) {
|
||||
if (map[corner+1] == Terrain.WALL && !room.connected.containsValue(level.cellToPoint(corner+1))
|
||||
&& map[corner+w] == Terrain.WALL && !room.connected.containsValue(level.cellToPoint(corner+w))) {
|
||||
map[corner] = Terrain.WALL;
|
||||
level.traps.remove(corner);
|
||||
}
|
||||
|
||||
@@ -49,16 +49,6 @@ public class MiningLevelPainter extends CavesPainter {
|
||||
|
||||
@Override
|
||||
protected void generateGold(Level level, ArrayList<Room> rooms) {
|
||||
|
||||
//replace all hidden doors with wall
|
||||
// we do this here so that levels can still know where hidden passages are until the end
|
||||
// but said passages can also sometimes have gold in them
|
||||
for (int i = 0; i < level.length(); i++) {
|
||||
if (level.map[i] == Terrain.SECRET_DOOR) {
|
||||
level.map[i] = Terrain.WALL;
|
||||
}
|
||||
}
|
||||
|
||||
//we start by counting all the gold purposefully made by rooms
|
||||
for (int i = 0; i < level.length(); i++){
|
||||
if (level.map[i] == Terrain.WALL_DECO) {
|
||||
@@ -131,7 +121,7 @@ public class MiningLevelPainter extends CavesPainter {
|
||||
int door = d.x + d.y * l.width();
|
||||
|
||||
if (d.type == Room.Door.Type.HIDDEN){
|
||||
l.map[door] = Terrain.SECRET_DOOR;
|
||||
l.map[door] = Terrain.WALL;
|
||||
} else {
|
||||
//some of these are randomly hidden, using the same rules as regular levels
|
||||
if (Random.Float() < hiddenDoorChance) {
|
||||
|
||||
Reference in New Issue
Block a user