-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGothamLikeAdventureTown.java
More file actions
205 lines (171 loc) · 8.8 KB
/
GothamLikeAdventureTown.java
File metadata and controls
205 lines (171 loc) · 8.8 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
import java.util.*;
public class GothamLikeAdventureTown
{
public GothamLikeAdventureTown()
{
String[] firstName = {"Liam", "Noah", "Logan", "Mason", "David", "Rahul", "James", "Joe", "Anirudh", "Neel"};
String[] lastName = {"Datle", "Gongrara", "Samsung", "Hegt", "Russ", "Patel", "Madison", "Kistle", "Mandu", "Telidevara"};
String[] bonus = {" has won the battle !!!", "The simulation would choose a random damage value from 1 to 20 (the upper bound is equal to the maxDamage amount for ", " ). Those random values will be compared and used to decide whether ", "''s hitPoints total needs to be reduced or not."};
int badguy = 0;
int goodguy = 0;
while (badguy == goodguy){
badguy = (int)(Math.random()*50)+1;
goodguy = (int)(Math.random()*50)+1;
}
ArrayList<Person> dailyPlanetStreet = new ArrayList<Person>();
for(int x = 0; x < 50; x++)
{
String fullName = "";
int first = (int)(Math.random()*10)+0;
int last = (int)(Math.random()*10)+0;
//System.out.println(first);
fullName += firstName[first];
fullName += " ";
fullName += lastName[last];
dailyPlanetStreet.add(new NormalGuy(fullName, "Works at BankOfAmerica", 100, 200, 5));
}
GoodGuy goodHero = new GoodGuy("John Wells", "BANKER", 100, 20, 20, "invisible", true, 5000, "InvisiMan", "Got'em");
dailyPlanetStreet.set(goodguy, goodHero);
// dailyPlanetStreet.set(11, goodHero);
BadGuy badHero = new BadGuy("Harrison Fatic", "DOCTOR", 100, 15, 14, "Glue", false, 5500, "Gluistic", "You gonna get Stuck", "Stickyyyy");
dailyPlanetStreet.set(badguy, badHero);
/*System.out.println("A-->"+dailyPlanetStreet.size());
System.out.println("goodguy-->"+goodguy);
System.out.println("badguy-->"+badguy);
*/
//----Start of Simulation----//
ArrayList<Person> safetyLand = new ArrayList<Person>();
int c;
ArrayList<Person> unfortunatelyFatallyWoundedPeople = new ArrayList<Person>();
while(dailyPlanetStreet.size() > 2 ){
/*System.out.println("GOODHERO -->"+dailyPlanetStreet.indexOf(goodHero));
System.out.println("BADHERO -->"+dailyPlanetStreet.indexOf(badHero));
System.out.println("dailyPlanetStress-->"+dailyPlanetStreet.size());
System.out.println("Clean List-->"+unfortunatelyFatallyWoundedPeople.size());*/
if ((dailyPlanetStreet.indexOf(badHero) == 0)&&(dailyPlanetStreet.indexOf(goodHero)==1))
{
//System.out.println("IF 1");
unfortunatelyFatallyWoundedPeople.add(dailyPlanetStreet.remove(dailyPlanetStreet.indexOf(goodHero) + 1));
//c = (int)(Math.random()*(dailyPlanetStreet.size()))+1;
//safetyLand.add(dailyPlanetStreet.remove(dailyPlanetStreet.indexOf(c)));
print(badHero,goodHero);
}
else if ((dailyPlanetStreet.indexOf(badHero) == 1)&&(dailyPlanetStreet.indexOf(goodHero)==0))
{
//System.out.println("IF 2");
unfortunatelyFatallyWoundedPeople.add(dailyPlanetStreet.remove(dailyPlanetStreet.indexOf(badHero) + 1));
//c = (int)(Math.random()*(dailyPlanetStreet.size()))+1;
//safetyLand.add(dailyPlanetStreet.remove(dailyPlanetStreet.indexOf(c)));
print(badHero,goodHero);
}
else if ((dailyPlanetStreet.indexOf(badHero) == 0)&&(dailyPlanetStreet.indexOf(goodHero)!=1))
{
//System.out.println("IF 3");
unfortunatelyFatallyWoundedPeople.add(dailyPlanetStreet.remove(dailyPlanetStreet.indexOf(badHero) + 1));
//c = (int)(Math.random()*(dailyPlanetStreet.size()))+1;
//safetyLand.add(dailyPlanetStreet.remove(dailyPlanetStreet.indexOf(c)));
print(badHero,goodHero);
//System.out.println(badHero.getevilLaugh());
//System.out.println(goodHero.getCatchPhrase());
}
else if ((dailyPlanetStreet.indexOf(badHero) == (dailyPlanetStreet.size()-1))&&(dailyPlanetStreet.indexOf(goodHero)!= (dailyPlanetStreet.size()-2)))
{
//System.out.println("IF 4");
unfortunatelyFatallyWoundedPeople.add(dailyPlanetStreet.remove(dailyPlanetStreet.indexOf(badHero) - 1));
//c = (int)(Math.random()*(dailyPlanetStreet.size()))+1;
//safetyLand.add(dailyPlanetStreet.remove(dailyPlanetStreet.indexOf(c)));
print(badHero,goodHero);
//System.out.println(badHero.getevilLaugh());
//System.out.println(goodHero.getCatchPhrase());
}
else if ((dailyPlanetStreet.indexOf(badHero) == (dailyPlanetStreet.size()-1))&&(dailyPlanetStreet.indexOf(goodHero)==(dailyPlanetStreet.size()-2)))
{
//System.out.println("IF 4a");
unfortunatelyFatallyWoundedPeople.add(dailyPlanetStreet.remove(dailyPlanetStreet.indexOf(goodHero)-1));
//c = (int)(Math.random()*(dailyPlanetStreet.size()))+1;
//safetyLand.add(dailyPlanetStreet.remove(dailyPlanetStreet.indexOf(c)));
print(badHero,goodHero);
//System.out.println(badHero.getevilLaugh());
//System.out.println(goodHero.getCatchPhrase());
}
//GoodHero is not next to BadHero
else if ((dailyPlanetStreet.indexOf(goodHero)!= dailyPlanetStreet.indexOf(badHero)+1)&&(dailyPlanetStreet.indexOf(goodHero)!= dailyPlanetStreet.indexOf(badHero)-1)&&(dailyPlanetStreet.indexOf(badHero)!= 0)&&(dailyPlanetStreet.indexOf(badHero)!= 49))
{
//System.out.println("IF 5");
int num = (int)(Math.random()*2)+1;
if (num == 1){
//System.out.println("IF 6");
unfortunatelyFatallyWoundedPeople.add(dailyPlanetStreet.remove(dailyPlanetStreet.indexOf(badHero) - 1));
//c = (int)(Math.random()*(dailyPlanetStreet.size()))+1;
//safetyLand.add(dailyPlanetStreet.remove(dailyPlanetStreet.indexOf(c)));
print(badHero,goodHero);
}
else{
//System.out.println("IF 7");
unfortunatelyFatallyWoundedPeople.add(dailyPlanetStreet.remove(dailyPlanetStreet.indexOf(badHero) + 1));
//c = (int)(Math.random()*(dailyPlanetStreet.size()))+1;
//safetyLand.add(dailyPlanetStreet.remove(dailyPlanetStreet.indexOf(c)));
print(badHero,goodHero);
}
}
else if ((dailyPlanetStreet.indexOf(goodHero)- dailyPlanetStreet.indexOf(badHero)) == 1){
unfortunatelyFatallyWoundedPeople.add(dailyPlanetStreet.remove(dailyPlanetStreet.indexOf(badHero) - 1));
//c = (int)(Math.random()*(dailyPlanetStreet.size()))+1;
//safetyLand.add(dailyPlanetStreet.remove(dailyPlanetStreet.indexOf(c)));
//System.out.println("IF 8");
print(badHero,goodHero);
}
else if (((dailyPlanetStreet.indexOf(goodHero)- dailyPlanetStreet.indexOf(badHero)) == -1)){
//System.out.println("IF 9");
unfortunatelyFatallyWoundedPeople.add(dailyPlanetStreet.remove(dailyPlanetStreet.indexOf(badHero) + 1));
//c = (int)(Math.random()*(dailyPlanetStreet.size()))+1;
//safetyLand.add(dailyPlanetStreet.remove(dailyPlanetStreet.indexOf(c)));
print(badHero,goodHero);
}
}
//}
System.out.println(dailyPlanetStreet);
while((badHero.getHitPoint() > 0) && (goodHero.getHitPoint() > 0))
{
int oneortwo = (int)(Math.random()*2)+1;
int maxDamageBadguy = (int)(Math.random()*15)+1;
int defenseAbilityGoodguy = (int)(Math.random()*20)+1;
int maxDamageGoodguy = (int)(Math.random()*20)+1;
int defenseAbilityBadguy = (int)(Math.random()*14)+1;
if (oneortwo == 1){//goodguy goes first
if(maxDamageGoodguy > defenseAbilityBadguy)
{
int tempBadHitPoint = badHero.getHitPoint()- maxDamageGoodguy;
badHero.setHitPoint(tempBadHitPoint);
}
}
else if (oneortwo == 2){
if(maxDamageBadguy > defenseAbilityGoodguy)
{
int tempGoodHitPoint = goodHero.getHitPoint() - maxDamageBadguy;
goodHero.setHitPoint(tempGoodHitPoint);
}
}
}
System.out.println();
System.out.println(goodHero.getName() + " is fighting " + badHero.getName());
System.out.println(goodHero.getName() + bonus[0] + goodHero.getMaxDamage() + " and " + badHero.getName() + " has a maxDamage of " + badHero.getMaxDamage());
System.out.println("The simulation would choose a random damage value from 1 to 20 (the upper bound is equal to the maxDamage amount for "
+ goodHero.getMaxDamage() + " ) and a random defense value from 1 to 8 (the upper bound is equal to the defenseAbility of "
+ badHero.getMaxDamage() + " ). Those random values will be compared and used to decide whether " + badHero.getName() + "''s hitPoints total needs to be reduced or not.");
if (goodHero.getHitPoint() > badHero.getHitPoint())
System.out.println("\n" + goodHero.getName()+ bonus[0]);
else
System.out.println("\n" + badHero.getName()+ bonus[0]);
}
public void print(BadGuy badHero, GoodGuy goodHero){
System.out.println(badHero.getevilLaugh());
System.out.println(goodHero.getCatchPhrase());
}
public static void main(String args[])
{
//This is the main execution section that calls the constructor
//and starts the application
GothamLikeAdventureTown app=new GothamLikeAdventureTown ();
}
}