diff --git a/bin/domain/Box.class b/bin/domain/Box.class index 6bf0fb6..1e81b54 100644 Binary files a/bin/domain/Box.class and b/bin/domain/Box.class differ diff --git a/bin/domain/Dice.class b/bin/domain/Dice.class index c6665ca..e5e2cff 100644 Binary files a/bin/domain/Dice.class and b/bin/domain/Dice.class differ diff --git a/bin/domain/Hand.class b/bin/domain/Hand.class index 6ae2bdc..3fafdcd 100644 Binary files a/bin/domain/Hand.class and b/bin/domain/Hand.class differ diff --git a/bin/domain/Player.class b/bin/domain/Player.class index e97c803..dc8b686 100644 Binary files a/bin/domain/Player.class and b/bin/domain/Player.class differ diff --git a/bin/facade/YahtzeeGame.class b/bin/facade/YahtzeeGame.class index 6f05a14..2d03ee5 100644 Binary files a/bin/facade/YahtzeeGame.class and b/bin/facade/YahtzeeGame.class differ diff --git a/bin/ui/TUI$1.class b/bin/ui/TUI$1.class index 7ce44c2..9f5a14e 100644 Binary files a/bin/ui/TUI$1.class and b/bin/ui/TUI$1.class differ diff --git a/bin/ui/TUI.class b/bin/ui/TUI.class index 836b3d0..625b863 100644 Binary files a/bin/ui/TUI.class and b/bin/ui/TUI.class differ diff --git a/src/domain/Box.java b/src/domain/Box.java index 492bb46..3c4281b 100644 --- a/src/domain/Box.java +++ b/src/domain/Box.java @@ -30,6 +30,7 @@ public class Box { private int categoryBigStreet; private int categoryYahtzee; private int categoryChance; + private int categoryStarWarsDay; private int categoryR2D2; private Integer setCategoryTripleMatch; @@ -39,6 +40,7 @@ public class Box { private Integer setCategoryBigStreet; private Integer setCategoryYahtzee; private Integer setCategoryChance; + private Integer setCategoryStarWarsDay; private Integer setCategoryR2D2; private int counter[] = new int[8]; @@ -119,6 +121,7 @@ public class Box { sumOfAllNumbers += diceNumbers.get(i); } + categoryStarWarsDay = (counter[3]*4) + (counter[4]*5); categoryChance = sumOfAllNumbers; for (int i = 0; i < counter.length; i++) { @@ -195,6 +198,8 @@ public class Box { res.add("categoryYahtzee: " + categoryYahtzee); if (categoryChance > 0 && (setCategoryChance == null)) res.add("categoryChance: " + categoryChance); + if (categoryStarWarsDay > 0 && (setCategoryStarWarsDay == null)) + res.add("categoryStarWarsDays: " + categoryStarWarsDay); if (categoryR2D2 > 0 && (setCategoryR2D2 == null)) res.add("categoryR2D2: " + categoryR2D2); @@ -229,6 +234,8 @@ public class Box { res.add("categoryYahtzee: " + categoryYahtzee); if (setCategoryChance == null) res.add("categoryChance: " + categoryChance); + if (setCategoryStarWarsDay == null) + res.add("categoryStarWarsDay: " + categoryStarWarsDay); if (setCategoryR2D2 == null && savedGamemode.equals("Special8")) res.add("categoryR2D2: " + categoryR2D2); } @@ -288,6 +295,8 @@ public class Box { } else if (option.equals("categoryChance")) setCategoryChance = categoryChance; + else if (option.equals("categoryStarWarsDay")) + setCategoryStarWarsDay = categoryStarWarsDay; else if (option.equals("categoryR2D2")) setCategoryR2D2 = categoryR2D2; @@ -295,7 +304,7 @@ public class Box { public void resetOptions() { - categoryOne = categoryTwo = categoryThree = categoryFour = categoryFive = categorySix = categorySeven = categoryEight = categoryTripleMatch = categoryFourOfAKind = categoryFullHouse = categorySmallStreet = categoryBigStreet = categoryYahtzee = categoryChance = categoryR2D2 = 0; + categoryOne = categoryTwo = categoryThree = categoryFour = categoryFive = categorySix = categorySeven = categoryEight = categoryTripleMatch = categoryFourOfAKind = categoryFullHouse = categorySmallStreet = categoryBigStreet = categoryYahtzee = categoryChance = categoryStarWarsDay = categoryR2D2 = 0; Arrays.fill(counter, 0); @@ -319,6 +328,7 @@ public class Box { setCategoryBigStreet != null && setCategoryYahtzee != null && setCategoryChance != null && + setCategoryStarWarsDay != null && setCategoryR2D2 != null; else @@ -334,7 +344,8 @@ public class Box { setCategorySmallStreet != null && setCategoryBigStreet != null && setCategoryYahtzee != null && - setCategoryChance != null; + setCategoryChance != null && + setCategoryStarWarsDay != null; } @@ -345,14 +356,14 @@ public class Box { + setCategorySix + setCategorySeven + setCategoryEight + setCategoryTripleMatch + setCategoryFourOfAKind + setCategoryFullHouse + setCategorySmallStreet + setCategoryBigStreet + setCategoryYahtzee - + setCategoryChance + + setCategoryChance + setCategoryStarWarsDay + setCategoryR2D2; else return setCategoryOne + setCategoryTwo + setCategoryThree + setCategoryFour + setCategoryFive + setCategorySix + setCategoryTripleMatch + setCategoryFourOfAKind + setCategoryFullHouse + setCategorySmallStreet + setCategoryBigStreet + setCategoryYahtzee - + setCategoryChance; + + setCategoryChance + setCategoryStarWarsDay; } @@ -377,6 +388,7 @@ public class Box { sb.append("categoryBigStreet: " + nullCheck(setCategoryBigStreet) + "\n"); sb.append("categoryYahtzee: " + nullCheck(setCategoryYahtzee) + "\n"); sb.append("categoryChance: " + nullCheck(setCategoryChance) + "\n"); + sb.append("categoryStarWarsDay: " + nullCheck(setCategoryStarWarsDay) + "\n"); sb.append("categoryR2D2: " + nullCheck(setCategoryR2D2) + "\n"); } else { sb.append("categoryOne: " + nullCheck(setCategoryOne) + "\n"); @@ -393,6 +405,7 @@ public class Box { sb.append("categoryBigStreet: " + nullCheck(setCategoryBigStreet) + "\n"); sb.append("categoryYahtzee: " + nullCheck(setCategoryYahtzee) + "\n"); sb.append("categoryChance: " + nullCheck(setCategoryChance) + "\n"); + sb.append("categoryStarWarsDay: " + nullCheck(setCategoryStarWarsDay) + "\n"); } return sb.toString(); diff --git a/src/domain/Dice.java b/src/domain/Dice.java index 31e2724..1d22a0f 100644 --- a/src/domain/Dice.java +++ b/src/domain/Dice.java @@ -9,7 +9,7 @@ public class Dice { public Dice(String gamemode) { this.savedGamemode = gamemode; - if (gamemode.equals("Normal") || gamemode.equals("StarWarsDay")) + if (gamemode.equals("Normal")) this.diceNumber = ((int) (Math.random() * 6)) + 1; else if (gamemode.equals("Special8")) this.diceNumber = ((int) (Math.random() * 8)) + 1; @@ -22,7 +22,7 @@ public class Dice { public void rerollDice() { - if (this.savedGamemode.equals("Normal") || this.savedGamemode.equals("StarWarsDay")) + if (this.savedGamemode.equals("Normal")) this.diceNumber = ((int) (Math.random() * 6)) + 1; else if (this.savedGamemode.equals("Special8")) this.diceNumber = ((int) (Math.random() * 8)) + 1; diff --git a/src/facade/YahtzeeGame.java b/src/facade/YahtzeeGame.java index f44051b..cb4c4ce 100644 --- a/src/facade/YahtzeeGame.java +++ b/src/facade/YahtzeeGame.java @@ -207,7 +207,7 @@ public class YahtzeeGame { try { - if (returnTotalPoints(player) > Integer.parseInt(highscores[0][2])) { + if (returnTotalPoints(player) >= Integer.parseInt(highscores[0][2])) { for (int i = 2; i >= 0; i--) { highscoreMem1 = highscores[0][i]; @@ -236,7 +236,7 @@ public class YahtzeeGame { highscores[9][i] = highscoreMem1; } - } else if (returnTotalPoints(player) > Integer.parseInt(highscores[1][2])) { + } else if (returnTotalPoints(player) >= Integer.parseInt(highscores[1][2])) { for (int i = 2; i >= 0; i--) { highscoreMem2 = highscores[1][i]; @@ -262,7 +262,7 @@ public class YahtzeeGame { highscores[8][i] = highscoreMem2; highscores[9][i] = highscoreMem1; } - } else if (returnTotalPoints(player) > Integer.parseInt(highscores[2][2])) { + } else if (returnTotalPoints(player) >= Integer.parseInt(highscores[2][2])) { for (int i = 2; i >= 0; i--) { highscoreMem1 = highscores[2][i]; @@ -286,7 +286,7 @@ public class YahtzeeGame { highscores[8][i] = highscoreMem2; highscores[9][i] = highscoreMem1; } - } else if (returnTotalPoints(player) > Integer.parseInt(highscores[3][2])) { + } else if (returnTotalPoints(player) >= Integer.parseInt(highscores[3][2])) { for (int i = 2; i >= 0; i--) { highscoreMem2 = highscores[3][i]; @@ -308,7 +308,7 @@ public class YahtzeeGame { highscores[8][i] = highscoreMem2; highscores[9][i] = highscoreMem1; } - } else if (returnTotalPoints(player) > Integer.parseInt(highscores[4][2])) { + } else if (returnTotalPoints(player) >= Integer.parseInt(highscores[4][2])) { for (int i = 2; i >= 0; i--) { highscoreMem1 = highscores[4][i]; @@ -328,7 +328,7 @@ public class YahtzeeGame { highscores[8][i] = highscoreMem2; highscores[9][i] = highscoreMem1; } - } else if (returnTotalPoints(player) > Integer.parseInt(highscores[5][2])) { + } else if (returnTotalPoints(player) >= Integer.parseInt(highscores[5][2])) { for (int i = 2; i >= 0; i--) { highscoreMem2 = highscores[5][i]; @@ -346,7 +346,7 @@ public class YahtzeeGame { highscores[8][i] = highscoreMem2; highscores[9][i] = highscoreMem1; } - } else if (returnTotalPoints(player) > Integer.parseInt(highscores[6][2])) { + } else if (returnTotalPoints(player) >= Integer.parseInt(highscores[6][2])) { for (int i = 2; i >= 0; i--) { highscoreMem1 = highscores[6][i]; @@ -362,7 +362,7 @@ public class YahtzeeGame { highscores[8][i] = highscoreMem2; highscores[9][i] = highscoreMem1; } - } else if (returnTotalPoints(player) > Integer.parseInt(highscores[7][2])) { + } else if (returnTotalPoints(player) >= Integer.parseInt(highscores[7][2])) { for (int i = 2; i >= 0; i--) { highscoreMem2 = highscores[7][i]; @@ -376,7 +376,7 @@ public class YahtzeeGame { highscores[8][i] = highscoreMem2; highscores[9][i] = highscoreMem1; } - } else if (returnTotalPoints(player) > Integer.parseInt(highscores[8][2])) { + } else if (returnTotalPoints(player) >= Integer.parseInt(highscores[8][2])) { for (int i = 2; i >= 0; i--) { highscoreMem1 = highscores[8][i]; @@ -388,7 +388,7 @@ public class YahtzeeGame { highscores[8][i] = "" + LocalDate.now(); highscores[9][i] = highscoreMem1; } - } else if (returnTotalPoints(player) > Integer.parseInt(highscores[9][2])) { + } else if (returnTotalPoints(player) >= Integer.parseInt(highscores[9][2])) { for (int i = 2; i >= 0; i--) { if (i == 2) diff --git a/src/ui/TUI.java b/src/ui/TUI.java index c18e9b7..a6dc429 100644 --- a/src/ui/TUI.java +++ b/src/ui/TUI.java @@ -49,7 +49,6 @@ public class TUI { System.out.println("\nChoose your gamemode: "); System.out.println(">Normal"); - System.out.println(">StarWarsDay"); System.out.println(">Special8"); game.setGamemode(sc.nextLine()); System.out.println("\nAmount of players: ");