player class created, dice, box, hand almost done
parent
45878b8b7d
commit
0733927542
Binary file not shown.
Binary file not shown.
|
@ -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<Integer> diceNumbers) {
|
||||
|
||||
|
@ -156,8 +162,9 @@ public class Box {
|
|||
|
||||
}
|
||||
|
||||
public ArrayList<String> giveAllOptions() {
|
||||
public ArrayList<String> getAllOptions() {
|
||||
ArrayList<String> 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
|
||||
|
|
|
@ -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);
|
||||
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue