diff --git a/bin/domain/Box.class b/bin/domain/Box.class index d102bea..142c7d1 100644 Binary files a/bin/domain/Box.class and b/bin/domain/Box.class differ diff --git a/bin/facade/YahtzeeGame.class b/bin/facade/YahtzeeGame.class index 2d03ee5..81c150f 100644 Binary files a/bin/facade/YahtzeeGame.class and b/bin/facade/YahtzeeGame.class differ diff --git a/src/domain/Box.java b/src/domain/Box.java index 51704c6..5bde51c 100644 --- a/src/domain/Box.java +++ b/src/domain/Box.java @@ -43,6 +43,7 @@ public class Box { private Integer setCategoryStarWarsDay; private Integer setCategoryR2D2; + private Integer bonus; private int counter[] = new int[8]; 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() { if (savedGamemode.equals("Special8")) return setCategoryOne + setCategoryTwo + setCategoryThree + setCategoryFour + setCategoryFive - + setCategorySix + setCategorySeven + setCategoryEight + setCategoryTripleMatch + + setCategorySix + setCategorySeven + setCategoryEight + bonus + setCategoryTripleMatch + setCategoryFourOfAKind + setCategoryFullHouse + setCategorySmallStreet + setCategoryBigStreet + setCategoryYahtzee + setCategoryChance + setCategoryStarWarsDay @@ -362,7 +381,7 @@ public class Box { else return setCategoryOne + setCategoryTwo + setCategoryThree + setCategoryFour + setCategoryFive - + setCategorySix + setCategoryTripleMatch + setCategoryFourOfAKind + + setCategorySix + bonus + setCategoryTripleMatch + setCategoryFourOfAKind + setCategoryFullHouse + setCategorySmallStreet + setCategoryBigStreet + setCategoryYahtzee + setCategoryChance + setCategoryStarWarsDay; @@ -381,6 +400,7 @@ public class Box { sb.append("categorySix: " + nullCheck(setCategorySix) + "\n"); sb.append("categorySeven: " + nullCheck(setCategorySeven) + "\n"); sb.append("categoryEight: " + nullCheck(setCategoryEight) + "\n"); + sb.append("\nbonus: " + nullCheck(bonus) + "\n"); sb.append("\n--------------------------\n\n"); sb.append("categoryTripleMatch: " + nullCheck(setCategoryTripleMatch) + "\n"); sb.append("categoryFourOfAKind: " + nullCheck(setCategoryFourOfAKind) + "\n"); @@ -398,6 +418,7 @@ public class Box { sb.append("categoryFour: " + nullCheck(setCategoryFour) + "\n"); sb.append("categoryFive: " + nullCheck(setCategoryFive) + "\n"); sb.append("categorySix: " + nullCheck(setCategorySix) + "\n"); + sb.append("\nbonus: " + nullCheck(bonus) + "\n"); sb.append("\n--------------------------\n\n"); sb.append("categoryTripleMatch: " + nullCheck(setCategoryTripleMatch) + "\n"); sb.append("categoryFourOfAKind: " + nullCheck(setCategoryFourOfAKind) + "\n"); diff --git a/src/facade/YahtzeeGame.java b/src/facade/YahtzeeGame.java index cb4c4ce..addadc9 100644 --- a/src/facade/YahtzeeGame.java +++ b/src/facade/YahtzeeGame.java @@ -117,6 +117,7 @@ public class YahtzeeGame { players.get(player).box.selectOption(selectedOption); players.get(player).box.resetOptions(); players.get(player).getNewHand(); + players.get(player).box.updateBonus(); }