diff --git a/bin/domain/Box.class b/bin/domain/Box.class index b677b46..5365676 100644 Binary files a/bin/domain/Box.class and b/bin/domain/Box.class differ diff --git a/bin/domain/Player.class b/bin/domain/Player.class new file mode 100644 index 0000000..b042281 Binary files /dev/null and b/bin/domain/Player.class differ diff --git a/src/domain/Box.java b/src/domain/Box.java index 7dc3e71..280d65a 100644 --- a/src/domain/Box.java +++ b/src/domain/Box.java @@ -42,6 +42,12 @@ public class Box { private Integer setCategoryR2D2; private int counter[] = new int[8]; + private String savedGamemode; + + public Box(String gamemode) { + + this.savedGamemode = gamemode; + } public void evaluateUpperBoxOptions(ArrayList diceNumbers) { @@ -156,8 +162,9 @@ public class Box { } - public ArrayList giveAllOptions() { + public ArrayList getAllOptions() { ArrayList res = new ArrayList<>(); + if (categoryOne > 0 && (setCategoryOne == null)) res.add("categoryOne: " + categoryOne); if (categoryTwo > 0 && (setCategoryTwo == null)) @@ -191,9 +198,40 @@ public class Box { if (categoryR2D2 > 0 && (setCategoryR2D2 == null)) res.add("categoryR2D2: " + categoryR2D2); - if (res.isEmpty()) - res.add("No options left"); - + if (res.isEmpty()) { + if (setCategoryOne == null) + res.add("categoryOne: " + categoryOne); + if (setCategoryTwo == null) + res.add("categoryTwo: " + categoryTwo); + if (setCategoryThree == null) + res.add("categoryThree: " + categoryThree); + if (setCategoryFour == null) + res.add("categoryFour: " + categoryFour); + if (setCategoryFive == null) + res.add("categoryFive: " + categoryFive); + if (setCategorySix == null) + res.add("categorySix: " + categorySix); + if (setCategorySeven == null && savedGamemode.equals("Special8")) + res.add("categorySeven: " + categorySeven); + if (setCategoryEight == null && savedGamemode.equals("Special8")) + res.add("categoryEight: " + categoryEight); + if (setCategoryTripleMatch == null) + res.add("categoryTrippleMatch: " + categoryTripleMatch); + if (setCategoryFourOfAKind == null) + res.add("categoryFourOfAKind: " + categoryFourOfAKind); + if (setCategoryFullHouse == null) + res.add("categoryFullHouse: " + categoryFullHouse); + if (setCategorySmallStreet == null) + res.add("categorySmallStreet: " + categorySmallStreet); + if (setCategoryBigStreet == null) + res.add("categoryBigStreet: " + categoryBigStreet); + if (setCategoryYahtzee == null) + res.add("categoryYahtzee: " + categoryYahtzee); + if (setCategoryChance == null) + res.add("categoryChance: " + categoryChance); + if (setCategoryR2D2 == null && savedGamemode.equals("Special8")) + res.add("categoryR2D2: " + categoryR2D2); + } return res; } @@ -263,6 +301,43 @@ public class Box { } + public boolean gameOver() { + + if (this.savedGamemode.equals("Special8")) + return setCategoryOne != null && + setCategoryTwo != null && + setCategoryThree != null && + setCategoryFour != null && + setCategoryFive != null && + setCategorySix != null && + setCategorySeven != null && + setCategoryEight != null && + setCategoryTripleMatch != null && + setCategoryFourOfAKind != null && + setCategoryFullHouse != null && + setCategorySmallStreet != null && + setCategoryBigStreet != null && + setCategoryYahtzee != null && + setCategoryChance != null && + setCategoryR2D2 != null; + + else + return setCategoryOne != null && + setCategoryTwo != null && + setCategoryThree != null && + setCategoryFour != null && + setCategoryFive != null && + setCategorySix != null && + setCategoryTripleMatch != null && + setCategoryFourOfAKind != null && + setCategoryFullHouse != null && + setCategorySmallStreet != null && + setCategoryBigStreet != null && + setCategoryYahtzee != null && + setCategoryChance != null; + + } + public int returnTotalPoints() { return setCategoryOne + setCategoryTwo + setCategoryThree + setCategoryFour + setCategoryFive diff --git a/src/domain/Player.java b/src/domain/Player.java new file mode 100644 index 0000000..8d3603f --- /dev/null +++ b/src/domain/Player.java @@ -0,0 +1,24 @@ +package domain; + +public class Player { + + private String name; + private Hand hand; + private Box box; + private String savedGamemode; + + public Player(String name, String gamemode) { + + this.name = name; + this.hand = new Hand(gamemode); + this.box = new Box(gamemode); + this.savedGamemode = gamemode; + + } + + public void getNewHand() { + + this.hand = new Hand(this.savedGamemode); + + } +}