From 757051d8e7c44ee6a8ee6f2e8d7838d414d93a3a Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Mon, 22 Apr 2024 20:51:35 -0400 Subject: [PATCH] v2.4.0: added 5 new entrance and exit variants based on existing rooms --- .../entrance/CavesFissureEntranceRoom.java | 64 +++++++++++++++++ .../entrance/ChasmBridgeEntranceRoom.java | 68 +++++++++++++++++++ .../rooms/standard/entrance/EntranceRoom.java | 17 +++-- .../standard/entrance/RitualEntranceRoom.java | 43 ++++++++++++ .../entrance/StatuesEntranceRoom.java | 63 +++++++++++++++++ .../entrance/WaterBridgeEntranceRoom.java | 67 ++++++++++++++++++ .../standard/exit/CavesFissureExitRoom.java | 67 ++++++++++++++++++ .../standard/exit/ChasmBridgeExitRoom.java | 68 +++++++++++++++++++ .../levels/rooms/standard/exit/ExitRoom.java | 16 +++-- .../rooms/standard/exit/RitualExitRoom.java | 43 ++++++++++++ .../rooms/standard/exit/StatuesExitRoom.java | 64 +++++++++++++++++ .../standard/exit/WaterBridgeExitRoom.java | 68 +++++++++++++++++++ 12 files changed, 636 insertions(+), 12 deletions(-) create mode 100644 core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/standard/entrance/CavesFissureEntranceRoom.java create mode 100644 core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/standard/entrance/ChasmBridgeEntranceRoom.java create mode 100644 core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/standard/entrance/RitualEntranceRoom.java create mode 100644 core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/standard/entrance/StatuesEntranceRoom.java create mode 100644 core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/standard/entrance/WaterBridgeEntranceRoom.java create mode 100644 core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/standard/exit/CavesFissureExitRoom.java create mode 100644 core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/standard/exit/ChasmBridgeExitRoom.java create mode 100644 core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/standard/exit/RitualExitRoom.java create mode 100644 core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/standard/exit/StatuesExitRoom.java create mode 100644 core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/standard/exit/WaterBridgeExitRoom.java diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/standard/entrance/CavesFissureEntranceRoom.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/standard/entrance/CavesFissureEntranceRoom.java new file mode 100644 index 000000000..d9c210c63 --- /dev/null +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/standard/entrance/CavesFissureEntranceRoom.java @@ -0,0 +1,64 @@ +/* + * Pixel Dungeon + * Copyright (C) 2012-2015 Oleg Dolya + * + * Shattered Pixel Dungeon + * Copyright (C) 2014-2024 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.CavesFissureRoom; +import com.watabou.utils.PathFinder; + +public class CavesFissureEntranceRoom extends CavesFissureRoom { + + @Override + public float[] sizeCatProbs() { + return new float[]{3, 1, 0}; + } + + @Override + public boolean isEntrance() { + return true; + } + + @Override + public void paint(Level level) { + super.paint(level); + + int exit; + do { + exit = level.pointToCell(random(2)); + + } while (level.map[exit] == Terrain.CHASM || level.map[exit] == Terrain.EMPTY_SP || level.findMob(exit) != null); + + + for (int i : PathFinder.NEIGHBOURS8){ + if (level.map[exit+i] == Terrain.CHASM) { + Painter.set(level, exit + i, Terrain.EMPTY); + } + } + + Painter.set( level, exit, Terrain.EXIT ); + level.transitions.add(new LevelTransition(level, exit, LevelTransition.Type.REGULAR_EXIT)); + + } +} diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/standard/entrance/ChasmBridgeEntranceRoom.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/standard/entrance/ChasmBridgeEntranceRoom.java new file mode 100644 index 000000000..3617eaf54 --- /dev/null +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/standard/entrance/ChasmBridgeEntranceRoom.java @@ -0,0 +1,68 @@ +/* + * Pixel Dungeon + * Copyright (C) 2012-2015 Oleg Dolya + * + * Shattered Pixel Dungeon + * Copyright (C) 2014-2024 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.ChasmBridgeRoom; +import com.watabou.utils.PathFinder; + +public class ChasmBridgeEntranceRoom extends ChasmBridgeRoom { + + @Override + public int minWidth() { + return Math.max(7, super.minWidth()); + } + + @Override + public int minHeight() { + return Math.max(7, super.minHeight()); + } + + @Override + public boolean isEntrance() { + return true; + } + + @Override + public void paint(Level level) { + super.paint(level); + + int entrance; + do { + entrance = level.pointToCell(random(2)); + + } while (spaceRect.inside(level.cellToPoint(entrance)) || level.findMob(entrance) != null); + + for (int i : PathFinder.NEIGHBOURS8){ + if (level.map[entrance+i] == Terrain.CHASM) { + Painter.set(level, entrance + i, Terrain.EMPTY); + } + } + + Painter.set( level, entrance, Terrain.ENTRANCE ); + level.transitions.add(new LevelTransition(level, entrance, LevelTransition.Type.REGULAR_ENTRANCE)); + } + +} 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 ee53630a8..e614338d4 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 @@ -139,34 +139,39 @@ public class EntranceRoom extends StandardRoom { rooms.add(EntranceRoom.class); + rooms.add(WaterBridgeEntranceRoom.class); rooms.add(CircleBasinEntranceRoom.class); + rooms.add(ChasmBridgeEntranceRoom.class); rooms.add(PillarsEntranceRoom.class); rooms.add(CaveEntranceRoom.class); + rooms.add(CavesFissureEntranceRoom.class); rooms.add(HallwayEntranceRoom.class); + rooms.add(StatuesEntranceRoom.class); rooms.add(ChasmEntranceRoom.class); + rooms.add(RitualEntranceRoom.class); } private static float[][] chances = new float[27][]; static { - chances[1] = new float[]{1, 0, 0, 0, 0, 0}; + chances[1] = new float[]{1, 0,0, 0,0, 0,0, 0,0, 0,0}; chances[2] = chances[1]; - chances[3] = new float[]{5, 2, 0, 0, 0, 0}; + chances[3] = new float[]{3, 6,1, 0,0, 0,0, 0,0, 0,0}; chances[5] = chances[4] = chances[3]; - chances[6] = new float[]{5, 0, 5, 0, 0, 0}; + chances[6] = new float[]{2, 0,0, 4,4, 0,0, 0,0, 0,0}; chances[10] = chances[9] = chances[8] = chances[7] = chances[6]; - chances[11] = new float[]{5, 0, 0, 5, 0, 0}; + chances[11] = new float[]{2, 0,0, 0,0, 4,4, 0,0, 0,0}; chances[15] = chances[14] = chances[13] = chances[12] = chances[11]; - chances[16] = new float[]{5, 0, 0, 0, 5, 0}; + chances[16] = new float[]{2, 0,0, 0,0, 0,0, 4,4, 0,0}; chances[20] = chances[19] = chances[18] = chances[17] = chances[16]; - chances[21] = new float[]{5, 0, 0, 0, 0, 5}; + chances[21] = new float[]{3, 0,0, 0,0, 0,0, 0,0, 6,1}; chances[26] = chances[25] = chances[24] = chances[23] = chances[22] = chances[21]; } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/standard/entrance/RitualEntranceRoom.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/standard/entrance/RitualEntranceRoom.java new file mode 100644 index 000000000..60fbe0c92 --- /dev/null +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/standard/entrance/RitualEntranceRoom.java @@ -0,0 +1,43 @@ +/* + * Pixel Dungeon + * Copyright (C) 2012-2015 Oleg Dolya + * + * Shattered Pixel Dungeon + * Copyright (C) 2014-2024 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.RitualRoom; +import com.watabou.utils.Point; + +public class RitualEntranceRoom extends RitualRoom { + + @Override + public boolean isEntrance() { + return true; + } + + @Override + protected void placeloot(Level level, Point p) { + Painter.set(level, p, Terrain.ENTRANCE); + level.transitions.add(new LevelTransition(level, level.pointToCell(p), LevelTransition.Type.REGULAR_ENTRANCE)); + } +} diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/standard/entrance/StatuesEntranceRoom.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/standard/entrance/StatuesEntranceRoom.java new file mode 100644 index 000000000..8471ba973 --- /dev/null +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/standard/entrance/StatuesEntranceRoom.java @@ -0,0 +1,63 @@ +/* + * Pixel Dungeon + * Copyright (C) 2012-2015 Oleg Dolya + * + * Shattered Pixel Dungeon + * Copyright (C) 2014-2024 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.StatuesRoom; +import com.watabou.utils.PathFinder; + +public class StatuesEntranceRoom extends StatuesRoom { + + @Override + public float[] sizeCatProbs() { + return new float[]{3, 1, 0}; + } + + @Override + public boolean isEntrance() { + return true; + } + + @Override + public void paint(Level level) { + super.paint(level); + + int entrance = level.pointToCell(center()); + + if (width() <= 10 && height()<= 10){ + Painter.fill(level, this, 3, Terrain.EMPTY_SP); + } + + for (int i : PathFinder.NEIGHBOURS8){ + if (level.map[entrance + i] != Terrain.STATUE_SP) { + Painter.set(level, entrance + i, Terrain.EMPTY_SP); + } + } + + Painter.set( level, entrance, Terrain.ENTRANCE_SP ); + level.transitions.add(new LevelTransition(level, entrance, LevelTransition.Type.REGULAR_ENTRANCE)); + + } +} diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/standard/entrance/WaterBridgeEntranceRoom.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/standard/entrance/WaterBridgeEntranceRoom.java new file mode 100644 index 000000000..35e48d5a4 --- /dev/null +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/standard/entrance/WaterBridgeEntranceRoom.java @@ -0,0 +1,67 @@ +/* + * Pixel Dungeon + * Copyright (C) 2012-2015 Oleg Dolya + * + * Shattered Pixel Dungeon + * Copyright (C) 2014-2024 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.WaterBridgeRoom; +import com.watabou.utils.PathFinder; + +public class WaterBridgeEntranceRoom extends WaterBridgeRoom { + + @Override + public int minWidth() { + return Math.max(7, super.minWidth()); + } + + @Override + public int minHeight() { + return Math.max(7, super.minHeight()); + } + + @Override + public boolean isEntrance() { + return true; + } + + @Override + public void paint(Level level) { + super.paint(level); + + int entrance; + do { + entrance = level.pointToCell(random(2)); + + } while (spaceRect.inside(level.cellToPoint(entrance)) || level.findMob(entrance) != null); + + for (int i : PathFinder.NEIGHBOURS8){ + if (level.map[entrance+i] == Terrain.WATER) { + Painter.set(level, entrance + i, Terrain.EMPTY); + } + } + + Painter.set( level, entrance, Terrain.ENTRANCE ); + level.transitions.add(new LevelTransition(level, entrance, LevelTransition.Type.REGULAR_ENTRANCE)); + } +} diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/standard/exit/CavesFissureExitRoom.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/standard/exit/CavesFissureExitRoom.java new file mode 100644 index 000000000..9092a0025 --- /dev/null +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/standard/exit/CavesFissureExitRoom.java @@ -0,0 +1,67 @@ +/* + * Pixel Dungeon + * Copyright (C) 2012-2015 Oleg Dolya + * + * Shattered Pixel Dungeon + * Copyright (C) 2014-2024 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.CavesFissureRoom; +import com.watabou.utils.PathFinder; + +public class CavesFissureExitRoom extends CavesFissureRoom { + + @Override + public float[] sizeCatProbs() { + return new float[]{3, 1, 0}; + } + + @Override + public boolean isExit() { + return true; + } + + @Override + public void paint(Level level) { + super.paint(level); + + int entrance; + do { + entrance = level.pointToCell(random(2)); + + } while (level.map[entrance] == Terrain.CHASM + || level.map[entrance] == Terrain.EMPTY_SP + || level.findMob(entrance) != null); + + + for (int i : PathFinder.NEIGHBOURS8){ + if (level.map[entrance+i] == Terrain.CHASM) { + Painter.set(level, entrance + i, Terrain.EMPTY); + } + } + + Painter.set( level, entrance, Terrain.ENTRANCE ); + level.transitions.add(new LevelTransition(level, entrance, LevelTransition.Type.REGULAR_ENTRANCE)); + + } + +} diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/standard/exit/ChasmBridgeExitRoom.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/standard/exit/ChasmBridgeExitRoom.java new file mode 100644 index 000000000..b4b369a6e --- /dev/null +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/standard/exit/ChasmBridgeExitRoom.java @@ -0,0 +1,68 @@ +/* + * Pixel Dungeon + * Copyright (C) 2012-2015 Oleg Dolya + * + * Shattered Pixel Dungeon + * Copyright (C) 2014-2024 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.ChasmBridgeRoom; +import com.watabou.utils.PathFinder; + +public class ChasmBridgeExitRoom extends ChasmBridgeRoom { + + @Override + public int minWidth() { + return Math.max(7, super.minWidth()); + } + + @Override + public int minHeight() { + return Math.max(7, super.minHeight()); + } + + @Override + public boolean isExit() { + return true; + } + + @Override + public void paint(Level level) { + super.paint(level); + + int exit; + do { + exit = level.pointToCell(random(2)); + + } while (spaceRect.inside(level.cellToPoint(exit)) || level.findMob(exit) != null); + + for (int i : PathFinder.NEIGHBOURS8){ + if (level.map[exit+i] == Terrain.CHASM) { + Painter.set(level, exit + i, Terrain.EMPTY); + } + } + + Painter.set( level, exit, Terrain.EXIT ); + level.transitions.add(new LevelTransition(level, exit, LevelTransition.Type.REGULAR_EXIT)); + } + +} 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 5e67e1a09..e28f88826 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 @@ -81,33 +81,37 @@ public class ExitRoom extends StandardRoom { static { rooms.add(ExitRoom.class); - + rooms.add(WaterBridgeExitRoom.class); rooms.add(CircleBasinExitRoom.class); + rooms.add(ChasmBridgeExitRoom.class); rooms.add(PillarsExitRoom.class); + rooms.add(CavesFissureExitRoom.class); rooms.add(CaveExitRoom.class); rooms.add(HallwayExitRoom.class); + rooms.add(StatuesExitRoom.class); rooms.add(ChasmExitRoom.class); + rooms.add(RitualExitRoom.class); } private static float[][] chances = new float[27][]; static { - chances[1] = new float[]{5, 2, 0, 0, 0, 0}; + chances[1] = new float[]{3, 6,1, 0,0, 0,0, 0,0, 0,0}; chances[5] = chances[4] = chances[3] = chances[2] = chances[1]; - chances[6] = new float[]{5, 0, 5, 0, 0, 0}; + chances[6] = new float[]{2, 0,0, 4,4, 0,0, 0,0, 0,0}; chances[10] = chances[9] = chances[8] = chances[7] = chances[6]; - chances[11] = new float[]{5, 0, 0, 5, 0, 0}; + chances[11] = new float[]{2, 0,0, 0,0, 4,4, 0,0, 0,0}; chances[15] = chances[14] = chances[13] = chances[12] = chances[11]; - chances[16] = new float[]{5, 0, 0, 0, 5, 0}; + chances[16] = new float[]{2, 0,0, 0,0, 0,0, 4,4, 0,0}; chances[20] = chances[19] = chances[18] = chances[17] = chances[16]; - chances[21] = new float[]{5, 0, 0, 0, 0, 5}; + chances[21] = new float[]{3, 0,0, 0,0, 0,0, 0,0, 6,1}; chances[26] = chances[25] = chances[24] = chances[23] = chances[22] = chances[21]; } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/standard/exit/RitualExitRoom.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/standard/exit/RitualExitRoom.java new file mode 100644 index 000000000..35ec2c3d6 --- /dev/null +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/standard/exit/RitualExitRoom.java @@ -0,0 +1,43 @@ +/* + * Pixel Dungeon + * Copyright (C) 2012-2015 Oleg Dolya + * + * Shattered Pixel Dungeon + * Copyright (C) 2014-2024 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.RitualRoom; +import com.watabou.utils.Point; + +public class RitualExitRoom extends RitualRoom { + + @Override + public boolean isExit() { + return true; + } + + @Override + protected void placeloot(Level level, Point p) { + Painter.set(level, p, Terrain.EXIT); + level.transitions.add(new LevelTransition(level, level.pointToCell(p), LevelTransition.Type.REGULAR_EXIT)); + } +} diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/standard/exit/StatuesExitRoom.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/standard/exit/StatuesExitRoom.java new file mode 100644 index 000000000..97c6c5f4e --- /dev/null +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/standard/exit/StatuesExitRoom.java @@ -0,0 +1,64 @@ +/* + * Pixel Dungeon + * Copyright (C) 2012-2015 Oleg Dolya + * + * Shattered Pixel Dungeon + * Copyright (C) 2014-2024 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.StatuesRoom; +import com.watabou.utils.PathFinder; + +public class StatuesExitRoom extends StatuesRoom { + + @Override + public float[] sizeCatProbs() { + return new float[]{3, 1, 0}; + } + + @Override + public boolean isExit() { + return true; + } + + @Override + public void paint(Level level) { + super.paint(level); + + int exit = level.pointToCell(center()); + + if (width() <= 10 && height()<= 10){ + Painter.fill(level, this, 3, Terrain.EMPTY_SP); + } + + for (int i : PathFinder.NEIGHBOURS8){ + if (level.map[exit + i] != Terrain.STATUE_SP) { + Painter.set(level, exit + i, Terrain.EMPTY_SP); + } + } + + Painter.set( level, exit, Terrain.EXIT ); + level.transitions.add(new LevelTransition(level, exit, LevelTransition.Type.REGULAR_EXIT)); + + } + +} diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/standard/exit/WaterBridgeExitRoom.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/standard/exit/WaterBridgeExitRoom.java new file mode 100644 index 000000000..12aefd435 --- /dev/null +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/standard/exit/WaterBridgeExitRoom.java @@ -0,0 +1,68 @@ +/* + * Pixel Dungeon + * Copyright (C) 2012-2015 Oleg Dolya + * + * Shattered Pixel Dungeon + * Copyright (C) 2014-2024 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.WaterBridgeRoom; +import com.watabou.utils.PathFinder; + +public class WaterBridgeExitRoom extends WaterBridgeRoom { + + @Override + public int minWidth() { + return Math.max(7, super.minWidth()); + } + + @Override + public int minHeight() { + return Math.max(7, super.minHeight()); + } + + @Override + public boolean isExit() { + return true; + } + + @Override + public void paint(Level level) { + super.paint(level); + + int exit; + do { + exit = level.pointToCell(random(2)); + + } while (spaceRect.inside(level.cellToPoint(exit)) || level.findMob(exit) != null); + + for (int i : PathFinder.NEIGHBOURS8){ + if (level.map[exit+i] == Terrain.WATER) { + Painter.set(level, exit + i, Terrain.EMPTY); + } + } + + Painter.set( level, exit, Terrain.EXIT ); + level.transitions.add(new LevelTransition(level, exit, LevelTransition.Type.REGULAR_EXIT)); + } + +}