v3.1.0: final adjustments to entrance/exit rooms

This commit is contained in:
Evan Debenham
2025-05-01 13:32:29 -04:00
parent a7d17836f0
commit 1c135bc16b
18 changed files with 692 additions and 46 deletions

View File

@@ -65,6 +65,11 @@ public class CellBlockRoom extends StandardRoom {
topBottomDoors = null;
}
int openRooms = rows*cols;
if (openRooms == 9) openRooms--;
//if we're an entrance or exit, one room must be open
boolean guaranteeOpenRoom = isEntrance() || isExit();
for (int x = 0; x < rows; x++){
for (int y = 0; y < cols; y++){
//no center room
@@ -73,8 +78,9 @@ public class CellBlockRoom extends StandardRoom {
int left = internal.left + 1 + (x * (w + Wspacing));
int top = internal.top + 1 + (y * (h + Hspacing));
if (Random.Int(w*h) == 0){
if (Random.Int(w*h) == 0 && (!guaranteeOpenRoom || openRooms > 1)){
Painter.fill(level, left, top, w, h, Terrain.REGION_DECO);
openRooms--;
} else {
Painter.fill(level, left, top, w, h, Terrain.EMPTY_SP);
}

View File

@@ -24,7 +24,7 @@ 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 {
public class RegionDecoBridgeRoom extends StandardBridgeRoom {
//can be large because the line breaks the space up
public float[] sizeCatProbs(){

View File

@@ -28,11 +28,6 @@ import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.Room;
public class RegionDecoPatchRoom extends PatchRoom {
@Override
public float[] sizeCatProbs() {
return new float[]{4, 1, 0};
}
@Override
public int minHeight() {
return Math.max(5, super.minHeight());

View File

@@ -42,12 +42,12 @@ public class RuinsRoom extends PatchRoom {
@Override
protected float fill() {
//fill scales from ~20% at 4x4, to ~50% at 18x18
// normal ~20% to ~30%
// large ~30% to ~40%
// giant ~40% to ~50%
//fill scales from ~30% at 4x4, to ~60% at 18x18
// normal ~30% to ~40%
// large ~40% to ~50%
// giant ~50% to ~60%
int scale = Math.min(width()*height(), 18*18);
return 0.20f + scale/1024f;
return 0.30f + scale/1024f;
}
@Override

View File

@@ -126,14 +126,14 @@ public abstract class StandardRoom extends Room {
rooms.add(WaterBridgeRoom.class);
rooms.add(CircleBasinRoom.class);
rooms.add(SegmentedRoom.class);
rooms.add(RegionDecoLineRoom.class);
rooms.add(SegmentedRoom.class);
rooms.add(PillarsRoom.class);
rooms.add(ChasmBridgeRoom.class);
rooms.add(CellBlockRoom.class);
rooms.add(CaveRoom.class);
rooms.add(CustomDecoBridgeRoom.class);
rooms.add(RegionDecoBridgeRoom.class);
rooms.add(CavesFissureRoom.class);
rooms.add(CirclePitRoom.class);
rooms.add(CircleWallRoom.class);

View File

@@ -0,0 +1,71 @@
/*
* 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.entrance;
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.CellBlockRoom;
import com.watabou.utils.PathFinder;
import com.watabou.utils.Point;
public class CellBlockEntranceRoom extends CellBlockRoom {
@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);
while (true){
Point p = random(3);
if (level.map[level.pointToCell(p)] == Terrain.EMPTY_SP){
boolean valid = true;
for (int i : PathFinder.NEIGHBOURS8){
if (level.map[level.pointToCell(p)+i] == Terrain.DOOR){
valid = false;
}
}
if (valid){
int entrance = level.pointToCell(p);
Painter.set( level, entrance, Terrain.ENTRANCE_SP );
level.transitions.add(new LevelTransition(level, entrance, LevelTransition.Type.REGULAR_ENTRANCE));
return;
}
}
}
}
}

View File

@@ -130,49 +130,50 @@ public class EntranceRoom extends StandardRoom {
private static ArrayList<Class<?extends StandardRoom>> rooms = new ArrayList<>();
static {
rooms.add(EntranceRoom.class);
rooms.add(RegionDecoLineEntranceRoom.class);
rooms.add(StatueLineEntranceRoom.class);
rooms.add(RegionDecoPatchEntranceRoom.class);
rooms.add(WaterBridgeEntranceRoom.class);
rooms.add(CircleBasinEntranceRoom.class);
rooms.add(RingEntranceRoom.class);
rooms.add(CircleBasinEntranceRoom.class);
rooms.add(RegionDecoLineEntranceRoom.class);
rooms.add(ChasmBridgeEntranceRoom.class);
rooms.add(PillarsEntranceRoom.class);
rooms.add(EntranceRoom.class); //TODO
rooms.add(CellBlockEntranceRoom.class);
rooms.add(CaveEntranceRoom.class);
rooms.add(RegionDecoBridgeEntranceRoom.class);
rooms.add(CavesFissureEntranceRoom.class);
rooms.add(CircleWallEntranceRoom.class);
rooms.add(HallwayEntranceRoom.class);
rooms.add(StatuesEntranceRoom.class);
rooms.add(LibraryHallEntranceRoom.class);
rooms.add(LibraryRingEntranceRoom.class);
rooms.add(RegionDecoPatchEntranceRoom.class);
rooms.add(RuinsEntranceRoom.class);
rooms.add(ChasmEntranceRoom.class);
rooms.add(RitualEntranceRoom.class);
rooms.add(RegionDecoPatchEntranceRoom.class);
}
private static float[][] chances = new float[27][];
static {
//first 2 floors only use simpler entrance rooms
chances[1] = new float[]{1,1,0, 1,0,0, 0,0,0, 0,0,0, 0,0,0, 0,0,0};
chances[1] = new float[]{4,3,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0};
chances[2] = chances[1];
chances[3] = new float[]{0,4,0, 4,1,1, 0,0,0, 0,0,0, 0,0,0, 0,0,0};
chances[3] = new float[]{4,3,2,1, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0};
chances[5] = chances[4] = chances[3];
chances[6] = new float[]{0,2,0, 0,0,0, 4,4,0, 0,0,0, 0,0,0, 0,0,0};
chances[6] = new float[]{0,0,0,0, 4,3,2,1, 0,0,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,3,0, 0,0,0, 0,0,0, 3,2,2, 0,0,0, 0,0,0};
chances[11] = new float[]{0,0,0,0, 0,0,0,0, 4,3,2,1, 0,0,0,0, 0,0,0,0};
chances[15] = chances[14] = chances[13] = chances[12] = chances[11];
chances[16] = new float[]{0,0,3, 0,0,0, 0,0,0, 0,0,0, 3,2,2, 0,0,0};
chances[16] = new float[]{0,0,0,0, 0,0,0,0, 0,0,0,0, 4,3,2,1, 0,0,0,0};
chances[20] = chances[19] = chances[18] = chances[17] = chances[16];
chances[21] = new float[]{0,0,2, 0,0,0, 0,0,0, 0,0,0, 0,0,0, 3,2,3};
chances[21] = new float[]{0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 4,3,2,1};
chances[26] = chances[25] = chances[24] = chances[23] = chances[22] = chances[21];
}

View File

@@ -0,0 +1,56 @@
/*
* 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.entrance;
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.LibraryHallRoom;
import com.watabou.utils.Point;
public class LibraryHallEntranceRoom extends LibraryHallRoom {
@Override
public boolean isEntrance() {
return true;
}
@Override
public void paint(Level level) {
super.paint(level);
while (true){
Point p = random(2);
if (level.map[level.pointToCell(p)] == Terrain.REGION_DECO){
int entrance = level.pointToCell(p);
Painter.set( level, entrance, Terrain.ENTRANCE );
level.transitions.add(new LevelTransition(level, entrance, LevelTransition.Type.REGULAR_ENTRANCE));
return;
}
}
}
}

View File

@@ -0,0 +1,74 @@
/*
* 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.entrance;
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.RegionDecoBridgeRoom;
import com.watabou.utils.PathFinder;
public class RegionDecoBridgeEntranceRoom extends RegionDecoBridgeRoom {
@Override
public int minWidth() {
return Math.max(8, super.minWidth());
}
@Override
public int minHeight() {
return Math.max(8, super.minHeight());
}
@Override
public boolean isEntrance() {
return true;
}
@Override
public void paint(Level level) {
super.paint(level);
int entrance;
boolean valid;
do {
valid = true;
entrance = level.pointToCell(random(2));
if (spaceRect.inside(level.cellToPoint(entrance))){
valid = false;
} else {
for (int i : PathFinder.NEIGHBOURS8){
if (level.map[entrance+i] == Terrain.REGION_DECO_ALT){
valid = false;
}
}
}
} while (!valid);
Painter.set( level, entrance, Terrain.ENTRANCE );
level.transitions.add(new LevelTransition(level, entrance, LevelTransition.Type.REGULAR_ENTRANCE));
}
}

View File

@@ -21,12 +21,15 @@
package com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.entrance;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
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.Room;
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.RegionDecoPatchRoom;
import com.watabou.utils.PathFinder;
import com.watabou.utils.Point;
public class RegionDecoPatchEntranceRoom extends RegionDecoPatchRoom {
@@ -45,6 +48,24 @@ public class RegionDecoPatchEntranceRoom extends RegionDecoPatchRoom {
return true;
}
@Override
public boolean canMerge(Level l, Room other, Point p, int mergeTerrain) {
if (Dungeon.depth <= 2) {
return false;
} else {
return super.canMerge(l, other, p, mergeTerrain);
}
}
@Override
public boolean canPlaceTrap(Point p) {
if (Dungeon.depth == 1) {
return false;
} else {
return super.canPlaceTrap(p);
}
}
@Override
public void paint(Level level) {
super.paint(level);
@@ -57,11 +78,11 @@ public class RegionDecoPatchEntranceRoom extends RegionDecoPatchRoom {
//need extra logic here as these rooms can spawn small and cramped in very rare cases
if (tries-- > 0){
valid = level.map[entrance] != Terrain.WALL && level.findMob(entrance) == null;
valid = level.map[entrance] != Terrain.REGION_DECO && level.findMob(entrance) == null;
} else {
valid = false;
for (int i : PathFinder.NEIGHBOURS4){
if (level.map[entrance+i] != Terrain.WALL){
if (level.map[entrance+i] != Terrain.REGION_DECO){
valid = true;
}
}
@@ -74,7 +95,11 @@ public class RegionDecoPatchEntranceRoom extends RegionDecoPatchRoom {
Painter.set( level, entrance+i, Terrain.EMPTY );
}
level.transitions.add(new LevelTransition(level, entrance, LevelTransition.Type.REGULAR_ENTRANCE));
if (Dungeon.depth == 1){
level.transitions.add(new LevelTransition(level, entrance, LevelTransition.Type.SURFACE));
} else {
level.transitions.add(new LevelTransition(level, entrance, LevelTransition.Type.REGULAR_ENTRANCE));
}
}
}

View File

@@ -0,0 +1,84 @@
/*
* 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.entrance;
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.RuinsRoom;
import com.watabou.utils.PathFinder;
public class RuinsEntranceRoom extends RuinsRoom {
@Override
public int minWidth() {
return Math.max(super.minWidth(), 7);
}
@Override
public int minHeight() {
return Math.max(super.minHeight(), 7);
}
@Override
public boolean isEntrance() {
return true;
}
@Override
public float[] sizeCatProbs() {
return new float[]{2, 1, 0};
}
@Override
public void paint(Level level) {
super.paint(level);
int entrance;
int tries = 30;
boolean valid;
do {
entrance = level.pointToCell(random(2));
//need extra logic here as these rooms can spawn small and cramped in very rare cases
if (tries-- > 0){
valid = level.map[entrance] != Terrain.WALL && level.findMob(entrance) == null;
} else {
valid = false;
for (int i : PathFinder.NEIGHBOURS4){
if (level.map[entrance+i] != Terrain.WALL && level.map[entrance+i] != Terrain.REGION_DECO){
valid = true;
}
}
valid = valid && level.findMob(entrance) == null;
}
} while (!valid);
Painter.set( level, entrance, Terrain.ENTRANCE );
for (int i : PathFinder.NEIGHBOURS8){
Painter.set( level, entrance+i, Terrain.EMPTY );
}
level.transitions.add(new LevelTransition(level, entrance, LevelTransition.Type.REGULAR_ENTRANCE));
}
}

View File

@@ -21,12 +21,15 @@
package com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.entrance;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
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.Room;
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.WaterBridgeRoom;
import com.watabou.utils.PathFinder;
import com.watabou.utils.Point;
public class WaterBridgeEntranceRoom extends WaterBridgeRoom {
@@ -45,6 +48,24 @@ public class WaterBridgeEntranceRoom extends WaterBridgeRoom {
return true;
}
@Override
public boolean canMerge(Level l, Room other, Point p, int mergeTerrain) {
if (Dungeon.depth <= 2) {
return false;
} else {
return super.canMerge(l, other, p, mergeTerrain);
}
}
@Override
public boolean canPlaceTrap(Point p) {
if (Dungeon.depth == 1) {
return false;
} else {
return super.canPlaceTrap(p);
}
}
@Override
public void paint(Level level) {
super.paint(level);
@@ -60,6 +81,10 @@ public class WaterBridgeEntranceRoom extends WaterBridgeRoom {
}
Painter.set( level, entrance, Terrain.ENTRANCE );
level.transitions.add(new LevelTransition(level, entrance, LevelTransition.Type.REGULAR_ENTRANCE));
if (Dungeon.depth == 1){
level.transitions.add(new LevelTransition(level, entrance, LevelTransition.Type.SURFACE));
} else {
level.transitions.add(new LevelTransition(level, entrance, LevelTransition.Type.REGULAR_ENTRANCE));
}
}
}

View File

@@ -0,0 +1,76 @@
/*
* 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.CellBlockRoom;
import com.watabou.utils.PathFinder;
import com.watabou.utils.Point;
public class CellBlockExitRoom extends CellBlockRoom {
@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);
while (true){
Point p = random(3);
if (level.map[level.pointToCell(p)] == Terrain.EMPTY_SP){
boolean valid = true;
for (int i : PathFinder.NEIGHBOURS8){
if (level.map[level.pointToCell(p)+i] == Terrain.DOOR){
valid = false;
}
}
if (valid){
int entrance = level.pointToCell(p);
Painter.set( level, entrance, Terrain.EXIT );
level.transitions.add(new LevelTransition(level, entrance, LevelTransition.Type.REGULAR_EXIT));
return;
}
}
}
}
@Override
public boolean canPlaceCharacter(Point p, Level l) {
return super.canPlaceCharacter(p, l) && l.pointToCell(p) != l.exit();
}
}

View File

@@ -72,48 +72,49 @@ public class ExitRoom extends StandardRoom {
private static ArrayList<Class<?extends StandardRoom>> rooms = new ArrayList<>();
static {
rooms.add(ExitRoom.class);
rooms.add(RegionDecoLineExitRoom.class);
rooms.add(StatueLineExitRoom.class);
rooms.add(RegionDecoPatchExitRoom.class);
rooms.add(WaterBridgeExitRoom.class);
rooms.add(CircleBasinExitRoom.class);
rooms.add(RingExitRoom.class);
rooms.add(CircleBasinExitRoom.class);
rooms.add(RegionDecoLineExitRoom.class);
rooms.add(ChasmBridgeExitRoom.class);
rooms.add(PillarsExitRoom.class);
rooms.add(ExitRoom.class); //todo
rooms.add(CellBlockExitRoom.class);
rooms.add(CaveExitRoom.class);
rooms.add(RegionDecoBridgeExitRoom.class);
rooms.add(CavesFissureExitRoom.class);
rooms.add(CircleWallExitRoom.class);
rooms.add(HallwayExitRoom.class);
rooms.add(StatuesExitRoom.class);
rooms.add(LibraryHallExitRoom.class);
rooms.add(LibraryRingExitRoom.class);
rooms.add(RegionDecoPatchExitRoom.class);
rooms.add(RuinsExitRoom.class);
rooms.add(ChasmExitRoom.class);
rooms.add(RitualExitRoom.class);
rooms.add(RegionDecoPatchExitRoom.class);
}
private static float[][] chances = new float[27][];
static {
//floor 1 only uses simpler exit rooms
chances[1] = new float[]{1,1,0, 1,0,0, 0,0,0, 0,0,0, 0,0,0, 0,0,0};
chances[2] = new float[]{0,4,0, 4,1,1, 0,0,0, 0,0,0, 0,0,0, 0,0,0};
chances[1] = new float[]{4,3,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0};
chances[2] = new float[]{4,3,2,1, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0};
chances[5] = chances[4] = chances[3] = chances[2];
chances[6] = new float[]{0,2,0, 0,0,0, 4,4,0, 0,0,0, 0,0,0, 0,0,0};
chances[6] = new float[]{0,0,0,0, 4,3,2,1, 0,0,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, 3,3,2, 0,0,0, 0,0,0};
chances[11] = new float[]{0,0,0,0, 0,0,0,0, 4,3,2,1, 0,0,0,0, 0,0,0,0};
chances[15] = chances[14] = chances[13] = chances[12] = chances[11];
chances[16] = new float[]{0,0,3, 0,0,0, 0,0,0, 0,0,0, 3,2,2, 0,0,0};
chances[16] = new float[]{0,0,0,0, 0,0,0,0, 0,0,0,0, 4,3,2,1, 0,0,0,0};
chances[20] = chances[19] = chances[18] = chances[17] = chances[16];
chances[21] = new float[]{0,0,2, 0,0,0, 0,0,0, 0,0,0, 0,0,0, 3,2,3};
chances[21] = new float[]{0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 4,3,2,1};
chances[26] = chances[25] = chances[24] = chances[23] = chances[22] = chances[21];
}

View File

@@ -0,0 +1,61 @@
/*
* 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.LibraryHallRoom;
import com.watabou.utils.Point;
public class LibraryHallExitRoom extends LibraryHallRoom {
@Override
public boolean isExit() {
return true;
}
@Override
public void paint(Level level) {
super.paint(level);
while (true){
Point p = random(2);
if (level.map[level.pointToCell(p)] == Terrain.REGION_DECO){
int exit = level.pointToCell(p);
Painter.set( level, exit, Terrain.EXIT );
level.transitions.add(new LevelTransition(level, exit, LevelTransition.Type.REGULAR_EXIT));
return;
}
}
}
@Override
public boolean canPlaceCharacter(Point p, Level l) {
return super.canPlaceCharacter(p, l) && l.pointToCell(p) != l.exit();
}
}

View File

@@ -0,0 +1,80 @@
/*
* 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.RegionDecoBridgeRoom;
import com.watabou.utils.PathFinder;
import com.watabou.utils.Point;
public class RegionDecoBridgeExitRoom extends RegionDecoBridgeRoom {
@Override
public int minWidth() {
return Math.max(8, super.minWidth());
}
@Override
public int minHeight() {
return Math.max(8, super.minHeight());
}
@Override
public boolean isExit() {
return true;
}
@Override
public void paint(Level level) {
super.paint(level);
int exit;
boolean valid;
do {
valid = true;
exit = level.pointToCell(random(2));
if (spaceRect.inside(level.cellToPoint(exit))){
valid = false;
} else {
for (int i : PathFinder.NEIGHBOURS8){
if (level.map[exit+i] == Terrain.REGION_DECO_ALT){
valid = false;
}
}
}
} while (!valid);
Painter.set( level, exit, Terrain.EXIT );
level.transitions.add(new LevelTransition(level, exit, LevelTransition.Type.REGULAR_EXIT));
}
@Override
public boolean canPlaceCharacter(Point p, Level l) {
return super.canPlaceCharacter(p, l) && l.pointToCell(p) != l.exit();
}
}

View File

@@ -58,11 +58,11 @@ public class RegionDecoPatchExitRoom extends RegionDecoPatchRoom {
//need extra logic here as these rooms can spawn small and cramped in very rare cases
if (tries-- > 0){
valid = level.map[exit] != Terrain.WALL && level.findMob(exit) == null;
valid = level.map[exit] != Terrain.REGION_DECO && level.findMob(exit) == null;
} else {
valid = false;
for (int i : PathFinder.NEIGHBOURS4){
if (level.map[exit+i] != Terrain.WALL){
if (level.map[exit+i] != Terrain.REGION_DECO){
valid = true;
}
}

View File

@@ -0,0 +1,91 @@
/*
* 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.RuinsRoom;
import com.watabou.utils.PathFinder;
import com.watabou.utils.Point;
public class RuinsExitRoom extends RuinsRoom {
@Override
public int minWidth() {
return Math.max(super.minWidth(), 7);
}
@Override
public int minHeight() {
return Math.max(super.minHeight(), 7);
}
@Override
public boolean isExit() {
return true;
}
@Override
public float[] sizeCatProbs() {
return new float[]{2, 1, 0};
}
@Override
public void paint(Level level) {
super.paint(level);
int exit;
int tries = 30;
boolean valid;
do {
exit = level.pointToCell(random(2));
//need extra logic here as these rooms can spawn small and cramped in very rare cases
if (tries-- > 0){
valid = level.map[exit] != Terrain.WALL && level.findMob(exit) == null;
} else {
valid = false;
for (int i : PathFinder.NEIGHBOURS4){
if (level.map[exit+i] != Terrain.WALL && level.map[exit+i] != Terrain.REGION_DECO){
valid = true;
}
}
valid = valid && level.findMob(exit) == null;
}
} while (!valid);
Painter.set( level, exit, Terrain.EXIT );
for (int i : PathFinder.NEIGHBOURS8){
Painter.set( level, exit+i, Terrain.EMPTY );
}
level.transitions.add(new LevelTransition(level, exit, LevelTransition.Type.REGULAR_EXIT));
}
@Override
public boolean canPlaceCharacter(Point p, Level l) {
return super.canPlaceCharacter(p, l) && l.pointToCell(p) != l.exit();
}
}