v3.1.0: expanded standard rooms in the caves
This commit is contained in:
@@ -42,7 +42,7 @@ public class CavesPainter extends RegularPainter {
|
||||
for (Room r : rooms) {
|
||||
for (Room n : r.neigbours) {
|
||||
if (!r.connected.containsKey( n )) {
|
||||
mergeRooms(level, r, n, null, Terrain.CHASM);
|
||||
mergeRooms(level, r, n, null, Random.Int(3) == 0 ? Terrain.REGION_DECO : Terrain.CHASM);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -59,10 +59,11 @@ public class CavesPainter extends RegularPainter {
|
||||
int s = room.square();
|
||||
|
||||
//for each corner, we have a chance to fill based on room size
|
||||
//but not if filling that corner blocks a connection or places a visible trap next to a wall
|
||||
//but not if filling that corner replaces solid terrain, blocks a connection, or places a visible trap next to a wall
|
||||
if (Random.Int( s ) > 8) {
|
||||
int corner = (room.left + 1) + (room.top + 1) * w;
|
||||
if (map[corner-1] == Terrain.WALL && !room.connected.containsValue(level.cellToPoint(corner-1))
|
||||
if ((Terrain.flags[map[corner]] & Terrain.SOLID) == 0
|
||||
&& 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+1] != Terrain.TRAP && map[corner+w] != Terrain.TRAP) {
|
||||
map[corner] = Terrain.WALL;
|
||||
@@ -72,7 +73,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 && !room.connected.containsValue(level.cellToPoint(corner+1))
|
||||
if ((Terrain.flags[map[corner]] & Terrain.SOLID) == 0
|
||||
&& 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-1] != Terrain.TRAP && map[corner+w] != Terrain.TRAP) {
|
||||
map[corner] = Terrain.WALL;
|
||||
@@ -82,7 +84,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 && !room.connected.containsValue(level.cellToPoint(corner-1))
|
||||
if ((Terrain.flags[map[corner]] & Terrain.SOLID) == 0
|
||||
&& 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+1] != Terrain.TRAP && map[corner-w] != Terrain.TRAP) {
|
||||
map[corner] = Terrain.WALL;
|
||||
@@ -92,7 +95,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 && !room.connected.containsValue(level.cellToPoint(corner+1))
|
||||
if ((Terrain.flags[map[corner]] & Terrain.SOLID) == 0
|
||||
&& 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-1] != Terrain.TRAP && map[corner-w] != Terrain.TRAP) {
|
||||
map[corner] = Terrain.WALL;
|
||||
|
||||
@@ -24,6 +24,8 @@ package com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.levels.painters.Painter;
|
||||
import com.watabou.utils.Point;
|
||||
import com.watabou.utils.Random;
|
||||
|
||||
public class CirclePitRoom extends StandardRoom {
|
||||
|
||||
@@ -58,5 +60,47 @@ public class CirclePitRoom extends StandardRoom {
|
||||
}
|
||||
|
||||
Painter.fillEllipse( level, this, 3 , Terrain.CHASM );
|
||||
|
||||
//50/100% chance based on size
|
||||
if (sizeCat != SizeCategory.NORMAL && Random.Int(4-sizeFactor()) == 0) {
|
||||
while (true){
|
||||
//draw line from center (plus or minus one in each DIR) to side
|
||||
Point center = center();
|
||||
center.x += Random.IntRange(-1, 1);
|
||||
center.y += Random.IntRange(-1, 1);
|
||||
|
||||
Point edge = new Point(center);
|
||||
switch (Random.Int(4)){
|
||||
case 0:
|
||||
edge.x = left;
|
||||
break;
|
||||
case 1:
|
||||
edge.y = top;
|
||||
break;
|
||||
case 2:
|
||||
edge.x = right;
|
||||
break;
|
||||
case 3:
|
||||
edge.y = bottom;
|
||||
break;
|
||||
}
|
||||
|
||||
boolean valid = true;
|
||||
for (Point door : connected.values()){
|
||||
if (door.equals(edge)){
|
||||
valid = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (valid) {
|
||||
Painter.drawLine(level, edge, center, Terrain.REGION_DECO_SP);
|
||||
Painter.drawInside(level, this, edge, 1, Terrain.EMPTY_SP);
|
||||
Painter.set(level, edge, Terrain.WALL);
|
||||
|
||||
//TODO pick a random cell to make empty_sp?
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* Pixel Dungeon
|
||||
* Copyright (C) 2012-2015 Oleg Dolya
|
||||
*
|
||||
* Shattered Pixel Dungeon
|
||||
* Copyright (C) 2014-2025 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 <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
package com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
|
||||
|
||||
//doesn't look much like a bridge, but can easily use it internally
|
||||
public class CustomDecoBridgeRoom extends StandardBridgeRoom {
|
||||
|
||||
//can be large because the line breaks the space up
|
||||
public float[] sizeCatProbs(){
|
||||
return new float[]{2, 1, 0};
|
||||
}
|
||||
|
||||
protected int maxBridgeWidth( int roomDimension ) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
protected int spaceTile(){
|
||||
return Terrain.REGION_DECO_SP;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int bridgeTile() {
|
||||
return Terrain.EMPTY_SP;
|
||||
}
|
||||
}
|
||||
@@ -140,7 +140,7 @@ public abstract class StandardRoom extends Room {
|
||||
rooms.add(CavesFissureRoom.class);
|
||||
rooms.add(CirclePitRoom.class);
|
||||
rooms.add(CircleWallRoom.class);
|
||||
rooms.add(EmptyRoom.class);
|
||||
rooms.add(CustomDecoBridgeRoom.class);
|
||||
|
||||
rooms.add(HallwayRoom.class);
|
||||
rooms.add(StatuesRoom.class);
|
||||
@@ -177,7 +177,7 @@ public abstract class StandardRoom extends Room {
|
||||
chances[6] = new float[]{0,5,0, 0,0,0,0,0, 10,10,10,5,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 1,1,1,1,1,1,1,1,1,1};
|
||||
chances[10] = chances[9] = chances[8] = chances[7] = chances[6];
|
||||
|
||||
chances[11] = new float[]{0,5,0, 0,0,0,0,0, 0,0,0,0,0, 15,10,5,5,0, 0,0,0,0,0, 0,0,0,0,0, 1,1,1,1,1,1,1,1,1,1};
|
||||
chances[11] = new float[]{0,5,0, 0,0,0,0,0, 0,0,0,0,0, 15,5,5,5,5, 0,0,0,0,0, 0,0,0,0,0, 1,1,1,1,1,1,1,1,1,1};
|
||||
chances[15] = chances[14] = chances[13] = chances[12] = chances[11];
|
||||
|
||||
chances[16] = new float[]{0,0,5, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 10,10,10,5,0, 0,0,0,0,0, 1,1,1,1,1,1,1,1,1,1};
|
||||
|
||||
@@ -32,6 +32,7 @@ import com.shatteredpixel.shatteredpixeldungeon.levels.features.LevelTransition;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.levels.painters.Painter;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.Room;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.StandardRoom;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.exit.CircleWallEntranceRoom;
|
||||
import com.watabou.utils.Point;
|
||||
import com.watabou.utils.Random;
|
||||
import com.watabou.utils.Reflection;
|
||||
@@ -143,7 +144,7 @@ public class EntranceRoom extends StandardRoom {
|
||||
|
||||
rooms.add(CaveEntranceRoom.class);
|
||||
rooms.add(CavesFissureEntranceRoom.class);
|
||||
rooms.add(EntranceRoom.class); //TODO
|
||||
rooms.add(CircleWallEntranceRoom.class);
|
||||
|
||||
rooms.add(HallwayEntranceRoom.class);
|
||||
rooms.add(StatuesEntranceRoom.class);
|
||||
@@ -165,7 +166,7 @@ public class EntranceRoom extends StandardRoom {
|
||||
chances[6] = new float[]{0,2,0, 0,0,0, 4,4,0, 0,0,0, 0,0,0, 0,0,0};
|
||||
chances[10] = chances[9] = chances[8] = chances[7] = chances[6];
|
||||
|
||||
chances[11] = new float[]{0,2,0, 0,0,0, 0,0,0, 4,4,0, 0,0,0, 0,0,0};
|
||||
chances[11] = new float[]{0,3,0, 0,0,0, 0,0,0, 3,2,2, 0,0,0, 0,0,0};
|
||||
chances[15] = chances[14] = chances[13] = chances[12] = chances[11];
|
||||
|
||||
chances[16] = new float[]{0,0,2, 0,0,0, 0,0,0, 0,0,0, 4,4,0, 0,0,0};
|
||||
|
||||
@@ -0,0 +1,86 @@
|
||||
/*
|
||||
* Pixel Dungeon
|
||||
* Copyright (C) 2012-2015 Oleg Dolya
|
||||
*
|
||||
* Shattered Pixel Dungeon
|
||||
* Copyright (C) 2014-2025 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 <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
package com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.exit;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.levels.features.LevelTransition;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.levels.painters.Painter;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.CircleWallRoom;
|
||||
import com.watabou.utils.PathFinder;
|
||||
import com.watabou.utils.Point;
|
||||
import com.watabou.utils.Random;
|
||||
|
||||
public class CircleWallEntranceRoom extends CircleWallRoom {
|
||||
|
||||
@Override
|
||||
public int minWidth() {
|
||||
return Math.max(super.minWidth(), 11);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int minHeight() {
|
||||
return Math.max(super.minHeight(), 11);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float[] sizeCatProbs() {
|
||||
return new float[]{0, 1, 0};
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEntrance() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paint(Level level) {
|
||||
super.paint(level);
|
||||
|
||||
Point p = center();
|
||||
|
||||
int cell = level.pointToCell(p);
|
||||
for (int i : PathFinder.NEIGHBOURS8){
|
||||
if (level.map[cell+2*i] == Terrain.WALL){
|
||||
Painter.set(level, cell+i, Terrain.EMPTY);
|
||||
}
|
||||
}
|
||||
Painter.set(level, p, Terrain.ENTRANCE);
|
||||
level.transitions.add(new LevelTransition(level, level.pointToCell(p), LevelTransition.Type.REGULAR_ENTRANCE));
|
||||
|
||||
int xDir = 0, yDir = 0;
|
||||
if (Random.Int(2) == 0) {
|
||||
xDir = Random.Int(2) == 0 ? 1 : -1;
|
||||
} else {
|
||||
yDir = Random.Int(2) == 0 ? 1 : -1;
|
||||
}
|
||||
|
||||
p.x += 2*xDir;
|
||||
p.y += 2*yDir;
|
||||
|
||||
while (level.map[level.pointToCell(p)] == Terrain.WALL){
|
||||
Painter.set(level, p, Terrain.EMPTY);
|
||||
p.x += xDir;
|
||||
p.y += yDir;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
/*
|
||||
* Pixel Dungeon
|
||||
* Copyright (C) 2012-2015 Oleg Dolya
|
||||
*
|
||||
* Shattered Pixel Dungeon
|
||||
* Copyright (C) 2014-2025 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 <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
package com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.exit;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.levels.features.LevelTransition;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.levels.painters.Painter;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.CircleWallRoom;
|
||||
import com.watabou.utils.PathFinder;
|
||||
import com.watabou.utils.Point;
|
||||
import com.watabou.utils.Random;
|
||||
|
||||
public class CircleWallExitRoom extends CircleWallRoom {
|
||||
|
||||
@Override
|
||||
public int minWidth() {
|
||||
return Math.max(super.minWidth(), 11);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int minHeight() {
|
||||
return Math.max(super.minHeight(), 11);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float[] sizeCatProbs() {
|
||||
return new float[]{0, 1, 0};
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isExit() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paint(Level level) {
|
||||
super.paint(level);
|
||||
|
||||
Point p = center();
|
||||
|
||||
int cell = level.pointToCell(p);
|
||||
for (int i : PathFinder.NEIGHBOURS8){
|
||||
if (level.map[cell+2*i] == Terrain.WALL){
|
||||
Painter.set(level, cell+i, Terrain.EMPTY);
|
||||
}
|
||||
}
|
||||
Painter.set(level, p, Terrain.EXIT);
|
||||
level.transitions.add(new LevelTransition(level, level.pointToCell(p), LevelTransition.Type.REGULAR_EXIT));
|
||||
|
||||
int xDir = 0, yDir = 0;
|
||||
if (Random.Int(2) == 0) {
|
||||
xDir = Random.Int(2) == 0 ? 1 : -1;
|
||||
} else {
|
||||
yDir = Random.Int(2) == 0 ? 1 : -1;
|
||||
}
|
||||
|
||||
p.x += 2*xDir;
|
||||
p.y += 2*yDir;
|
||||
|
||||
while (level.map[level.pointToCell(p)] == Terrain.WALL){
|
||||
Painter.set(level, p, Terrain.EMPTY);
|
||||
p.x += xDir;
|
||||
p.y += yDir;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -86,7 +86,7 @@ public class ExitRoom extends StandardRoom {
|
||||
|
||||
rooms.add(CaveExitRoom.class);
|
||||
rooms.add(CavesFissureExitRoom.class);
|
||||
rooms.add(ExitRoom.class); //todo
|
||||
rooms.add(CircleWallExitRoom.class);
|
||||
|
||||
rooms.add(HallwayExitRoom.class);
|
||||
rooms.add(StatuesExitRoom.class);
|
||||
@@ -107,7 +107,7 @@ public class ExitRoom extends StandardRoom {
|
||||
chances[6] = new float[]{0,2,0, 0,0,0, 4,4,0, 0,0,0, 0,0,0, 0,0,0};
|
||||
chances[10] = chances[9] = chances[8] = chances[7] = chances[6];
|
||||
|
||||
chances[11] = new float[]{0,2,0, 0,0,0, 0,0,0, 4,4,0, 0,0,0, 0,0,0};
|
||||
chances[11] = new float[]{0,2,0, 0,0,0, 0,0,0, 3,3,2, 0,0,0, 0,0,0};
|
||||
chances[15] = chances[14] = chances[13] = chances[12] = chances[11];
|
||||
|
||||
chances[16] = new float[]{0,0,2, 0,0,0, 0,0,0, 0,0,0, 4,4,0, 0,0,0};
|
||||
|
||||
Reference in New Issue
Block a user