-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGame.java
192 lines (165 loc) · 4.7 KB
/
Game.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
public class Game {
private static double balance;
private static String name;
private static int day;
public static boolean play = true;
/**
* Checks if the player is bankrupt. The player is bankrupt if their balance is 0
*
* @return returns true if balance is 0
*/
public static boolean isBankrupt() {
if (balance <= 0) {
return true;
}
else {
return false;
}
}
/**
* Moves forward in time by one day
*
*/
public static void moveForward() {
day++;
System.out.println("Moving forward by 1 day");
}
/**
* Moves forward in time by a given number of days
*
* @param days how many days the game moves forward by
*/
public static void moveForward(int days) {
day += days;
System.out.println("Moving forward by" + days + "day");
}
/**
* Returns the day in the simulator
*
* @return day
*/
public static int getDay() {
return day;
}
/**
* Returns the how much money the user has
*
* @return balance
*/
public static double getBalance() {
return balance;
}
/**
* Adds
*
* @param money
*/
public static void addToBalance(double money) {
balance += money;
}
/**
* Returns the players name
*
* @return name
*/
public static String getName() {
return name;
}
/**
* sets the player's balance
*
* @param newBalance
*/
public static void setBalance(double newBalance) {
balance = newBalance;
}
/**
* sets the player's name
*
* @param newName
*/
public static void setName(String newName) {
name = newName;
}
/**
* prints random dialogue for a worker
*
*/
public static void workerTalks() {
int randoming = (int) (Math.random() * (9) + 1);
switch(randoming) {
case 1:
System.out.println("Worker: Sup boss, when we getting paid?");
break;
case 2:
System.out.println("Worker: Can I go on break yet? I wanna play Brawlstars!");
break;
case 3:
System.out.println("Worker: Why can't I get the day off? It shouldn't matter if I got 3 days off last week!");
break;
case 4:
System.out.println("Worker: What do you mean?? I wasn't on BlockBlast I was working on our website!");
break;
case 5:
System.out.println("Worker: I said to GIVE ME A MINUTE BOSS, I'm talking to my grandma!");
break;
case 6:
System.out.println("Worker: Hello welcome to the best (only) pet shop in town! How may you waste my time? Oh boss, I didn't see you there, I was just um answering the phone!");
break;
case 7:
System.out.println("Worker: Hello World!");
break;
case 8:
System.out.println("Worker: *On the phone*: No sir, we don't sell gorillas, I don't care if you toured Kenya twice!");
break;
case 9:
System.out.println("Worker: Hey boss, I know I just started but I was wondering if I could get premoted to CEO, my dad's the CEO of Pinapple so you shouldn't have a problem with it");
}
}
/**
* prints options
*
*/
public static void menu() {
System.out.println("What would you like to do?");
System.out.println("0 - End the game");
System.out.println("1 - Buy a new animal for $30");
System.out.println("2 - Increase capacity ");
System.out.println("3 - Spend $100 to increase the adoption rate by 5%");
System.out.println("4 - Check expenses and statistics");
System.out.println("5 - Converse with workers");
System.out.println("6 - Wait");
}
/**
* Pays for the expenses of a month
*/
public static void payBills() {
if (day % 30 == 0) {
addToBalance(calculateBills());
}
}
/**
* Calculates how much the monthly bill costs
*
* @return
*/
public static double calculateBills() {
return -(Animal.getNumPets() * 30) - 320;
}
/**
* sets the game boolean to false to end the game
*
* @param bool
*/
public static void playGame(boolean bool) {
play = bool;
}
/**
* returns whether or not the user wants to play
*
* @return play
*/
public static boolean play() {
return play;
}
}