-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEnemy.java
More file actions
531 lines (513 loc) · 24.5 KB
/
Enemy.java
File metadata and controls
531 lines (513 loc) · 24.5 KB
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
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
package hod_game;
import java.util.Random;
import java.util.Scanner;
public class Enemy
{
String enemyType[] = {"Skeley boi", "Lesser Imp", "(crappy) Mage"};
String enemyType2[] = {"Big mossy boi", "Colossal Forest Spider", "Forest Gremlin"};
String enemyType3[] = {"Sp00ky boi", "Zambie", "Ball of Bones"};
String enemyType4[] = {"(high tier) Mage", "(not so good) Angel", "Gigantic Fist boi"};
int lvl, enemyHealth, enemyatt, damageDealt, str, dex, con, intel, wis, cha; ;
Random rand = new Random();
Scanner scan = new Scanner(System.in);
int[] enemyStats;
int difficulty;
public Enemy(int Elvl, int Ehealth, int Estr, int Edex, int Econ, int Eintel, int Ewis, int Echa)
{
lvl = Elvl;
str = Estr;
dex = Edex;
con = Econ;
intel = Eintel;
wis = Ewis;
cha = Echa;
enemyHealth = Ehealth;
enemyStats = new int[]{lvl, enemyHealth, str, dex, con, intel, wis, cha};
}
public void getEnemy()
{
System.out.println("\n\n\tA " + enemyType[rand.nextInt(enemyType.length)] + " has appeared!");
}
public void getEnemy2()
{
System.out.println("\n\n\tA " + enemyType2[rand.nextInt(enemyType.length)] + " has appeared!");
}
public void getEnemy3()
{
System.out.println("\n\n\tA " + enemyType3[rand.nextInt(enemyType.length)] + " has appeared!");
}
public void getEnemy4()
{
System.out.println("\n\n\tA " + enemyType4[rand.nextInt(enemyType.length)] + " has appeared!");
}
public void showEnemyStats() // command "identify"
{
System.out.println("\n\tLEVEL: " +enemyStats[0] + "\n\tHP: " + enemyStats[1] + "\n\tSTR: " + enemyStats[2] + "\n\tDEX: " + enemyStats[3] + "\n\tCON: " + enemyStats[4] + "\n\tINT: " + enemyStats[5] + "\n\tWIS: " + enemyStats[6] + "\n\tCHA: " + enemyStats[7]);
}
public void newEnemy(int difficultyNum) //Different values depending on the difficulty chosen
{
difficulty = difficultyNum;
switch (difficultyNum) {
case 1:
enemyStats[1] = rand.nextInt(16) + 50;
enemyStats[2] = rand.nextInt(6) + 10;
enemyStats[3] = rand.nextInt(8) + 8;
enemyStats[4] = rand.nextInt(10) + 6;
enemyStats[5] = rand.nextInt(10) + 6;
enemyStats[6] = rand.nextInt(10) + 6;
enemyStats[7] = rand.nextInt(10) + 6;
break;
case 2:
enemyStats[1] = rand.nextInt(21) + 50;
enemyStats[2] = rand.nextInt(8) + 10;
enemyStats[3] = rand.nextInt(10) + 8;
enemyStats[4] = rand.nextInt(10) + 6;
enemyStats[5] = rand.nextInt(10) + 6;
enemyStats[6] = rand.nextInt(10) + 6;
enemyStats[7] = rand.nextInt(10) + 6;
break;
case 3:
enemyStats[1] = rand.nextInt(26) + 50;
enemyStats[2] = rand.nextInt(10) + 10;
enemyStats[3] = rand.nextInt(11) + 8;
enemyStats[4] = rand.nextInt(10) + 6;
enemyStats[5] = rand.nextInt(10) + 6;
enemyStats[6] = rand.nextInt(10) + 6;
enemyStats[7] = rand.nextInt(10) + 6;
break;
case 4:
enemyStats[1] = rand.nextInt(31) + 50;
enemyStats[2] = rand.nextInt(12) + 10;
enemyStats[3] = rand.nextInt(12) + 8;
enemyStats[4] = rand.nextInt(10) + 6;
enemyStats[5] = rand.nextInt(10) + 6;
enemyStats[6] = rand.nextInt(10) + 6;
enemyStats[7] = rand.nextInt(10) + 6;
break;
default:
break;
}
}
public void newEnemy2(int difficultyNum)
{
difficulty = difficultyNum;
switch (difficultyNum) {
case 1:
enemyStats[1] = rand.nextInt(16) + 50;
enemyStats[2] = rand.nextInt(6) + 10;
enemyStats[3] = rand.nextInt(10) + 8;
enemyStats[4] = rand.nextInt(10) + 6;
enemyStats[5] = rand.nextInt(10) + 6;
enemyStats[6] = rand.nextInt(10) + 6;
enemyStats[7] = rand.nextInt(10) + 6;
break;
case 2:
enemyStats[1] = rand.nextInt(21) + 50;
enemyStats[2] = rand.nextInt(8) + 10;
enemyStats[3] = rand.nextInt(10) + 8;
enemyStats[4] = rand.nextInt(10) + 6;
enemyStats[5] = rand.nextInt(10) + 6;
enemyStats[6] = rand.nextInt(10) + 6;
enemyStats[7] = rand.nextInt(10) + 6;
break;
case 3:
enemyStats[1] = rand.nextInt(26) + 50;
enemyStats[2] = rand.nextInt(10) + 10;
enemyStats[3] = rand.nextInt(10) + 8;
enemyStats[4] = rand.nextInt(10) + 6;
enemyStats[5] = rand.nextInt(10) + 6;
enemyStats[6] = rand.nextInt(10) + 6;
enemyStats[7] = rand.nextInt(10) + 6;
break;
case 4:
enemyStats[1] = rand.nextInt(31) + 50;
enemyStats[2] = rand.nextInt(12) + 10;
enemyStats[3] = rand.nextInt(10) + 8;
enemyStats[4] = rand.nextInt(10) + 6;
enemyStats[5] = rand.nextInt(10) + 6;
enemyStats[6] = rand.nextInt(10) + 6;
enemyStats[7] = rand.nextInt(10) + 6;
break;
default:
break;
}
}
public void newEnemy3(int difficultyNum)
{
difficulty = difficultyNum;
switch (difficultyNum) {
case 1:
enemyStats[1] = rand.nextInt(16) + 50;
enemyStats[2] = rand.nextInt(6) + 10;
enemyStats[3] = rand.nextInt(10) + 8;
enemyStats[4] = rand.nextInt(10) + 6;
enemyStats[5] = rand.nextInt(10) + 6;
enemyStats[6] = rand.nextInt(10) + 6;
enemyStats[7] = rand.nextInt(10) + 6;
break;
case 2:
enemyStats[1] = rand.nextInt(21) + 50;
enemyStats[2] = rand.nextInt(8) + 10;
enemyStats[3] = rand.nextInt(10) + 8;
enemyStats[4] = rand.nextInt(10) + 6;
enemyStats[5] = rand.nextInt(10) + 6;
enemyStats[6] = rand.nextInt(10) + 6;
enemyStats[7] = rand.nextInt(10) + 6;
break;
case 3:
enemyStats[1] = rand.nextInt(26) + 50;
enemyStats[2] = rand.nextInt(10) + 10;
enemyStats[3] = rand.nextInt(10) + 8;
enemyStats[4] = rand.nextInt(10) + 6;
enemyStats[5] = rand.nextInt(10) + 6;
enemyStats[6] = rand.nextInt(10) + 6;
enemyStats[7] = rand.nextInt(10) + 6;
break;
case 4:
enemyStats[1] = rand.nextInt(31) + 50;
enemyStats[2] = rand.nextInt(12) + 10;
enemyStats[3] = rand.nextInt(10) + 8;
enemyStats[4] = rand.nextInt(10) + 6;
enemyStats[5] = rand.nextInt(10) + 6;
enemyStats[6] = rand.nextInt(10) + 6;
enemyStats[7] = rand.nextInt(10) + 6;
break;
default:
break;
}
}
public void newEnemy4(int difficultyNum)
{
difficulty = difficultyNum;
switch (difficultyNum) {
case 1:
enemyStats[1] = rand.nextInt(16) + 50;
enemyStats[2] = rand.nextInt(6) + 10;
enemyStats[3] = rand.nextInt(10) + 8;
enemyStats[4] = rand.nextInt(10) + 6;
enemyStats[5] = rand.nextInt(10) + 6;
enemyStats[6] = rand.nextInt(10) + 6;
enemyStats[7] = rand.nextInt(10) + 6;
break;
case 2:
enemyStats[1] = rand.nextInt(21) + 50;
enemyStats[2] = rand.nextInt(8) + 10;
enemyStats[3] = rand.nextInt(10) + 8;
enemyStats[4] = rand.nextInt(10) + 6;
enemyStats[5] = rand.nextInt(10) + 6;
enemyStats[6] = rand.nextInt(10) + 6;
enemyStats[7] = rand.nextInt(10) + 6;
break;
case 3:
enemyStats[1] = rand.nextInt(26) + 50;
enemyStats[2] = rand.nextInt(10) + 10;
enemyStats[3] = rand.nextInt(10) + 8;
enemyStats[4] = rand.nextInt(10) + 6;
enemyStats[5] = rand.nextInt(10) + 6;
enemyStats[6] = rand.nextInt(10) + 6;
enemyStats[7] = rand.nextInt(10) + 6;
break;
case 4:
enemyStats[1] = rand.nextInt(31) + 50;
enemyStats[2] = rand.nextInt(12) + 10;
enemyStats[3] = rand.nextInt(10) + 8;
enemyStats[4] = rand.nextInt(10) + 6;
enemyStats[5] = rand.nextInt(10) + 6;
enemyStats[6] = rand.nextInt(10) + 6;
enemyStats[7] = rand.nextInt(10) + 6;
break;
default:
break;
}
}
public int bossOneSkills(int skillUse, int pDEX, int pSTR, int pCON, int eSTR)
{
int Bdmg = 0;
String choice;
switch (skillUse)
{
case 0:
System.out.println("\n\tBig Boi enrages himself and charges straight toward you!");
if(rand.nextInt(pDEX)>7)
{
System.out.println("\n\tYou managed to dodge his charge attack!");
}
else
{
Bdmg = rand.nextInt(eSTR) + (eSTR/2);
System.out.println("\n\tBig Boi slams you and knocks you down! You took " + Bdmg + " damage!");
}
break;
case 1:
System.out.println("\n\tBig Boi looks like he's going for a powerful swing, looks risky to try dodging, but the choice is yours.\n\n\t"
+ "Do you 1. Shield yourself from the attack 2. Take a risk and try dodging (type 1 or 2 for decision)");
while(true)
{
choice = scan.nextLine();
if(choice.equals("1"))
{
Bdmg = ((rand.nextInt(eSTR) + (eSTR/2))*3) - pSTR - pCON;
System.out.println("\n\tYou shield youself from his powerful blow, but still take " + Bdmg + " damage!");
break;
}
else if(choice.equals("2"))
{
if(rand.nextInt(pDEX)>7)
{
System.out.println("\n\tYou managed to dodge his charge attack!");
}
else
{
Bdmg = ((rand.nextInt(eSTR) + (eSTR/2))*3);
System.out.println("\n\tYou couldn't dodge his attack! You took " + Bdmg + " damage!");
}
break;
}
else
{
System.out.println("\n\tPlease type either 1 or 2");
}
}
break;
}
return Bdmg;
}
public int bossTwoSkills(int skillUse, int pSTR, int pCON, int pINT, int pCHA, int eSTR, int eINT)
{
int Bdmg = 0;
String choice;
switch (skillUse)
{
case 0:
System.out.println("\n\tHacker Girl whips out her laptop and starts to furiously type on the keyboard! You try to figure out what she's doing!");
if(rand.nextInt(pINT)>7)
{
System.out.println("\n\tYou were smart enough to realize that she is just furiously typing nothing but incoherent letters! You tell her as such and she just glares at you before putting her laptop away.");
}
else
{
Bdmg = ((rand.nextInt(eSTR) + (eINT/2))*3);
System.out.println("\n\tYou can't figure out what she's doing! She laughs at you and says \"Ha! Your puny brain is no match for my superior intellect!\". You are ashamed and take " + Bdmg + " damage due to your humiliation!");
}
break;
case 1:
System.out.println("\n\tHacker Girl stares at a tree with an odd sense of purpose. Soon you realize that she is hacking into the world itself! You can't believe what you're seeing and rationalize that it shouldn't be possible unless you are in some sort of game! You need to try and stop her!\n\n\t"
+ "Do you 1. Try to talk her out of doing anything. 2. Try to curl into a ball and defend yourself 3. Brace yourself for what she's about to do (type 1, 2, or 3 for decision)");
while(true)
{
choice = scan.nextLine();
if(choice.equals("1"))
{
if(rand.nextInt(pCHA)>7)
{
System.out.println("\n\tYou were able to distract her enough for long enough that her hacking attempt fails! Whew!");
}
else
{
Bdmg = rand.nextInt(eSTR) + (eINT/2);
System.out.println("\n\tYour attempt to stall her fails! She is still able to complete her hack, but it seems to do a little less damage because of what you did. You took " + Bdmg + " damage!");
}
break;
}
else if(choice.equals("2"))
{
Bdmg = ((rand.nextInt(eSTR) + (eINT/2))*3) - pSTR - pCON;
System.out.println("\n\tYou curling into a ball seems to help you a bit with her changing your health value somehow, but you still take " + Bdmg + " damage!");
break;
}
else if(choice.equals("3")){
if(rand.nextInt(pCON)>7 && rand.nextInt(pSTR)>7){
System.out.println("\n\tSomehow that managed to work! It seems like a miracle, but you don't take any damage!");
}
else{
Bdmg = ((rand.nextInt(eSTR) + (eINT/2))*3);
System.out.println("\n\tYou just stand there uselessly. What did you think would happen? You took " + Bdmg + " damage since you allowed her to hack away your health!");
}
}
else
System.out.println("\n\tPlease choose a valid option!");
}
break;
}
return Bdmg;
}
public int bossThreeSkills(int skillUse, int pDEX, int pSTR, int pCON, int pCHA, int eSTR)
{
int Bdmg = 0;
String choice;
switch (skillUse)
{
case 0:
System.out.println("The mob of girls appear to start hysterically crying! What will you do? \n\n\t" +
"1. Try to calm them down! 2. Try to take this opportunity to attack them! (type 1 or 2 for decision)");
while(true)
{
choice = scan.nextLine();
if(choice.equals("1"))
{
if(rand.nextInt(pCHA)>7) /////////////////////ERROR//////////////////
{
System.out.println("\n\tYou were able to calm down the girls! That was weird.");
}
else
{
Bdmg = rand.nextInt(eSTR) + (eSTR/2);
System.out.println("\n\tYou couldn't calm them down, though they appreciate the effort! They stare at you with their tear-filled eyes and you feel extremely uncomfortable. You took " + Bdmg + " damage!");
}
break;
}
else if(choice.equals("2"))
{
Bdmg = ((rand.nextInt(eSTR) + (eSTR/2))*3);
System.out.println("\n\tWow, that's rude. They simply dismiss your attack as it appears that they were charging a powerful spell this whole time! You took " + Bdmg + " damage!");
break;
}
else
System.out.println("\n\tPlease choose a valid option!");
}
break;
case 1:
System.out.println("The weird children appear to be combining together to make one huge monstrosity! Children nowadays. How do you react? \n\n\t" +
"1. Take a defensive stance! 2. Try to bring the beast down before it fully metamorphosizes! 3. Gawk at how ugly it is! (type 1, 2, or 3 for decision)");
while(true)
{
choice = scan.nextLine();
if(choice.equals("1"))
{
Bdmg = ((rand.nextInt(eSTR) + (eSTR/2))*3) - pSTR - pCON;
System.out.println("\n\tYou have enough time to take a defensive stance and shield yourself from a powerful blow from their now huge fist,\n\t but still take " + Bdmg + " damage! They fall back out into individual girls after they hit you.");
break;
}
else if(choice.equals("2"))
{
if(rand.nextInt(pDEX)>8){
System.out.println("\n\tYou are able to reach out and pull back one of the girls in time! This interrupts their transformation and they all fall back!");
}
else{
Bdmg = ((rand.nextInt(eSTR) + (eSTR/2))*3);
System.out.println("\n\tYou aren't quick enough to stop them from transforming! They kick you away as hard as they can in their enlargened\n\t state before returning to their original individual children selves. You took " + Bdmg + " damage!");
}
break;
}
else if(choice.equals("3"))
{
Bdmg = ((rand.nextInt(eSTR) + (eSTR/2))*4);
System.out.println("\n\tThat's really mean, they're just trying to live their abnormal lives you meanie! Once they fully transform, they see how you're looking at them and scream at you!"
+ "\n\t They bring their now mighty fist down for one attack before all falling out back into their original formation. You took " + Bdmg + " damage!");
break;
}
else
System.out.println("\n\tPlease choose a valid option!");
}
break;
}
return Bdmg;
}
public int[] bossFourSkills(int skillUse, int[] pSTATS, int[] eSTATS, boolean TNR)
{
int[] newPSTATS = new int[pSTATS.length];
System.arraycopy(pSTATS, 0, newPSTATS, 0, newPSTATS.length);
int mES = eSTATS[2], lPS = newPSTATS[1], dmg = 0, dodge;
String choice;
switch (skillUse)
{
case 0:
if(TNR == true)
{
System.out.println("\n\t\"I will SUCC the power right out of you!\"\n\n\tEvil Boi drained your stats!");
for(int i = 0; i<pSTATS.length; i++)
{
pSTATS[i] -= rand.nextInt(6)+1;
}
}
else if(TNR == false)
{
dmg = rand.nextInt(eSTATS[2]) + 10;
newPSTATS[0] -= dmg;
System.out.println("\n\tEvil Boi simply snaps his fingers and a series of explosions hit you!\n\tYou took " + dmg + " damage!");
}
break;
case 1:
if(TNR == true)
{
System.out.println("\n\n\t\"I will exploit your biggest weaknesses!\"");
for(int i = 2; i<newPSTATS.length; i++) //find lowest player stat
{
if(lPS>newPSTATS[i])
lPS = newPSTATS[i];
}
for(int i = 3; i<eSTATS.length; i++) //find highest enemy stat
{
if(mES<eSTATS[i])
mES = eSTATS[i];
}
newPSTATS[0] -= ((mES - lPS) * 5);
System.out.println("\n\tEvil Boi used the power of his strongest stat against your weakest stat and blasted you\n\twith a powerful beam!"
+ " You took " + ((mES - lPS) * 5) + " damage!");
}
else if(TNR == false)
{
System.out.println("\n\t\"Fear my lazer beams!\"\n\tEvil Boi shoots a massive lazer toward you!\n\tDo you: "
+ "1. shield from the attack 2. attempt dodging it");
while(true)
{
choice = scan.nextLine();
if(choice.equals("1"))
{
dmg = (rand.nextInt(eSTATS[2] + 30)) - newPSTATS[1] - newPSTATS[3];
newPSTATS[0] -= dmg;
System.out.println("");
break;
}
else if(choice.equals("2"))
{
if(rand.nextInt(newPSTATS[2])>10)
{
System.out.println("\n\tYou managed to dodge his lazer attack!");
}
else
{
dmg = (rand.nextInt(eSTATS[2] + 30));
newPSTATS[0] -= dmg;
System.out.println("\n\n\tYou failed to dodge the lazer beam! You took " + dmg + " damage!");
}
break;
}
else
{
System.out.println("\n\tPlease type either 1 or 2");
}
}
}
break;
case 2:
if(TNR == true)
{
System.out.println("\n\n\t\"Hey bud, pick a number between 1 and 10\"");
choice = scan.nextLine();
dmg = rand.nextInt(eSTATS[2] * 2);
newPSTATS[0] -= dmg;
System.out.println("\n\n\t\"LooL I didn't even have a number in mind. Die\"\n\n\tEvil Boi's eyes glow red, then he snaps his fingers."
+ "\n\tA massive line of explosions blast right into you!\n\n\tYou took " + dmg + " damage!");
}
else if(TNR == false)
{
System.out.println("\n\n\t\"Bet your armor isn't as cool as mine\"\n\tEvil Boi proceeds to show off his crocs. As you were mesmerized by the crocs, "
+ "\n\tHe shoots a lazer beam at you!");
dodge = rand.nextInt(2);
if(dodge == 0)
{
System.out.println("\n\n\tYou managed to dodge the attack!");
}
else if(dodge == 1)
{
dmg = eSTATS[2];
newPSTATS[0] -= dmg;
System.out.println("\n\n\tYou didn't see the attack coming! You took " + dmg + " damage!");
}
}
break;
}
return newPSTATS;
}
}