diff options
author | syeyoung <42869671+cyoung06@users.noreply.github.com> | 2020-11-30 13:23:39 +0900 |
---|---|---|
committer | syeyoung <42869671+cyoung06@users.noreply.github.com> | 2020-11-30 13:23:39 +0900 |
commit | bb30d83ee52938bc860643d2bfd5b2059b35cc07 (patch) | |
tree | bc06d9ae4b3c8f11806a55ac6bc7e4c7d752157f /src/main | |
parent | 4b957f76a4e01a2385cce8fe1d140b46c28b3512 (diff) | |
download | Skyblock-Dungeons-Guide-bb30d83ee52938bc860643d2bfd5b2059b35cc07.tar.gz Skyblock-Dungeons-Guide-bb30d83ee52938bc860643d2bfd5b2059b35cc07.tar.bz2 Skyblock-Dungeons-Guide-bb30d83ee52938bc860643d2bfd5b2059b35cc07.zip |
stop pushing again
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessorBoxSolver.java | 16 | ||||
-rw-r--r-- | src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessorTrivia.java | 17 |
2 files changed, 21 insertions, 12 deletions
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessorBoxSolver.java b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessorBoxSolver.java index f8b53d3d..29c251d2 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessorBoxSolver.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessorBoxSolver.java @@ -73,16 +73,16 @@ public class RoomProcessorBoxSolver extends GeneralRoomProcessor { for (int y = 0; y < copied.length; y++) copied[y] = board[y].clone(); - LinkedList<Action> solved; + LinkedList<Action> solved = null; boolean pushed = false; copied[playerY][playerX] = 2; - if (board[resY][resX] == 1) { + if (board[resY][resX] == 1 && board[playerY][playerX] != 2) { if (!push(copied, resX, resY, dir.x, dir.y)) { continue; } pushed = true; solved = solve(copied, playerX, playerY); - } else { + } else if (board[resY][resX] == 0){ solved = solve(copied, resX, resY); } if (solved != null) { @@ -116,7 +116,7 @@ public class RoomProcessorBoxSolver extends GeneralRoomProcessor { int resultingX= x + dx; int resultingY = y +dy; if (resultingX < 0 || resultingY < 0 || resultingX >= board[0].length || resultingY >= board.length) return false; - if (board[resultingY][resultingX] != 0) return false; + if (board[resultingY][resultingX] == 1) return false; board[resultingY][resultingX] = 1; board[y][x] = 0; @@ -159,11 +159,9 @@ public class RoomProcessorBoxSolver extends GeneralRoomProcessor { for (int i = 0; i < 7; i++) { if (currboard[5][i] == 0) { try { - LinkedList<Action> semiSolution; - semiSolution = solve(currboard, i, 5); - if (semiSolution != null) { - semiSolution.addFirst(new Move(i, 5)); - solution = semiSolution; + solution = solve(currboard, i, 5); + if (solution != null) { + solution.addFirst(new Move(i, 5)); break; } } catch (Error e) { diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessorTrivia.java b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessorTrivia.java index cc269bd4..a7de1664 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessorTrivia.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessorTrivia.java @@ -18,6 +18,13 @@ public class RoomProcessorTrivia extends GeneralRoomProcessor { public RoomProcessorTrivia(DungeonRoom dungeonRoom) { super(dungeonRoom); + for (Map.Entry<String, String[]> answer : answers.entrySet()) { + StringBuilder sb = new StringBuilder(); + for (String s : answer.getValue()) { + sb.append(s).append(','); + } + dungeonRoom.getDungeonRoomInfo().getProperties().put(answer.getKey(), sb.toString()); + } } @@ -86,7 +93,9 @@ public class RoomProcessorTrivia extends GeneralRoomProcessor { String theRealAnswer = match(question, answerA, answerB, answerC); if (theRealAnswer == null) - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("§eDungeons Guide :::: §cCouldn't determine the answer!")); + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("§eDungeons Guide :::: §cCouldn't determine the answer! (no question found)")); + else if (theRealAnswer.length() >1) + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("§eDungeons Guide :::: §cCouldn't determine the answer! ("+theRealAnswer+")")); else Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("§eDungeons Guide :::: §6"+theRealAnswer+"§f is the correct answer!")); correctAnswer = theRealAnswer; @@ -99,11 +108,13 @@ public class RoomProcessorTrivia extends GeneralRoomProcessor { return matcher.group(1); } private String match(String question, String a, String b, String c) { - String[] answers = RoomProcessorTrivia.answers.get(question.toLowerCase().trim()); + String semi_answers = (String) getDungeonRoom().getDungeonRoomInfo().getProperties().get(question.toLowerCase().trim()); + if (semi_answers == null) return null; + String[] answers = semi_answers.split(","); if (match(answers, a)) return "A"; if (match(answers, b)) return "B"; if (match(answers, c)) return "C"; - return "Unknown"; + return semi_answers; } private boolean match(String[] match, String match2) { for (String s : match) { |