-
Notifications
You must be signed in to change notification settings - Fork 0
/
Board.java
305 lines (264 loc) · 6.95 KB
/
Board.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
import java.util.*;
public class Board{
private GameTiles tiles;
private SceneDeck deck;
private int round;
public Board(){
tiles = new GameTiles();//where the locations and extra actors generate
deck = new SceneDeck();//where the scenes and main actors generate
round = 3;
}
public Board(int playerNum){
tiles = new GameTiles();
round = 3;
}
public void setRound(int round){ this.round = round; }
public int getRound(){
return round;
}
public void nextRound(){
round = round - 1;
}
public Location getTrailer(){ return tiles.get(4); }
public boolean hasFinishedRound(){ return tiles.isBoardWrapped(); }
public boolean hasFinishedGame(){ return round == 0; }
public void prepBoard(){
tiles.resetBoard();
tiles.drawScenes(deck);
}
/*
public userInput getQueries(){ return query; }
private void returnToTrailer(){
for(int i = 0; i < users.size(); i++){
users.get(i).setLocation(tiles.get(4));
}
}
private void createPlayers(int playerNum){
ColorTemplates picture = new ColorTemplates();
for(int i = 0; i < playerNum; i++){
Player temp = new Player();
temp.setColors(picture.get(i));
//temp.setQuery(query);
temp.setPlayerName("Player " + (i+1));
temp.setLocation(tiles.get(4));
users.add(temp);
}
}
private void displayOtherPlayers(int asker){
for(int i = 0; i < users.size(); i++){
if(i != asker){
users.get(i).playerLocation(users.get(i).getPlayerName() + " is");
}
}
}
private void role(Player p){
cont.fixView("ROLE");
//cont.createJobButtons();
while(query.getIntInput() == 0){
cont.getCommand();
}
if(query.getIntInput() != -1){
int ID = query.getIntInput() - 1;
Work newHire = p.getLocation().getSet().getAllActors().get(ID);
p.setJob(newHire);
newHire.bufWork();
p.buffActingStatus(true);
cont.finishedAction("Work");
}
//cont.wrapup();
}
private void act(Player p, boolean succAct){
if(succAct){
System.out.println("You acted succesfully!" );
switch(p.getJob().getWorkType()){
case "MAIN":
p.evalWalletContent().addCredits(2, "You");
break;
case "EXTRA":
p.evalWalletContent().addDollars(1, "You");
p.evalWalletContent().addCredits(1, "You");
break;
default:
}
p.getLocation().getSet().decrementShotCounter();
int shotsLeft = p.getLocation().getSet().getShotCounter();
System.out.print("There is " + shotsLeft + " shots left on ");
System.out.println(p.getLocation().getLocationName() +".");
}else{
System.out.println("You suck at acting. " );
switch(p.getJob().getWorkType()){
case "MAIN":
System.out.println("You do not recieve any currency.");
break;
case "EXTRA":
p.evalWalletContent().addDollars(1, "You");
break;
default:
}
}
}
private void work(Player p){
//cont.fixView("WORK");
if(!p.isWorking()){
role(p);
}
if(playerMoved){
System.out.println("finished moving");
cont.finishedAction("Work");
}
if(p.isWorking() && !playerMoved){
//set buttons for act and rehearsal
cont.fixView("WORK");
while(query.getIntInput() == 0){
cont.getCommand();
}
if(query.getIntInput() != -1){
switch(query.getUserInput()){
case "REHEARSE":
p.grabDice().increaseAC();
break;
case "ACT":
p.grabDice().roll();
int actingEffort = p.grabDice().actRoll();
boolean isSucc = p.getLocation().getSet().isActSuccess(actingEffort);
break;
default:
}
cont.finishedAction("Work");
}
}
cont.wrapup();
}
private void move(Player p){
LinkedList<String> hotSpots = p.neighborNames();
query.addNeighborNames(hotSpots);
cont.fixView("MOVE");
while(query.getIntInput() == 0){
cont.getCommand();
}
if(query.getIntInput() != -1){
p.setLocation(tiles.get(query.getIntInput()));
playerMoved = true;
cont.finishedAction("Move");
//cont.redisplayLoc(p.getLocation());
}
cont.wrapup();
//return hasMoved;
}
*/
/*public void getPlayerInput(Player p, int ID){
boolean hasWorked = false;
boolean hasMoved = false;
while(!query.getUserInput().equals("END")){
cont.setPlayer(p);
String userInput = query.getUserInput();
//String userInput = query.getUserInput();
query.resetValue();
if(query.getUserInput().equals("END")){
System.out.println("END");
System.exit(0);
}
switch(userInput){
case "MOVE":
//if(!hasMoved){
move(p);
//}
break;
case "UPGRADE":
p.upgrade();
break;
case "WORK":
//hasWorked = p.initializeWork(hasWorked, hasMoved);
work(p);
break;
case "AMOUNT":
p.evalWalletContent().displayContent();
break;
case "WHO":
p.playerInformation();
break;
case "WHERE":
p.playerLocation("You are");
displayOtherPlayers(ID);
break;
case "RENAME":
String newName = query.getUserInput("Enter your new name: ");
p.setPlayerName(newName);
break;
default:
//System.out.print("INVALID MOVE. ");
}
cont.getCommand();
cont.redisplayImage();
}
//cont.fixView("END");
playerMoved = false;
query.resetValue();
cont.fixView("END");
System.out.println(" ");
}*/
/*
public int iterateRound(int start){
tiles.drawScenes();
System.out.println("BEGINNING OF ROUND " + display);
System.out.println(" ");
returnToTrailer();
int num = start;
while(!hasFinishedRound()){
Player p = users.get(num);
//p.allowTurn(true);
cont.redisplayImage();
getPlayerInput(p, num);
Set pSet = p.getLocation().getSet();
LinkedList<Player> onScene = getPlayers(p.getLocation());
if(pSet.getShotCounter() == 0){
if(pSet.getScene().hasMainActors()){
LinkedList<Integer> bonusRolls = p.grabDice().getBonusRoll(pSet.getScene().getBudget());
for(int i = 0; i < onScene.size(); i++){
Player actor = onScene.get(i);
String actorType = actor.getJob().getWorkType();
Wallet myWallet = actor.evalWalletContent();
switch(actorType){
case "MAIN":
actor.bonusPayout(bonusRolls);
break;
case "EXTRA":
myWallet.addDollars(onScene.get(i).getJob().getWorkLevel(), actor.getPlayerName());
break;
default:
}
}
}
for(int j = 0; j < onScene.size(); j++){
Player actor = onScene.get(j);
actor.removeWork();
}
}
num = num + 1;
//p.allowTurn(false);
if(num == users.size()){
num = 0;
}
}
System.out.println("END OF ROUND " + getRound());
nextRound();
return num;
}
public LinkedList<Player> getPlayers(Location loc){
LinkedList<Player> onLoc = new LinkedList<Player>();
for(int i = 0; i < users.size(); i++){
Location l = users.get(i).getLocation();
if(l.getID() == loc.getID() && users.get(i).isWorking()){
onLoc.add(users.get(i));
}
}
return onLoc;
}
public boolean hasFinishedRound(){ return tiles.isBoardWrapped(); }
public LinkedList<Player> getPlayers(){
return users;
}
public int displayRound(){
return display;
}*/
}