-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLoot.java
348 lines (315 loc) · 10.6 KB
/
Loot.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
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
import java.util.ArrayList;
import java.util.Random;
//Loot class - stores lists of loot and returns random loot to the player
public class Loot{
private ArrayList<Item> epicItems; //stores epic items
private ArrayList<Item> advancedItems; //stored advanced items
private ArrayList<Item> basicItems; //store basic items
private Random rand; //random number generator
//constructor
public Loot(){
//set up lists
epicItems = new ArrayList<Item>();
advancedItems = new ArrayList<Item>();
basicItems = new ArrayList<Item>();
rand = new Random();
//LEVEL 1 - 5
//Weapons
//basic
addBranch();
addDagger();
//advanced
addLongSword();
//addIronSword();
//epic
addClayMore();
addFlamingSword();
//Armor
//basic
addLeatherArmor();
//advanced
addIronArmor();
//epic
//addSteal();
//Misc
//basic
//advanced
//epic
/* //Level 5 - 10
//Weapons
//basic
addSabre();
addFalchion();
//advanced
addSmallMace();
addLargeMace();
//epic
addWarHammer();
//Armor
//basic
addGoldFlex();
//advanced
addChainMail();
//epic
addKevlar();
//Misc
//basic
//advanced
//epic
//Level 10 - 15
//Weapons
//basic
addDualDagger();
//advanced
addShortSword();
addDualShortSword();
//epic
addDualLongSword();
//Armor
//basic
addDendraPanoply();
//advanced
addDragonSkin();
//epic
addScaleArmor();
//Misc
//basic
//advanced
//epic
*/
}
public Item getItem(int uniqueID){
for(Item i: basicItems){
if(i.uniqueID == uniqueID){
return i;
}
}
for(Item i: advancedItems){
if(i.uniqueID == uniqueID){
return i;
}
}
for(Item i: epicItems){
if(i.uniqueID == uniqueID){
return i;
}
}
return getItem(uniqueID);
}
public Item getEpic(Player p){
boolean validLoot = false;
int i = 0;
while(!validLoot){
i = rand.nextInt(epicItems.size());
if(epicItems.get(i).findLevel <= p.level){
validLoot = true;
}
}
return epicItems.get(i);
}
public Item getAdvanced(Player p){
boolean validLoot = false;
int i = 0;
while(!validLoot){
i = rand.nextInt(advancedItems.size());
if(advancedItems.get(i).findLevel <= p.level){
validLoot = true;
}
}
return advancedItems.get(i);
}
public Item getBasic(Player p){
boolean validLoot = false;
int i = 0;
while(!validLoot){
i = rand.nextInt(basicItems.size());
if(basicItems.get(i).findLevel <= p.level){
validLoot = true;
}
}
return basicItems.get(i);
}
//LEVEL 1 - 5
//****Weapons****
//---basic---
public void addBranch(){
String name = "Branch "; // ends in 8... helps inventory
String desc = "An old decaying branch";
int uniqueID = 1;
int price = 4;
boolean useable = false;
//equiping stats
String type = "Weapon ";
int level = 1;
int findLevel = 1;
int hands = 1;
//life status
int health = 0;
int stamina = 0;
//attack stats
int attack = 1;
int strength = 1;
int defense = 0;
int protection = 0;
//speed stats
int speed = 0;
Item tempItem = new Item(name, desc, uniqueID, price, type, level, findLevel, hands, health, stamina, attack, strength, defense, protection, speed);
basicItems.add(tempItem);
}//end Branch
public void addDagger(){
String name = "Dagger "; // ends in 8... helps inventory
String desc = "A rusty dagger that is reasonably sharp and might be more useful than your fist";
int uniqueID = 2;
int price = 10;
boolean useable = false;
//equiping stats
String type = "Weapon ";
int level = 1;
int findLevel = 2;
int hands = 1;
//life status
int health = 0;
int stamina = 0;
//attack stats
int attack = 2;
int strength = 2;
int defense = 0;
int protection = 0;
//speed stats
int speed = 0;
Item tempItem = new Item(name, desc, uniqueID, price, type, level, findLevel, hands, health, stamina, attack, strength, defense, protection, speed);
basicItems.add(tempItem);
}//end Dagger
//---advanced---
public void addLongSword(){
String name = "Long Sword ";
String desc = "A finely polished steel longsword. It gleans in the tourchlight and is razor sharp.";
int uniqueID = 101;
int price = 100;
boolean useable = true;
//equiping stats
String type = "Weapon ";
int level = 1;
int findLevel = 2;
int hands = 1;
//life status
int health = 0;
int stamina = 0;
//attack stats
int attack = 3;
int strength = 10;
int defense = 2;
int protection = 0;
//speed stats
int speed = 0;
Item tempItem = new Item(name, desc, uniqueID, price, type, level, findLevel, hands, health, stamina, attack, strength, defense, protection, speed);
advancedItems.add(tempItem);
}//end long sword
//---epic---
public void addClayMore(){
String name = "Clay More "; // ends in 8... helps inventory
String desc = "A brite SHINY new sword";
int uniqueID = 201;
int price = 600;
boolean useable = false;
//equiping stats
String type = "Weapon "; //ends in 8... helps inventory
int level = 1;// what level the item is..
int findLevel = 4;// what level you can find it on
int hands = 1;
//life status
int health = 0;
int stamina = 1;
//attack stats
int attack = 3;
int strength = 10;
int defense = 3;
int protection = 0;
//speed stats
int speed = 0;
Item tempItem = new Item(name, desc, uniqueID, price, type, level, findLevel, hands, health, stamina, attack, strength, defense, protection, speed);
epicItems.add(tempItem);
}//end ClayMore
public void addFlamingSword(){
String name = "Flaming Sword ";
String desc = "You pick up this sword and it bursts to flames like a furnace. Inside your head, you hear a voice syaing, " +
"Hello, my name is BURNINAOR. Would you like to toast some enemies?";
int uniqueID = 202;
int price = 800;
boolean useable = true;
//equiping stats
String type = "Weapon ";
int level = 1;
int findLevel = 5;
int hands = 1;
//life status
int health = 0;
int stamina = 2;
//attack stats
int attack = 5;
int strength = 20;
int defense = 5;
int protection = 0;
//speed stats
int speed = 0;
Item tempItem = new Item(name, desc, uniqueID, price, type, level, findLevel, hands, health, stamina, attack, strength, defense, protection, speed);
epicItems.add(tempItem);
}//end flaming sword
//****Armor****
//---basic---
public void addLeatherArmor(){
String name = "Leather Armor "; // ends in 8... helps inventory
String desc = "A dirty leather shirt with iron rivets sewn into. It will stop a blade better than your skin.";
int uniqueID = 51;
int price = 20;
boolean useable = false;
//equiping stats
String type = "body ";
int level = 1;
int findLevel = 1;
int hands = 0;
//life status
int health = 0;
int stamina = 0;
//attack stats
int attack = 0;
int strength = 0;
int defense = 1;
int protection = 2;
//speed stats
int speed = 0;
Item tempItem = new Item(name, desc, uniqueID, price, type, level, findLevel, hands, health, stamina, attack, strength, defense, protection, speed);
basicItems.add(tempItem);
}//end leather armor
//---advanced---
public void addIronArmor(){
String name = "Iron Armor "; // ends in 8... helps inventory
String desc = "An old rusty iron chestplate that is still intact slightly.";
int uniqueID = 52;
int price = 30;
boolean useable = false;
//equiping stats
String type = "Armor ";
int level = 1;
int findLevel = 3;
int hands = 0;
//life status
int health = 0;
int stamina = 0;
//attack stats
int attack = 0;
int strength = 0;
int defense = 4;
int protection = 8;
//speed stats
int speed = 0;
Item tempItem = new Item(name, desc, uniqueID, price, type, level, findLevel, hands, health, stamina, attack, strength, defense, protection, speed);
basicItems.add(tempItem);
}//end Iron Armor
//---epic---
//addSteal();
//****Misc****
//---basic---
//---advanced---
//---epic---
}