浏览代码

minor fixes

Chad 6 年前
父节点
当前提交
a5ace688fc

+ 9
- 7
src/main/java/io/zipcoder/casino/Leviathan/Games/HigherDice.java 查看文件

@@ -33,14 +33,16 @@ public class HigherDice extends DiceGame implements Gambling {
33 33
             int croupier = aDie.getValue();
34 34
             aConsole.println("The House rolled a " + croupier);
35 35
             findWinner(player, croupier, bet);
36
+            repeat();
37
+        }
38
+    }
36 39
 
37
-
38
-            if ((aPlayer.getTotalChips() == 0)) {
39
-                aConsole.println("You are out of chips. You may no longer play");
40
-                playAgain = false;
41
-            } else if (aConsole.getStringInput("Would you like to play again?").equalsIgnoreCase("no")) {
42
-                playAgain = false;
43
-            }
40
+    public void repeat() {
41
+        if ((aPlayer.getTotalChips() == 0)) {
42
+            aConsole.println("You are out of chips. You may no longer play");
43
+            playAgain = false;
44
+        } else if (aConsole.getStringInput("Would you like to play again?").equalsIgnoreCase("no")) {
45
+            playAgain = false;
44 46
         }
45 47
     }
46 48
 

+ 7
- 3
src/main/java/io/zipcoder/casino/Leviathan/Table.java 查看文件

@@ -62,8 +62,12 @@ public class Table {
62 62
                 played = true;
63 63
             } else if (choice == 5) // Chips
64 64
             {
65
-                aPlayer.setTotalChips(aPlayer.getTotalChips() + aConsole.getIntInput("How many more chips would you like?"));
66
-                aConsole.println("Great! Here you go! Good Luck!");
65
+                if (aPlayer.getAge() > 20) {
66
+                    aPlayer.setTotalChips(aPlayer.getTotalChips() + aConsole.getIntInput("How many more chips would you like?"));
67
+                    aConsole.println("Great! Here you go! Good Luck!\n");
68
+                } else {
69
+                    aConsole.println("You are not old enough to gamble, so we won't be able to let you purchase any chips.\n");
70
+                }
67 71
             } else if (choice == 6) // Cash Out
68 72
             {
69 73
                 play = false;
@@ -71,7 +75,7 @@ public class Table {
71 75
                 aConsole.println("You've cashed out " + aPlayer.getTotalChips() + " chips");
72 76
                 aConsole.println("Please come again!");
73 77
             } else {
74
-                aConsole.println("That is not an option " + aPlayer.getName() + "... Do better");
78
+                aConsole.println("That is not an option " + aPlayer.getName() + "... Do better\n");
75 79
             }
76 80
         }
77 81