diff --git a/android/src/main/assets/custom_tiles/sewer_boss.png b/android/src/main/assets/custom_tiles/sewer_boss.png new file mode 100644 index 000000000..477e933a6 Binary files /dev/null and b/android/src/main/assets/custom_tiles/sewer_boss.png differ diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Assets.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Assets.java index 9d73f2a74..ce75a3664 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Assets.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Assets.java @@ -122,6 +122,7 @@ public class Assets { public static final String LOADING_HALLS = "loading_halls.png"; public static final String WEAK_FLOOR = "custom_tiles/weak_floor.png"; + public static final String SEWER_BOSS = "custom_tiles/sewer_boss.png"; public static final String PRISON_QUEST = "custom_tiles/prison_quests.png"; public static final String PRISON_EXIT = "custom_tiles/prison_exit.png"; diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ShatteredPixelDungeon.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ShatteredPixelDungeon.java index 7e232d1db..abbcf305e 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ShatteredPixelDungeon.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ShatteredPixelDungeon.java @@ -97,6 +97,11 @@ public class ShatteredPixelDungeon extends Game { com.watabou.utils.Bundle.addAlias( com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Kinetic.class, "com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Swift" ); + + //v0.7.5 + com.watabou.utils.Bundle.addAlias( + com.shatteredpixel.shatteredpixeldungeon.levels.rooms.sewerboss.SewerBossEntranceRoom.class, + "com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.SewerBossEntranceRoom" ); } @Override diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/SewerBossLevel.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/SewerBossLevel.java index 6888dee62..f076e6306 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/SewerBossLevel.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/SewerBossLevel.java @@ -30,8 +30,8 @@ import com.shatteredpixel.shatteredpixeldungeon.levels.builders.Builder; import com.shatteredpixel.shatteredpixeldungeon.levels.builders.LoopBuilder; import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.Room; import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.secret.RatKingRoom; -import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.EmptyRoom; -import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.SewerBossEntranceRoom; +import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.sewerboss.GooBossRoom; +import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.sewerboss.SewerBossEntranceRoom; import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.StandardRoom; import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; import com.watabou.utils.Bundle; @@ -55,17 +55,18 @@ public class SewerBossLevel extends SewerLevel { int standards = standardRooms(); for (int i = 0; i < standards; i++) { - initRooms.add(new EmptyRoom()); + initRooms.add(StandardRoom.createRoom()); } + initRooms.add(GooBossRoom.randomGooRoom()); initRooms.add(new RatKingRoom()); return initRooms; } @Override protected int standardRooms() { - //2 to 4, average 3 - return 2+Random.chances(new float[]{1, 1, 1}); + //2 to 3, average 2.5 + return 2+Random.chances(new float[]{1, 1}); } protected Builder builder(){ @@ -100,13 +101,6 @@ public class SewerBossLevel extends SewerLevel { @Override protected void createMobs() { - Goo boss = new Goo(); - Room room; - do { - room = randomRoom(StandardRoom.class); - } while (room == roomEntrance); - boss.pos = pointToCell(room.random()); - mobs.add( boss ); } public Actor respawner() { diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/Room.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/Room.java index 5cc36ed6c..8c2cb1bd0 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/Room.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/Room.java @@ -156,8 +156,10 @@ public abstract class Room extends Rect implements Graph.Node, Bundlable { public static final int RIGHT = 3; public static final int BOTTOM = 4; - //TODO make abstract - public int minConnections(int direction){ return -1; } + public int minConnections(int direction){ + if (direction == ALL) return 1; + else return 0; + } public int curConnections(int direction){ if (direction == ALL) { @@ -181,8 +183,10 @@ public abstract class Room extends Rect implements Graph.Node, Bundlable { else return maxConnections(direction) - curConnections(direction); } - //TODO make abstract - public int maxConnections(int direction){ return -1; } + public int maxConnections(int direction){ + if (direction == ALL) return 16; + else return 4; + } //only considers point-specific limits, not direction limits public boolean canConnect(Point p){ @@ -257,8 +261,7 @@ public abstract class Room extends Rect implements Graph.Node, Bundlable { // **** Painter Logic **** - //TODO make abstract - public void paint(Level level){} + public abstract void paint(Level level); //whether or not a painter can make its own modifications to a specific point public boolean canPlaceWater(Point p){ diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/connection/ConnectionRoom.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/connection/ConnectionRoom.java index a1593b1e9..fcb0b5068 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/connection/ConnectionRoom.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/connection/ConnectionRoom.java @@ -45,12 +45,6 @@ public abstract class ConnectionRoom extends Room { else return 0; } - @Override - public int maxConnections(int direction) { - if (direction == ALL) return 16; - else return 4; - } - @Override public boolean canPlaceTrap(Point p) { //traps cannot appear in connection rooms on floor 1 @@ -74,7 +68,7 @@ public abstract class ConnectionRoom extends Room { static { chances[1] = new float[]{20, 1, 0, 2, 2, 1}; chances[4] = chances[3] = chances[2] = chances[1]; - chances[5] = new float[]{18, 0, 0, 0, 7, 0}; + chances[5] = new float[]{20, 0, 0, 0, 0, 0}; chances[6] = new float[]{0, 0, 22, 3, 0, 0}; chances[10] = chances[9] = chances[8] = chances[7] = chances[6]; diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/connection/MazeConnectionRoom.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/connection/MazeConnectionRoom.java index aa8293faa..87240361f 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/connection/MazeConnectionRoom.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/connection/MazeConnectionRoom.java @@ -30,8 +30,6 @@ public class MazeConnectionRoom extends ConnectionRoom { @Override public void paint(Level level) { - super.paint(level); - Painter.fill(level, this, 1, Terrain.EMPTY); //true = space, false = wall diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/connection/PerimeterRoom.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/connection/PerimeterRoom.java index a5f03199a..44d6c5aee 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/connection/PerimeterRoom.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/connection/PerimeterRoom.java @@ -23,6 +23,7 @@ package com.shatteredpixel.shatteredpixeldungeon.levels.rooms.connection; import com.shatteredpixel.shatteredpixeldungeon.levels.Level; import com.shatteredpixel.shatteredpixeldungeon.levels.painters.Painter; +import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.Room; import com.watabou.utils.Point; import java.util.ArrayList; @@ -34,14 +35,25 @@ public class PerimeterRoom extends ConnectionRoom { int floor = level.tunnelTile(); + fillPerimiterPaths(level, this, floor); + + for (Door door : connected.values()) { + door.set( Door.Type.TUNNEL ); + } + } + + public static void fillPerimiterPaths( Level l, Room r, int floor ){ + + corners = null; + ArrayList pointsToFill = new ArrayList<>(); - for (Point door : connected.values()) { + for (Point door : r.connected.values()) { Point p = new Point(door); - if (p.y == top){ + if (p.y == r.top){ p.y++; - } else if (p.y == bottom) { + } else if (p.y == r.bottom) { p.y--; - } else if (p.x == left){ + } else if (p.x == r.left){ p.x++; } else { p.x--; @@ -58,7 +70,7 @@ public class PerimeterRoom extends ConnectionRoom { shortestDistance = Integer.MAX_VALUE; for (Point f : pointsFilled){ for (Point t : pointsToFill){ - int dist = distanceBetweenPoints(f, t); + int dist = distanceBetweenPoints(r, f, t); if (dist < shortestDistance){ from = f; to = t; @@ -66,46 +78,45 @@ public class PerimeterRoom extends ConnectionRoom { } } } - fillBetweenPoints(level, from, to, floor); + fillBetweenPoints(l, r, from, to, floor); pointsFilled.add(to); pointsToFill.remove(to); } - for (Door door : connected.values()) { - door.set( Door.Type.TUNNEL ); - } } - private int spaceBetween(int a, int b){ + private static int spaceBetween(int a, int b){ return Math.abs(a - b)-1; } //gets the path distance between two points - private int distanceBetweenPoints(Point a, Point b){ + private static int distanceBetweenPoints(Room r, Point a, Point b){ //on the same side - if (a.y == b.y || a.x == b.x){ + if (((a.x == r.left || a.x == r.right) && a.y == b.y) + || ((a.y == r.top || a.y == r.bottom) && a.x == b.x)){ return Math.max(spaceBetween(a.x, b.x), spaceBetween(a.y, b.y)); } //otherwise... //subtract 1 at the end to account for overlap return - Math.min(spaceBetween(left, a.x) + spaceBetween(left, b.x), - spaceBetween(right, a.x) + spaceBetween(right, b.x)) + Math.min(spaceBetween(r.left, a.x) + spaceBetween(r.left, b.x), + spaceBetween(r.right, a.x) + spaceBetween(r.right, b.x)) + - Math.min(spaceBetween(top, a.y) + spaceBetween(top, b.y), - spaceBetween(bottom, a.y) + spaceBetween(bottom, b.y)) + Math.min(spaceBetween(r.top, a.y) + spaceBetween(r.top, b.y), + spaceBetween(r.bottom, a.y) + spaceBetween(r.bottom, b.y)) - 1; } - private Point[] corners; + private static Point[] corners; //picks the smallest path to fill between two points - private void fillBetweenPoints(Level level, Point from, Point to, int floor){ + private static void fillBetweenPoints(Level level, Room r, Point from, Point to, int floor){ //doors are along the same side - if (from.y == to.y || from.x == to.x){ + if (((from.x == r.left || from.x == r.right) && from.y == to.y) + || ((from.y == r.top || from.y == r.bottom) && from.x == to.x)){ Painter.fill(level, Math.min(from.x, to.x), Math.min(from.y, to.y), @@ -118,10 +129,10 @@ public class PerimeterRoom extends ConnectionRoom { //set up corners if (corners == null){ corners = new Point[4]; - corners[0] = new Point(left+1, top+1); - corners[1] = new Point(right-1, top+1); - corners[2] = new Point(right-1, bottom-1); - corners[3] = new Point(left+1, bottom-1); + corners[0] = new Point(r.left+1, r.top+1); + corners[1] = new Point(r.right-1, r.top+1); + corners[2] = new Point(r.right-1, r.bottom-1); + corners[3] = new Point(r.left+1, r.bottom-1); } //doors on adjacent sides @@ -135,26 +146,26 @@ public class PerimeterRoom extends ConnectionRoom { //doors on opposite sides Point side; - if (from.y == top+1 || from.y == bottom-1){ + if (from.y == r.top+1 || from.y == r.bottom-1){ //connect along the left, or right side - if (spaceBetween(left, from.x) + spaceBetween(left, to.x) <= - spaceBetween(right, from.x) + spaceBetween(right, to.x)){ - side = new Point(left+1, top + height()/2); + if (spaceBetween(r.left, from.x) + spaceBetween(r.left, to.x) <= + spaceBetween(r.right, from.x) + spaceBetween(r.right, to.x)){ + side = new Point(r.left+1, r.top + r.height()/2); } else { - side = new Point(right-1, top + height()/2); + side = new Point(r.right-1, r.top + r.height()/2); } } else { //connect along the top, or bottom side - if (spaceBetween(top, from.y) + spaceBetween(top, to.y) <= - spaceBetween(bottom, from.y) + spaceBetween(bottom, to.y)){ - side = new Point(left + width()/2, top+1); + if (spaceBetween(r.top, from.y) + spaceBetween(r.top, to.y) <= + spaceBetween(r.bottom, from.y) + spaceBetween(r.bottom, to.y)){ + side = new Point(r.left + r.width()/2, r.top+1); } else { - side = new Point(left + width()/2, bottom-1); + side = new Point(r.left + r.width()/2, r.bottom-1); } } //treat this as two connections with adjacent sides - fillBetweenPoints(level, from, side, floor); - fillBetweenPoints(level, side, to, floor); + fillBetweenPoints(level, r, from, side, floor); + fillBetweenPoints(level, r, side, to, floor); } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/secret/RatKingRoom.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/secret/RatKingRoom.java index 104250834..62064df0c 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/secret/RatKingRoom.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/secret/RatKingRoom.java @@ -29,7 +29,7 @@ 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; -import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.SewerBossEntranceRoom; +import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.sewerboss.SewerBossEntranceRoom; import com.watabou.utils.Random; public class RatKingRoom extends SecretRoom { diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/secret/SecretArtilleryRoom.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/secret/SecretArtilleryRoom.java index 89c33a8e0..ed18f09ec 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/secret/SecretArtilleryRoom.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/secret/SecretArtilleryRoom.java @@ -31,8 +31,6 @@ public class SecretArtilleryRoom extends SecretRoom { @Override public void paint(Level level) { - super.paint(level); - Painter.fill(level, this, Terrain.WALL); Painter.fill(level, this, 1, Terrain.EMPTY_SP); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/secret/SecretChestChasmRoom.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/secret/SecretChestChasmRoom.java index 0e5698f1f..7f87bb807 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/secret/SecretChestChasmRoom.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/secret/SecretChestChasmRoom.java @@ -57,8 +57,6 @@ public class SecretChestChasmRoom extends SecretRoom { @Override public void paint(Level level) { - super.paint(level); - Painter.fill(level, this, Terrain.WALL); Painter.fill(level, this, 1, Terrain.CHASM); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/secret/SecretHoardRoom.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/secret/SecretHoardRoom.java index 451f00b9a..af1c59812 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/secret/SecretHoardRoom.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/secret/SecretHoardRoom.java @@ -39,8 +39,6 @@ public class SecretHoardRoom extends SecretRoom { @Override public void paint(Level level) { - super.paint(level); - Painter.fill(level, this, Terrain.WALL); Painter.fill(level, this, 1, Terrain.EMPTY); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/secret/SecretMazeRoom.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/secret/SecretMazeRoom.java index 72bbb649b..73d2751e9 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/secret/SecretMazeRoom.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/secret/SecretMazeRoom.java @@ -58,8 +58,6 @@ public class SecretMazeRoom extends SecretRoom { @Override public void paint(Level level) { - super.paint(level); - Painter.fill(level, this, Terrain.WALL); Painter.fill(level, this, 1, Terrain.EMPTY); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/secret/SecretSummoningRoom.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/secret/SecretSummoningRoom.java index eeee57cfa..62ac30446 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/secret/SecretSummoningRoom.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/secret/SecretSummoningRoom.java @@ -45,8 +45,6 @@ public class SecretSummoningRoom extends SecretRoom { @Override public void paint(Level level) { - super.paint(level); - Painter.fill(level, this, Terrain.WALL); Painter.fill(level, this, 1, Terrain.SECRET_TRAP); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/sewerboss/DiamondGooRoom.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/sewerboss/DiamondGooRoom.java new file mode 100644 index 000000000..5be1181c3 --- /dev/null +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/sewerboss/DiamondGooRoom.java @@ -0,0 +1,78 @@ +/* + * Pixel Dungeon + * Copyright (C) 2012-2015 Oleg Dolya + * + * Shattered Pixel Dungeon + * Copyright (C) 2014-2019 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.sewerboss; + +import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Goo; +import com.shatteredpixel.shatteredpixeldungeon.levels.Level; +import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain; +import com.shatteredpixel.shatteredpixeldungeon.levels.painters.Painter; +import com.watabou.utils.Point; + +public class DiamondGooRoom extends GooBossRoom { + + @Override + public void paint(Level level) { + Painter.fill( level, this, Terrain.WALL ); + + int diamondWidth = 2 + width()%2; + for (int i = 1; i < height(); i++){ + Painter.fill( level, left + (width() - diamondWidth)/2, top+i, diamondWidth, height()-2*i, Terrain.EMPTY); + diamondWidth += 2; + if (diamondWidth >= width()) break; + } + + for (Door door : connected.values()) { + door.set( Door.Type.REGULAR ); + Point dir; + if (door.x == left){ + dir = new Point(1, 0); + } else if (door.y == top){ + dir = new Point(0, 1); + } else if (door.x == right){ + dir = new Point(-1, 0); + } else { + dir = new Point(0, -1); + } + + Point curr = new Point(door); + do { + Painter.set(level, curr, Terrain.EMPTY_SP); + curr.x += dir.x; + curr.y += dir.y; + } while (level.map[level.pointToCell(curr)] != Terrain.EMPTY); + } + + Painter.fill( level, left + width()/2 - 1, top + height()/2 - 2, 2 + width()%2, 4 + height()%2, Terrain.WATER); + Painter.fill( level, left + width()/2 - 2, top + height()/2 - 1, 4 + width()%2, 2 + height()%2, Terrain.WATER); + + setupGooNest(level); + + Goo boss = new Goo(); + boss.pos = level.pointToCell(center()); + level.mobs.add( boss ); + } + + @Override + public boolean canPlaceWater(Point p) { + return false; + } +} diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/sewerboss/GooBossRoom.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/sewerboss/GooBossRoom.java new file mode 100644 index 000000000..eadcfaba2 --- /dev/null +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/sewerboss/GooBossRoom.java @@ -0,0 +1,120 @@ +/* + * Pixel Dungeon + * Copyright (C) 2012-2015 Oleg Dolya + * + * Shattered Pixel Dungeon + * Copyright (C) 2014-2019 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.sewerboss; + +import com.shatteredpixel.shatteredpixeldungeon.Assets; +import com.shatteredpixel.shatteredpixeldungeon.levels.Level; +import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.StandardRoom; +import com.shatteredpixel.shatteredpixeldungeon.tiles.CustomTilemap; +import com.watabou.noosa.Image; +import com.watabou.noosa.Tilemap; +import com.watabou.utils.Point; +import com.watabou.utils.Random; + +public abstract class GooBossRoom extends StandardRoom { + + @Override + public float[] sizeCatProbs() { + return new float[]{0, 1, 0}; + } + + public static GooBossRoom randomGooRoom(){ + switch (Random.Int(4)){ + case 0: default: + return new DiamondGooRoom(); + case 1: + return new WalledGooRoom(); + case 2: + return new ThinPillarsGooRoom(); + case 3: + return new ThickPillarsGooRoom(); + } + } + + protected void setupGooNest( Level level ){ + GooNest nest = new GooNest(); + nest.setRect(left + width()/2 - 2, top + height()/2 - 2, 4 + width()%2, 4 + height()%2); + + level.customTiles.add(nest); + } + + //TODO no texturing on this atm + public static class GooNest extends CustomTilemap { + + { + texture = Assets.SEWER_BOSS; + } + + @Override + public Tilemap create() { + Tilemap v = super.create(); + int[] data = new int[tileW*tileH]; + for (int x = 0; x < tileW; x++){ + for (int y = 0; y < tileH; y++){ + + //corners + if ((x == 0 || x == tileW-1) && (y == 0 || y == tileH-1)){ + data[x + tileW*y] = -1; + + //adjacent to corners + } else if ((x == 1 && y == 0) || (x == 0 && y == 1)){ + data[x + tileW*y] = 0; + + } else if ((x == tileW-2 && y == 0) || (x == tileW-1 && y == 1)){ + data[x + tileW*y] = 1; + + } else if ((x == 1 && y == tileH-1) || (x == 0 && y == tileH-2)){ + data[x + tileW*y] = 2; + + } else if ((x == tileW-2 && y == tileH-1) || (x == tileW-1 && y == tileH-2)) { + data[x + tileW*y] = 3; + + //sides + } else if (x == 0){ + data[x + tileW*y] = 4; + + } else if (y == 0){ + data[x + tileW*y] = 5; + + } else if (x == tileW-1){ + data[x + tileW*y] = 6; + + } else if (y == tileH-1){ + data[x + tileW*y] = 7; + + //inside + } else { + data[x + tileW*y] = 8; + } + + } + } + v.map( data, tileW ); + return v; + } + + @Override + public Image image(int tileX, int tileY) { + return null; + } + } +} diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/standard/SewerBossEntranceRoom.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/sewerboss/SewerBossEntranceRoom.java similarity index 94% rename from core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/standard/SewerBossEntranceRoom.java rename to core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/sewerboss/SewerBossEntranceRoom.java index 22681efe5..8d63f256b 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/standard/SewerBossEntranceRoom.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/sewerboss/SewerBossEntranceRoom.java @@ -19,12 +19,13 @@ * along with this program. If not, see */ -package com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard; +package com.shatteredpixel.shatteredpixeldungeon.levels.rooms.sewerboss; 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; +import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.EntranceRoom; import com.watabou.utils.Point; public class SewerBossEntranceRoom extends EntranceRoom { diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/sewerboss/ThickPillarsGooRoom.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/sewerboss/ThickPillarsGooRoom.java new file mode 100644 index 000000000..fbd950ae0 --- /dev/null +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/sewerboss/ThickPillarsGooRoom.java @@ -0,0 +1,58 @@ +/* + * Pixel Dungeon + * Copyright (C) 2012-2015 Oleg Dolya + * + * Shattered Pixel Dungeon + * Copyright (C) 2014-2019 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.sewerboss; + +import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Goo; +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.connection.PerimeterRoom; + +public class ThickPillarsGooRoom extends GooBossRoom { + + @Override + public void paint(Level level) { + + Painter.fill( level, this, Terrain.WALL ); + Painter.fill( level, this, 1 , Terrain.WATER ); + + int pillarW = (width()-8)/2; + int pillarH = (height()-8)/2; + + Painter.fill(level, left+2, top+2, pillarW+1, pillarH+1, Terrain.WALL); + Painter.fill(level, left+2, bottom-2-pillarH, pillarW+1, pillarH+1, Terrain.WALL); + Painter.fill(level, right-2-pillarW, top+2, pillarW+1, pillarH+1, Terrain.WALL); + Painter.fill(level, right-2-pillarW, bottom-2-pillarH, pillarW+1, pillarH+1, Terrain.WALL); + + PerimeterRoom.fillPerimiterPaths(level, this, Terrain.EMPTY_SP); + + for (Door door : connected.values()) { + door.set(Door.Type.REGULAR); + } + + setupGooNest(level); + + Goo boss = new Goo(); + boss.pos = level.pointToCell(center()); + level.mobs.add( boss ); + } +} diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/sewerboss/ThinPillarsGooRoom.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/sewerboss/ThinPillarsGooRoom.java new file mode 100644 index 000000000..cc8e2193d --- /dev/null +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/sewerboss/ThinPillarsGooRoom.java @@ -0,0 +1,71 @@ +/* + * Pixel Dungeon + * Copyright (C) 2012-2015 Oleg Dolya + * + * Shattered Pixel Dungeon + * Copyright (C) 2014-2019 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.sewerboss; + +import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Goo; +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.connection.PerimeterRoom; + +public class ThinPillarsGooRoom extends GooBossRoom { + + @Override + public void paint(Level level) { + + Painter.fill( level, this, Terrain.WALL ); + Painter.fill( level, this, 1 , Terrain.WATER ); + + int pillarW = (width() == 14 ? 4: 2) + width()%2; + int pillarH = (height() == 14 ? 4: 2) + height()%2; + + if (height() < 12){ + Painter.fill(level, left + (width()-pillarW)/2, top+2, pillarW, 1, Terrain.WALL); + Painter.fill(level, left + (width()-pillarW)/2, bottom-2, pillarW, 1, Terrain.WALL); + } else { + Painter.fill(level, left + (width()-pillarW)/2, top+3, pillarW, 1, Terrain.WALL); + Painter.fill(level, left + (width()-pillarW)/2, bottom-3, pillarW, 1, Terrain.WALL); + } + + if (width() < 12){ + Painter.fill(level, left + 2, top + (height() - pillarH)/2, 1, pillarH, Terrain.WALL); + Painter.fill(level, right - 2, top + (height() - pillarH)/2, 1, pillarH, Terrain.WALL); + } else { + Painter.fill(level, left + 3, top + (height() - pillarH)/2, 1, pillarH, Terrain.WALL); + Painter.fill(level, right - 3, top + (height() - pillarH)/2, 1, pillarH, Terrain.WALL); + } + + PerimeterRoom.fillPerimiterPaths(level, this, Terrain.EMPTY_SP); + + for (Door door : connected.values()) { + door.set(Door.Type.REGULAR); + } + + setupGooNest(level); + + Goo boss = new Goo(); + boss.pos = level.pointToCell(center()); + level.mobs.add( boss ); + + } + +} diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/sewerboss/WalledGooRoom.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/sewerboss/WalledGooRoom.java new file mode 100644 index 000000000..649129a23 --- /dev/null +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/sewerboss/WalledGooRoom.java @@ -0,0 +1,71 @@ +/* + * Pixel Dungeon + * Copyright (C) 2012-2015 Oleg Dolya + * + * Shattered Pixel Dungeon + * Copyright (C) 2014-2019 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.sewerboss; + +import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Goo; +import com.shatteredpixel.shatteredpixeldungeon.levels.Level; +import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain; +import com.shatteredpixel.shatteredpixeldungeon.levels.painters.Painter; +import com.watabou.utils.Point; + +public class WalledGooRoom extends GooBossRoom { + + @Override + public void paint(Level level) { + Painter.fill( level, this, Terrain.WALL ); + Painter.fill( level, this, 1 , Terrain.EMPTY_SP ); + Painter.fill( level, this, 2 , Terrain.EMPTY ); + + int pillarW = (width()-2)/3; + int pillarH = (height()-2)/3; + + Painter.fill(level, left+2, top+2, pillarW, 1, Terrain.WALL); + Painter.fill(level, left+2, top+2, 1, pillarH, Terrain.WALL); + + Painter.fill(level, left+2, bottom-2, pillarW, 1, Terrain.WALL); + Painter.fill(level, left+2, bottom-1-pillarH, 1, pillarH, Terrain.WALL); + + Painter.fill(level, right-1-pillarW, top+2, pillarW, 1, Terrain.WALL); + Painter.fill(level, right-2, top+2, 1, pillarH, Terrain.WALL); + + Painter.fill(level, right-1-pillarW, bottom-2, pillarW, 1, Terrain.WALL); + Painter.fill(level, right-2, bottom-1-pillarH, 1, pillarH, Terrain.WALL); + + for (Door door : connected.values()) { + door.set(Door.Type.REGULAR); + } + + Painter.fill( level, left + width()/2 - 1, top + height()/2 - 2, 2 + width()%2, 4 + height()%2, Terrain.WATER); + Painter.fill( level, left + width()/2 - 2, top + height()/2 - 1, 4 + width()%2, 2 + height()%2, Terrain.WATER); + + setupGooNest(level); + + Goo boss = new Goo(); + boss.pos = level.pointToCell(center()); + level.mobs.add( boss ); + } + + @Override + public boolean canPlaceWater(Point p) { + return false; + } +} diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/special/SpecialRoom.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/special/SpecialRoom.java index 056891b1b..3b4c736cd 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/special/SpecialRoom.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/special/SpecialRoom.java @@ -30,7 +30,7 @@ import com.watabou.utils.Random; import java.util.ArrayList; import java.util.Arrays; -public class SpecialRoom extends Room { +public abstract class SpecialRoom extends Room { @Override public int minWidth() { return 5; } @@ -42,12 +42,6 @@ public class SpecialRoom extends Room { } public int maxHeight() { return 10; } - @Override - public int minConnections(int direction) { - if (direction == ALL) return 1; - else return 0; - } - @Override public int maxConnections(int direction) { return 1; diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/standard/AquariumRoom.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/standard/AquariumRoom.java index ee2340b93..c2747f44e 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/standard/AquariumRoom.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/standard/AquariumRoom.java @@ -64,8 +64,6 @@ public class AquariumRoom extends StandardRoom { for (Door door : connected.values()) { door.set( Door.Type.REGULAR ); } - - super.paint(level); } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/standard/PlantsRoom.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/standard/PlantsRoom.java index 9c2905d5c..4bde5f1a2 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/standard/PlantsRoom.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/standard/PlantsRoom.java @@ -94,8 +94,6 @@ public class PlantsRoom extends StandardRoom { for (Door door : connected.values()) { door.set( Door.Type.REGULAR ); } - - super.paint(level); } private static Plant.Seed randomSeed(){ 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 01098f7a2..8ac22d700 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 @@ -98,18 +98,6 @@ public abstract class StandardRoom extends Room { public int minHeight() { return sizeCat.minDim; } public int maxHeight() { return sizeCat.maxDim; } - @Override - public int minConnections(int direction) { - if (direction == ALL) return 1; - else return 0; - } - - @Override - public int maxConnections(int direction) { - if (direction == ALL) return 16; - else return 4; - } - //FIXME this is a very messy way of handing variable standard rooms private static ArrayList> rooms = new ArrayList<>(); static { @@ -149,7 +137,7 @@ public abstract class StandardRoom extends Room { chances[1] = new float[]{20, 15,5, 0,0, 0,0, 0,0, 0,0, 1,0,1,0,1,0,1,1,0,0}; chances[2] = new float[]{20, 15,5, 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[]{50, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0,0,0,0,0,0,0,0,0}; + chances[5] = new float[]{20, 15,5, 0,0, 0,0, 0,0, 0,0, 0,0,0,0,0,0,0,0,0,0}; chances[6] = new float[]{20, 0,0, 15,5, 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];