From 0733927542553a6cbe51dd6e28d14253a1923a42 Mon Sep 17 00:00:00 2001 From: selim Date: Sun, 28 Apr 2024 14:19:50 +0200 Subject: [PATCH] player class created, dice, box, hand almost done --- bin/domain/Box.class | Bin 7502 -> 8667 bytes bin/domain/Player.class | Bin 0 -> 705 bytes src/domain/Box.java | 83 ++++++++++++++++++++++++++++++++++++++-- src/domain/Player.java | 24 ++++++++++++ 4 files changed, 103 insertions(+), 4 deletions(-) create mode 100644 bin/domain/Player.class create mode 100644 src/domain/Player.java diff --git a/bin/domain/Box.class b/bin/domain/Box.class index b677b46b156c12426da894bf0e60834c57b96a4a..536567613e6d2f3815faf50ab32a916a2b529272 100644 GIT binary patch literal 8667 zcmcIpdwf*Ywf@$bNoEKq$z%wGM?e(RkkO=qMdT4g9`Xo82@*p@7?L53OlIO_5|G+T zy$BX-rNz=lsR$MaMX6YW7!_YN*7~eyeLt$!Y9IHuw%7VB_uKoNIdewv{_a0Fzu)Y& z_P6$4`?c2EYoGk)-@S(bOp(z(7=nV9L|Zr-uRc4m)(5X3aB;XRTpbI?TdV6i+!Lo|eOovdt50zo zxpt@J+0oVvR-EbG7+#fHr*^w2gG^r)jyJovf8p2}V+Dg;%g&jeTaYuuQdbYxB;D_o`iYDUhGuWPFXDS-2o|a68FRhJsq$a6(_N$M!#>1)3B!@lqn9U};7MSsY8ul%~ zR7~^XESk64kG&ZFK$9`cp4 z^Gz&Pjl3PvbrB`Hz=RL^id$mBZ*doz=x1>knJBQh#kH6yL_R}NOSIWO zX0;M)H*y!u^OPtzt2XEOFKy45K;^MI9s7J}$Mvaj^XmEGcH4d&^QcX%ahr!)Rhx<7 z)@&0d$}H{@6N4?T!$i5ob($DracfKrwYW=7470dznHZr~THMju#t0OPSw_v(3V*?j zd1fuMfJ3i0F%gp#cZG@7;1(3}2-(@O-m(hYbdK7r(6J@%9kD&Oh9k^GwOZ>{CW=rT z}S=wWluC-m)afwNgWgDuSvQpo&se48&$X`siQv?UCkaI5wdG zzs7HTc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6#+ESAHnA2BR5_d2*e8$f6^y#~8|B2ntDZvy TsFFv?@Vm+UgkPY>u7&zD39W>R literal 0 HcmV?d00001 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); + + } +}