From 3990f7b30b04e50e38ddb8b0851e68a2a765f8d9 Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Sun, 29 Sep 2019 04:37:58 -0400 Subject: [PATCH] v0.7.5: added a check to prevent straight path mazes on Tengu stage 2 --- .../levels/NewPrisonBossLevel.java | 22 +++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/NewPrisonBossLevel.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/NewPrisonBossLevel.java index 02750bc00..e7d25d47e 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/NewPrisonBossLevel.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/NewPrisonBossLevel.java @@ -520,11 +520,29 @@ public class NewPrisonBossLevel extends Level { if (ch.pos == pointToCell(mazeCellDoors[i]) && !triggered[i]){ triggered[i] = true; Maze.allowDiagonals = true; - boolean[][] maze = Maze.generate(mazeCells[i], map, width(), Terrain.WALL); + boolean[][] maze; + boolean validMaze; + + do { + maze = Maze.generate(mazeCells[i], map, width(), Terrain.WALL); + + //prevents a maze that is just a straight line from the door + validMaze = false; + for (int x = 1; x < maze.length-1; x++){ + if (maze[x][3]){ + int cell = mazeCells[i].left+x + width()*(mazeCells[i].top+3); + if (heaps.get(cell) == null) { + validMaze = true; + break; + } + } + } + + } while (!validMaze); for (int x = 1; x < maze.length-1; x++) { for (int y = 1; y < maze[0].length-1; y++) { - if (maze[x][y] && !(x == 1 && y == 3)){ + if (maze[x][y]){ int cell = mazeCells[i].left+x + width()*(mazeCells[i].top+y); if (heaps.get(cell) == null){ setTrap(new TenguDartTrap().hide(), cell);