category star wars day fix
parent
c992825659
commit
dd752e9064
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
bin/ui/TUI.class
BIN
bin/ui/TUI.class
Binary file not shown.
|
@ -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();
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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: ");
|
||||
|
|
Loading…
Reference in New Issue