|
@@ -7,6 +7,7 @@ import java.util.InputMismatchException;
|
7
|
7
|
public class Casino {
|
8
|
8
|
public boolean running = true;
|
9
|
9
|
private ArrayList<String> gameLib = new ArrayList<>();
|
|
10
|
+ private Game[] cardGames = {new Stud(10), new War(10)};
|
10
|
11
|
private ArrayList<Player> players = new ArrayList<>();
|
11
|
12
|
private Console console = new Console();
|
12
|
13
|
private Game game = null;
|
|
@@ -50,7 +51,7 @@ public class Casino {
|
50
|
51
|
switch (command) {
|
51
|
52
|
|
52
|
53
|
case 2:
|
53
|
|
- Game war = new War(10);
|
|
54
|
+ Game war = cardGames[1];
|
54
|
55
|
((War) war).addPlayers(player);
|
55
|
56
|
((War) war).addNpc();
|
56
|
57
|
game = war;
|
|
@@ -58,9 +59,9 @@ public class Casino {
|
58
|
59
|
break;
|
59
|
60
|
|
60
|
61
|
case 3:
|
61
|
|
- Game stud = new Stud(10);
|
|
62
|
+ Game stud = cardGames[0];
|
62
|
63
|
((Stud) stud).addPlayers(player);
|
63
|
|
- ((Stud) stud).addNpc();
|
|
64
|
+ addStudPlayers(stud);
|
64
|
65
|
game = stud;
|
65
|
66
|
stud.startGame();
|
66
|
67
|
break;
|
|
@@ -122,8 +123,8 @@ public class Casino {
|
122
|
123
|
int numPlayers = getStudPlayers();
|
123
|
124
|
|
124
|
125
|
for(int i = 1; i < numPlayers; i ++) {
|
125
|
|
- console.createAccount();
|
126
|
|
- ((Stud) game).addPlayers(players.get(i));
|
|
126
|
+ Player player = console.createAccount();
|
|
127
|
+ ((Stud) game).addPlayers(player);
|
127
|
128
|
}
|
128
|
129
|
}
|
129
|
130
|
|
|
@@ -131,14 +132,12 @@ public class Casino {
|
131
|
132
|
this.player = player;
|
132
|
133
|
}
|
133
|
134
|
|
134
|
|
- public ArrayList<String> getGameLib() {
|
135
|
|
- return gameLib;
|
136
|
|
- }
|
137
|
|
-
|
138
|
135
|
public Game getGame() {
|
139
|
136
|
return game;
|
140
|
137
|
}
|
141
|
|
- public boolean isRunning() {
|
142
|
|
- return running;
|
|
138
|
+
|
|
139
|
+ public void setGame(Game game) {
|
|
140
|
+ this.game = game;
|
143
|
141
|
}
|
|
142
|
+
|
144
|
143
|
}
|