final fixes

main
s.eser 2024-04-30 11:28:46 +02:00
parent 5f6e3a21a0
commit 02370d8069
4 changed files with 24 additions and 2 deletions

Binary file not shown.

Binary file not shown.

View File

@ -43,6 +43,7 @@ public class Box {
private Integer setCategoryStarWarsDay; private Integer setCategoryStarWarsDay;
private Integer setCategoryR2D2; private Integer setCategoryR2D2;
private Integer bonus;
private int counter[] = new int[8]; private int counter[] = new int[8];
private String savedGamemode; private String savedGamemode;
@ -350,11 +351,29 @@ public class Box {
} }
public void updateBonus(){
if(savedGamemode.equals("Special8")){
if(setCategoryOne + setCategoryTwo + setCategoryThree + setCategoryFour
+ setCategoryFive + setCategorySix + setCategorySeven + setCategoryEight >= 108){
this.bonus = 35;
}
} else
if(setCategoryOne + setCategoryTwo + setCategoryThree + setCategoryFour
+ setCategoryFive + setCategorySix >= 63){
this.bonus = 35;
}
}
public int returnTotalPoints() { public int returnTotalPoints() {
if (savedGamemode.equals("Special8")) if (savedGamemode.equals("Special8"))
return setCategoryOne + setCategoryTwo + setCategoryThree + setCategoryFour + setCategoryFive return setCategoryOne + setCategoryTwo + setCategoryThree + setCategoryFour + setCategoryFive
+ setCategorySix + setCategorySeven + setCategoryEight + setCategoryTripleMatch + setCategorySix + setCategorySeven + setCategoryEight + bonus + setCategoryTripleMatch
+ setCategoryFourOfAKind + setCategoryFourOfAKind
+ setCategoryFullHouse + setCategorySmallStreet + setCategoryBigStreet + setCategoryYahtzee + setCategoryFullHouse + setCategorySmallStreet + setCategoryBigStreet + setCategoryYahtzee
+ setCategoryChance + setCategoryStarWarsDay + setCategoryChance + setCategoryStarWarsDay
@ -362,7 +381,7 @@ public class Box {
else else
return setCategoryOne + setCategoryTwo + setCategoryThree + setCategoryFour + setCategoryFive return setCategoryOne + setCategoryTwo + setCategoryThree + setCategoryFour + setCategoryFive
+ setCategorySix + setCategoryTripleMatch + setCategoryFourOfAKind + setCategorySix + bonus + setCategoryTripleMatch + setCategoryFourOfAKind
+ setCategoryFullHouse + setCategorySmallStreet + setCategoryBigStreet + setCategoryYahtzee + setCategoryFullHouse + setCategorySmallStreet + setCategoryBigStreet + setCategoryYahtzee
+ setCategoryChance + setCategoryStarWarsDay; + setCategoryChance + setCategoryStarWarsDay;
@ -381,6 +400,7 @@ public class Box {
sb.append("categorySix: " + nullCheck(setCategorySix) + "\n"); sb.append("categorySix: " + nullCheck(setCategorySix) + "\n");
sb.append("categorySeven: " + nullCheck(setCategorySeven) + "\n"); sb.append("categorySeven: " + nullCheck(setCategorySeven) + "\n");
sb.append("categoryEight: " + nullCheck(setCategoryEight) + "\n"); sb.append("categoryEight: " + nullCheck(setCategoryEight) + "\n");
sb.append("\nbonus: " + nullCheck(bonus) + "\n");
sb.append("\n--------------------------\n\n"); sb.append("\n--------------------------\n\n");
sb.append("categoryTripleMatch: " + nullCheck(setCategoryTripleMatch) + "\n"); sb.append("categoryTripleMatch: " + nullCheck(setCategoryTripleMatch) + "\n");
sb.append("categoryFourOfAKind: " + nullCheck(setCategoryFourOfAKind) + "\n"); sb.append("categoryFourOfAKind: " + nullCheck(setCategoryFourOfAKind) + "\n");
@ -398,6 +418,7 @@ public class Box {
sb.append("categoryFour: " + nullCheck(setCategoryFour) + "\n"); sb.append("categoryFour: " + nullCheck(setCategoryFour) + "\n");
sb.append("categoryFive: " + nullCheck(setCategoryFive) + "\n"); sb.append("categoryFive: " + nullCheck(setCategoryFive) + "\n");
sb.append("categorySix: " + nullCheck(setCategorySix) + "\n"); sb.append("categorySix: " + nullCheck(setCategorySix) + "\n");
sb.append("\nbonus: " + nullCheck(bonus) + "\n");
sb.append("\n--------------------------\n\n"); sb.append("\n--------------------------\n\n");
sb.append("categoryTripleMatch: " + nullCheck(setCategoryTripleMatch) + "\n"); sb.append("categoryTripleMatch: " + nullCheck(setCategoryTripleMatch) + "\n");
sb.append("categoryFourOfAKind: " + nullCheck(setCategoryFourOfAKind) + "\n"); sb.append("categoryFourOfAKind: " + nullCheck(setCategoryFourOfAKind) + "\n");

View File

@ -117,6 +117,7 @@ public class YahtzeeGame {
players.get(player).box.selectOption(selectedOption); players.get(player).box.selectOption(selectedOption);
players.get(player).box.resetOptions(); players.get(player).box.resetOptions();
players.get(player).getNewHand(); players.get(player).getNewHand();
players.get(player).box.updateBonus();
} }