-
Notifications
You must be signed in to change notification settings - Fork 0
/
Upgrades.java
228 lines (224 loc) · 7.42 KB
/
Upgrades.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
public class Upgrades {
private final int PISTOL = 1, UZI = 2, SHOTGUN = 3, BARREL = 4,
GRENADE = 5, BARRICADE = 6,SENTRY=7; //constants to store the position of the weapons in most arrays
BoxHead BH;
private String[] upgradeStrings = new String[26]; //names of all the upgrades
public int[] allUpgradesNum = new int[26]; //number of consecutive kills needed for each upgrade
public Upgrades(BoxHead b) {
BH = b;
addUpgrades();
addUpgradeNames();
}
public void addUpgrades() {
//adds the number of consecutive kills needed for each upgrade
allUpgradesNum[0] = 3; // pistol fast fire
allUpgradesNum[1] = 5; // new weapon UZI
allUpgradesNum[2] = 8; // pistol double damage
allUpgradesNum[3] = 10; // new weapon shotgun
allUpgradesNum[4] = 13; // uzi rapid fire
allUpgradesNum[5] = 15; // new weapon barrel
allUpgradesNum[6] = 17; // uzi double ammo
allUpgradesNum[7] = 18; // shotgun fast fire
allUpgradesNum[8] = 20; // new weapon grenade
allUpgradesNum[9] = 21; // shotgun double ammo
allUpgradesNum[10] = 23; // uzi long shot
allUpgradesNum[11] = 26; // barrel double ammo
allUpgradesNum[12] = 30; // new weapon fake wall
allUpgradesNum[13] = 31; // shot gun wide shot
allUpgradesNum[14] = 35; // shotgun long shot
allUpgradesNum[15] = 36; // barrel quad ammo
allUpgradesNum[16] = 37; // fake walls double ammo
allUpgradesNum[17] = 39; // uzi quad ammo
allUpgradesNum[18] = 41; // shotgun quad ammo
allUpgradesNum[19] = 42; // grenade double ammo
allUpgradesNum[20] = 43; // shotgun rapid fire
allUpgradesNum[21] = 48; // uzi double damage
allUpgradesNum[22] = 51; // shotgun wider shot
allUpgradesNum[23] = 52; // grenade quad ammo
allUpgradesNum[24] = 53; // fake walls quad ammo
allUpgradesNum[25]=75;
}
public void addUpgradeNames(){
//adds the names of each upgrade
upgradeStrings[0] = "pistol fast fire";
upgradeStrings[1] = "new weapon UZI";
upgradeStrings[2] = "pistol double damage";
upgradeStrings[3] = "new weapon shotgun";
upgradeStrings[4] = "uzi rapid fire";
upgradeStrings[5] = "new weapon barrel";
upgradeStrings[6] = "uzi double ammo";
upgradeStrings[7] = "shotgun fast fire";
upgradeStrings[8] = "new weapon grenade";
upgradeStrings[9] ="shotgun double ammo";
upgradeStrings[10] ="uzi long shot";
upgradeStrings[11] = "barrel double ammo";
upgradeStrings[12] = "new weapon fake wall";
upgradeStrings[13] = "shot gun wide shot";
upgradeStrings[14] = "shotgun long shot";
upgradeStrings[15] = "barrel quad ammo";
upgradeStrings[16] = "fake walls double ammo";
upgradeStrings[17] = "uzi quad ammo";
upgradeStrings[18] = "hotgun quad ammo";
upgradeStrings[19] = "grenade double ammo";
upgradeStrings[20] = "shotgun rapid fire";
upgradeStrings[21] = "uzi double damage";
upgradeStrings[22] = "shotgun wider shot";
upgradeStrings[23] = "grenade quad ammo";
upgradeStrings[24] = "fake walls quad ammo";
upgradeStrings[25]="new weapon sentry gun";
}
public String getUpgradeString(int n){
//get the name of the upgrade at n
return upgradeStrings[n];
}
public void getUpgrade(int n) {
//get the upgrade permitted at n
BH.game.fullUpgradeCountDown(); //the counter to blit the upgradeString is set at max, ready for count down
//if a weapon is introduced, the ammo is added to the Max and the current weapon is set to that weapon
//if this is an upgrade on an existing weapon, modifications are made
//the UpgradeString in gamePanel is changed to the name of the current upgrade
if (n == 3) {
//pistol fast fire
BH.game.setUpgradeString("Pistol Fast Fire");
BH.mc.setConsecutiveShoot(PISTOL);
}
else if (n == 5) {
// new weapon UZI
BH.game.setUpgradeString("New Weapon: UZI");
BH.mc.addAmmo(UZI);
BH.magicalBoxAllowance=UZI;
BH.mc.setWeapon(UZI);
}
else if (n == 8) {
// pistol double damage
BH.mc.setDmg(PISTOL, 10);
BH.game.setUpgradeString("Pistol Double Damage");
}
else if (n == 10) {
// new weapon shotgun
BH.game.setUpgradeString("New Weapon: Shotgun");
BH.mc.addAmmo(SHOTGUN);
BH.mc.setWeapon(SHOTGUN);
BH.magicalBoxAllowance=SHOTGUN;
}
else if (n == 13) {
// uzi rapid fire
BH.mc.setConsecutiveShoot(UZI);
BH.game.setUpgradeString("UZI Rapid Fire");
}
else if (n == 15) {
// new weapon barrel
BH.game.setUpgradeString("New Weapon: Barrel");
BH.mc.addAmmo(BARREL);
BH.magicalBoxAllowance=BARREL;
BH.mc.setWeapon(BARREL);
}
else if (n == 17) {
// uzi double ammo
BH.mc.setMaxAmmo(UZI, BH.mc.getMaxAmmo(UZI)*2);
BH.game.setUpgradeString("UZI Double Ammo");
}
else if (n == 18) {
// shotgun fast fire
BH.mc.setConsecutiveShoot(SHOTGUN);
BH.game.setUpgradeString("Shotgun Fast Fire");
}
else if (n == 20) {
// new weapon grenadE
BH.game.setUpgradeString("New Weapon: Grenade");
BH.mc.addAmmo(GRENADE);
BH.magicalBoxAllowance=GRENADE;
BH.mc.setWeapon(GRENADE);
}
else if (n == 21) {
// shot gun double ammo
BH.mc.setMaxAmmo(SHOTGUN, BH.mc.getMaxAmmo(SHOTGUN)*2);
BH.game.setUpgradeString("Shotgun Double Ammo");
//NOT DONE
}
else if (n == 23) {
// uzi long shot
BH.mc.setDist(UZI, 700);
BH.game.setUpgradeString("UZI Long Shot");
//NOT DONE
}
else if (n == 26) {
// barrel double ammo
BH.mc.setMaxAmmo(BARREL, BH.mc.getMaxAmmo(BARREL)*2);
BH.game.setUpgradeString("Barrel Double Ammo");
}
else if (n == 30) {
// new weapon fakewall
BH.game.setUpgradeString("New Weapon: Barricade");
BH.mc.addAmmo(BARRICADE);
BH.magicalBoxAllowance=BARRICADE;
BH.mc.setWeapon(BARRICADE);
}
else if (n == 31) {
// shotgun wide shoot
BH.mc.setSGW(1);
BH.game.setUpgradeString("Shotgun Wide Shoot");
}
else if (n == 35) {
// shotgun long shot
BH.mc.setDist(SHOTGUN, 400);
BH.game.setUpgradeString("Shotgun Long Shot");
}
else if (n == 36) {
// barrel quad ammo
BH.mc.setMaxAmmo(BARREL,BH.mc.getMaxAmmo(BARREL));
BH.game.setUpgradeString("Barrel Quad Ammo");
}
else if (n == 37) {
// fake walls double ammo
BH.mc.setMaxAmmo(BARRICADE,BH.mc.getMaxAmmo(BARRICADE));
BH.game.setUpgradeString("Barricade Double Ammo");
}
else if (n == 39) {
// uzi quad ammo
BH.mc.setMaxAmmo(UZI,BH.mc.getMaxAmmo(UZI)*4);
BH.game.setUpgradeString("UZI Quad Ammo");
}
else if (n == 41) {
// shotgun quad ammo
BH.mc.setMaxAmmo(SHOTGUN,BH.mc.getMaxAmmo(SHOTGUN)*4);
BH.game.setUpgradeString("Shotgun Quad Ammo");
}
else if (n == 42) {
// grenade double ammo
BH.mc.setMaxAmmo(GRENADE,BH.mc.getMaxAmmo(GRENADE)*2);
BH.game.setUpgradeString("Grenade Double Ammo");
}
else if (n == 43) {
// shotgun rapid fire
BH.mc.setConsecutiveShoot(SHOTGUN);
BH.game.setUpgradeString("Shotgun Rapid Fire");
}
else if (n == 48) {
// uzi double damage
BH.mc.setDmg(UZI, 30);
BH.game.setUpgradeString("UZI Double Damage");
}
else if (n == 51) {
// shotgun wider shot
BH.mc.setSGW(2);
BH.game.setUpgradeString("Shotgun Wider Shot");
}
else if (n == 52) {
// grenade quad ammo
BH.mc.setMaxAmmo(GRENADE, BH.mc.getMaxAmmo(GRENADE)*4);
BH.game.setUpgradeString("Grenade Quad Ammo");
}
else if (n == 53) {
// fake walls quad ammo
BH.mc.setMaxAmmo(BARRICADE, BH.mc.getMaxAmmo(BARRICADE)*4);
BH.game.setUpgradeString("Barricade Quad Ammo");
}
else if (n==75){
BH.mc.addAmmo(SENTRY);
BH.game.setUpgradeString("New Weapon: Sentry Gun");
BH.magicalBoxAllowance=SENTRY;
BH.mc.setWeapon(SENTRY);
}
}
}