From 6f8b31769b60d1be049d6fb5cb32e95ce3f89a4c Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Thu, 24 Apr 2025 15:58:36 -0400 Subject: [PATCH] v3.1.0: expanded standard rooms in the sewers --- .../rooms/standard/RegionDecoPatchRoom.java | 75 +++++++++++++++++++ .../levels/rooms/standard/RingRoom.java | 35 ++++++++- .../levels/rooms/standard/SewerPipeRoom.java | 2 +- .../rooms/standard/StandardBridgeRoom.java | 8 +- .../levels/rooms/standard/StandardRoom.java | 8 +- .../rooms/standard/entrance/EntranceRoom.java | 10 +-- .../standard/entrance/RingEntranceRoom.java | 52 +++++++++++++ .../levels/rooms/standard/exit/ExitRoom.java | 8 +- .../rooms/standard/exit/RingExitRoom.java | 52 +++++++++++++ 9 files changed, 234 insertions(+), 16 deletions(-) create mode 100644 core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/standard/RegionDecoPatchRoom.java create mode 100644 core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/standard/entrance/RingEntranceRoom.java create mode 100644 core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/standard/exit/RingExitRoom.java diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/standard/RegionDecoPatchRoom.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/standard/RegionDecoPatchRoom.java new file mode 100644 index 000000000..a9088e82d --- /dev/null +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/standard/RegionDecoPatchRoom.java @@ -0,0 +1,75 @@ +/* + * 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 + */ + +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.shatteredpixel.shatteredpixeldungeon.levels.rooms.Room; + +public class RegionDecoPatchRoom extends PatchRoom { + + @Override + public int minHeight() { + return Math.max(5, super.minHeight()); + } + + @Override + public int minWidth() { + return Math.max(5, super.minWidth()); + } + + @Override + protected float fill() { + //fill scales from ~30% at 4x4, to ~50% at 10x10 + int scale = Math.min(width()*height(), 10*10); + return 0.30f + scale/512f; + } + + @Override + protected int clustering() { + return 2; + } + + @Override + protected boolean ensurePath() { + return connected.size() > 0; + } + + @Override + protected boolean cleanEdges() { + return true; + } + + @Override + public void paint(Level level) { + Painter.fill( level, this, Terrain.WALL ); + Painter.fill( level, this, 1 , Terrain.EMPTY ); + for (Room.Door door : connected.values()) { + door.set( Room.Door.Type.REGULAR ); + } + + setupPatch(level); + fillPatch(level, Terrain.REGION_DECO); + } + +} diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/standard/RingRoom.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/standard/RingRoom.java index 5f160386b..67d04f0f5 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/standard/RingRoom.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/standard/RingRoom.java @@ -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 RingRoom extends StandardRoom { @@ -48,11 +50,42 @@ public class RingRoom extends StandardRoom { Painter.fill( level, this, 1 , Terrain.EMPTY ); int minDim = Math.min(width(), height()); - int passageWidth = (int)Math.floor(0.25f*(minDim+1)); + int passageWidth = (int)Math.floor(0.2f*(minDim+3)); Painter.fill(level, this, passageWidth+1, Terrain.WALL); + + if (minDim >= 10){ + Painter.fill(level, this, passageWidth+2, centerDecoTiles()); + Point center = center(); + 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; + } + + Painter.set(level, center, Terrain.EMPTY_SP); + placeCenterDetail(level, level.pointToCell(center)); + + center.x += xDir; + center.y += yDir; + while (level.map[level.pointToCell(center)] != Terrain.WALL){ + Painter.set(level, center, Terrain.EMPTY_SP); + center.x += xDir; + center.y += yDir; + } + Painter.set(level, center, Terrain.DOOR); + } for (Door door : connected.values()) { door.set( Door.Type.REGULAR ); } } + + protected int centerDecoTiles(){ + return Terrain.REGION_DECO_SP; + } + + protected void placeCenterDetail(Level level, int pos){ + level.drop(level.findPrizeItem(), pos); + } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/standard/SewerPipeRoom.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/standard/SewerPipeRoom.java index d6565b46f..dd3c36099 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/standard/SewerPipeRoom.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/standard/SewerPipeRoom.java @@ -48,7 +48,7 @@ public class SewerPipeRoom extends StandardRoom { @Override public float[] sizeCatProbs() { - return new float[]{4, 2, 1}; + return new float[]{3, 2, 1}; } @Override diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/standard/StandardBridgeRoom.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/standard/StandardBridgeRoom.java index e48c3c7a2..85a79ba00 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/standard/StandardBridgeRoom.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/standard/StandardBridgeRoom.java @@ -169,11 +169,17 @@ public abstract class StandardBridgeRoom extends StandardRoom { } Painter.fill(level, spaceRect, spaceTile()); - Painter.fill(level, bridgeRect, Terrain.EMPTY_SP); + Painter.fill(level, bridgeRect, bridgeTile()); } protected abstract int maxBridgeWidth( int roomDimension ); protected abstract int spaceTile(); + + //defaults to special terrain + protected int bridgeTile(){ + return Terrain.EMPTY_SP; + } + } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/standard/StandardRoom.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/standard/StandardRoom.java index 5519634be..e1372b55c 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/standard/StandardRoom.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/standard/StandardRoom.java @@ -128,7 +128,7 @@ public abstract class StandardRoom extends Room { rooms.add(RingRoom.class); rooms.add(WaterBridgeRoom.class); rooms.add(CircleBasinRoom.class); - rooms.add(EmptyRoom.class); //TODO + rooms.add(RegionDecoPatchRoom.class); rooms.add(SegmentedRoom.class); rooms.add(PillarsRoom.class); @@ -169,10 +169,10 @@ public abstract class StandardRoom extends Room { private static float[][] chances = new float[27][]; static { - chances[1] = new float[]{0,5,0, 10,10,10,5,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 1,0,1,0,1,0,1,1,0,0}; - chances[2] = new float[]{0,5,0, 10,10,10,5,0, 0,0,0,0,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[1] = new float[]{0,5,0, 15,5,5,5,5, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 1,0,1,0,1,0,1,1,0,0}; + chances[2] = new float[]{0,5,0, 15,5,5,5,5, 0,0,0,0,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[4] = chances[3] = chances[2]; - chances[5] = new float[]{0,5,0, 10,10,10,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0}; + chances[5] = new float[]{0,5,0, 15,5,5,0,5, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0}; 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]; diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/standard/entrance/EntranceRoom.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/standard/entrance/EntranceRoom.java index a3207e2ad..7d1124815 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/standard/entrance/EntranceRoom.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/standard/entrance/EntranceRoom.java @@ -135,7 +135,7 @@ public class EntranceRoom extends StandardRoom { rooms.add(WaterBridgeEntranceRoom.class); rooms.add(CircleBasinEntranceRoom.class); - rooms.add(EntranceRoom.class); //TODO + rooms.add(RingEntranceRoom.class); rooms.add(ChasmBridgeEntranceRoom.class); rooms.add(PillarsEntranceRoom.class); @@ -156,12 +156,10 @@ public class EntranceRoom extends StandardRoom { private static float[][] chances = new float[27][]; static { - //first 2 floors only use empty room. - // First floor is to give a simple start room - // 2nd floor for tutorialization - chances[1] = new float[]{1,0,0, 0,0,0, 0,0,0, 0,0,0, 0,0,0, 0,0,0}; + //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[2] = chances[1]; - chances[3] = new float[]{0,3,0, 6,1,0, 0,0,0, 0,0,0, 0,0,0, 0,0,0}; + chances[3] = new float[]{0,4,0, 4,1,1, 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}; diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/standard/entrance/RingEntranceRoom.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/standard/entrance/RingEntranceRoom.java new file mode 100644 index 000000000..16e0a5fea --- /dev/null +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/standard/entrance/RingEntranceRoom.java @@ -0,0 +1,52 @@ +/* + * 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 + */ + +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.RingRoom; + +public class RingEntranceRoom extends RingRoom { + + @Override + public float[] sizeCatProbs() { + return new float[]{0, 1, 0}; + } + + @Override + public boolean isEntrance() { + return true; + } + + protected int centerDecoTiles(){ + return Terrain.EMPTY_SP; + } + + @Override + protected void placeCenterDetail(Level level, int pos) { + Painter.set(level, pos, Terrain.ENTRANCE_SP); + level.transitions.add(new LevelTransition(level, pos, LevelTransition.Type.REGULAR_ENTRANCE)); + } + +} diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/standard/exit/ExitRoom.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/standard/exit/ExitRoom.java index 53a4acbe8..5e77b4b9e 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/standard/exit/ExitRoom.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/standard/exit/ExitRoom.java @@ -78,7 +78,7 @@ public class ExitRoom extends StandardRoom { rooms.add(WaterBridgeExitRoom.class); rooms.add(CircleBasinExitRoom.class); - rooms.add(ExitRoom.class); //todo + rooms.add(RingExitRoom.class); rooms.add(ChasmBridgeExitRoom.class); rooms.add(PillarsExitRoom.class); @@ -99,8 +99,10 @@ public class ExitRoom extends StandardRoom { private static float[][] chances = new float[27][]; static { - chances[1] = new float[]{0,3,0, 6,1,0, 0,0,0, 0,0,0, 0,0,0, 0,0,0}; - chances[5] = chances[4] = chances[3] = chances[2] = chances[1]; + //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[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[10] = chances[9] = chances[8] = chances[7] = chances[6]; diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/standard/exit/RingExitRoom.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/standard/exit/RingExitRoom.java new file mode 100644 index 000000000..6fc382ed4 --- /dev/null +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/standard/exit/RingExitRoom.java @@ -0,0 +1,52 @@ +/* + * 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 + */ + +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.RingRoom; + +public class RingExitRoom extends RingRoom { + + @Override + public float[] sizeCatProbs() { + return new float[]{0, 1, 0}; + } + + @Override + public boolean isExit() { + return true; + } + + protected int centerDecoTiles(){ + return Terrain.EMPTY_SP; + } + + @Override + protected void placeCenterDetail(Level level, int pos) { + Painter.set(level, pos, Terrain.EXIT); + level.transitions.add(new LevelTransition(level, pos, LevelTransition.Type.REGULAR_EXIT)); + } + +}