-
Notifications
You must be signed in to change notification settings - Fork 0
/
loot.py
345 lines (305 loc) · 8.75 KB
/
loot.py
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
from item import Item
import random
#Loot class - stores lists of loot and returns random loot to the player
class Loot():
# constructor
def __init__(self):
# set up lists
self.epicItems = []
# stores epic items
self.advancedItems = []
# stored advanced items
self.basicItems = []
# store basic items
#private Random rand
# random number generator
# LEVEL 1 - 5
# Weapons
# basic
self.addBranch()
self.addDagger()
# advanced
self.addLongSword()
# self.addIronSword()
# epic
self.addClaymore()
self.addFlamingSword()
# Armor
# basic
self.addLeatherArmor()
# advanced
self.addIronArmor()
# epic
# self.addSteal()
# Misc
# basic
# advanced
# epic
""" # Level 5 - 10
# Weapons
# basic
self.addSabre()
self.addFalchion()
# advanced
self.addSmallMace()
self.addLargeMace()
# epic
self.addWarHammer()
# Armor
# basic
self.addGoldFlex()
# advanced
self.addChainMail()
# epic
self.addKevlar()
# Misc
# basic
# advanced
# epic
# Level 10 - 15
# Weapons
# basic
self.addDualDagger()
# advanced
self.addShortSword()
self.addDualShortSword()
# epic
self.addDualLongSword()
# Armor
# basic
self.addDendraPanoply()
# advanced
self.addDragonSkin()
# epic
self.addScaleArmor()
# Misc
# basic
# advanced
# epic
"""
def getItem(self, uniqueID):
for i in self.basicItems:
if(i.uniqueID == uniqueID):
return i
for i in self.advancedItems:
if(i.uniqueID == uniqueID):
return i
for i in self.epicItems:
if(i.uniqueID == uniqueID):
return i
return getItem(uniqueID)
def getEpic(self, hero):
valid_loot = False
i = 0
while(not valid_loot):
i = random.randint(len(self.epicItems))
if(self.epicItems[i].findLevel <= hero.level):
valid_loot = True
return self.epicItems.get(i)
def getAdvanced(self, hero):
valid_loot = False
i = 0
while(not valid_loot):
i = random.randint(len(self.advancedItems))
if(self.advancedItems[i].findLevel <= hero.level):
valid_loot = True
return self.advancedItems.get(i)
def getBasic(self, hero):
valid_loot = False
i = 0
while(not valid_loot):
i = random.randint(len(self.basicItems))
if(self.basicItems[i].findLevel <= hero.level):
valid_loot = True
return self.basicItems.get(i)
# LEVEL 1 - 5
# ****Weapons****
# ---basic---
def addBranch(self):
name = "Branch "
# ends in 8... helps inventory
desc = "An old decaying branch"
uniqueID = 1
price = 4
useable = False
# equiping stats
_type = "Weapon "
level = 1
findLevel = 1
hands = 1
# life status
health = 0
stamina = 0
# attack stats
attack = 1
strength = 1
defense = 0
protection = 0
# speed stats
speed = 0
tempItem = Item(name, desc, uniqueID, price, useable, _type, level, findLevel, hands, health, stamina, attack, strength, defense, protection, speed)
self.basicItems.append(tempItem)
#end Branch
def addDagger(self):
name = "Dagger "
# ends in 8... helps inventory
desc = "A rusty dagger that is reasonably sharp and might be more useful than your fist"
uniqueID = 2
price = 10
useable = False
# equiping stats
_type = "Weapon "
level = 1
findLevel = 2
hands = 1
# life status
health = 0
stamina = 0
# attack stats
attack = 2
strength = 2
defense = 0
protection = 0
# speed stats
speed = 0
tempItem = Item(name, desc, uniqueID, price, useable, _type, level, findLevel, hands, health, stamina, attack, strength, defense, protection, speed)
self.basicItems.append(tempItem)
#end Dagger
# ---advanced---
def addLongSword(self):
name = "Long Sword "
desc = "A finely polished steel longsword. It gleans in the torchlight and is razor sharp."
uniqueID = 101
price = 100
useable = True
# equiping stats
_type = "Weapon "
level = 1
findLevel = 2
hands = 1
# life status
health = 0
stamina = 0
# attack stats
attack = 3
strength = 10
defense = 2
protection = 0
# speed stats
speed = 0
tempItem = Item(name, desc, uniqueID, price, useable, _type, level, findLevel, hands, health, stamina, attack, strength, defense, protection, speed)
self.advancedItems.append(tempItem)
#end long sword
# ---epic---
def addClaymore(self):
name = "Claymore "
# ends in 8... helps inventory
desc = "A bright SHINY new sword"
uniqueID = 201
price = 600
useable = False
# equiping stats
_type = "Weapon "
# ends in 8... helps inventory
level = 1
# what level the item is..
findLevel = 4
# what level you can find it on
hands = 1
# life status
health = 0
stamina = 1
# attack stats
attack = 3
strength = 10
defense = 3
protection = 0
# speed stats
speed = 0
tempItem = Item(name, desc, uniqueID, price, useable, _type, level, findLevel, hands, health, stamina, attack, strength, defense, protection, speed)
self.epicItems.append(tempItem)
#end ClayMore
def addFlamingSword(self):
name = "Flaming Sword "
desc = """You pick up this sword and it bursts to flames like a furnace. Inside your head, you hear a voice saying,
Hello, my name is BURNINAOR. Would you like to toast some enemies?"""
uniqueID = 202
price = 800
useable = True
# equiping stats
_type = "Weapon "
level = 1
findLevel = 5
hands = 1
# life status
health = 0
stamina = 2
# attack stats
attack = 5
strength = 20
defense = 5
protection = 0
# speed stats
speed = 0
tempItem = Item(name, desc, uniqueID, price, useable, _type, level, findLevel, hands, health, stamina, attack, strength, defense, protection, speed)
self.epicItems.append(tempItem)
#end flaming sword
# ****Armor****
# ---basic---
def addLeatherArmor(self):
name = "Leather Armor "
# ends in 8... helps inventory
desc = "A dirty leather shirt with iron rivets sewn into. It will stop a blade better than your skin."
uniqueID = 51
price = 20
useable = False
# equiping stats
_type = "body "
level = 1
findLevel = 1
hands = 0
# life status
health = 0
stamina = 0
# attack stats
attack = 0
strength = 0
defense = 1
protection = 2
# speed stats
speed = 0
tempItem = Item(name, desc, uniqueID, price, useable, _type, level, findLevel, hands, health, stamina, attack, strength, defense, protection, speed)
self.basicItems.append(tempItem)
# end leather armor
# ---advanced---
def addIronArmor(self):
name = "Iron Armor "
# ends in 8... helps inventory
desc = "An old rusty iron chestplate that is still intact slightly."
uniqueID = 52
price = 30
useable = False
# equiping stats
_type = "Armor "
level = 1
findLevel = 3
hands = 0
# life status
health = 0
stamina = 0
# attack stats
attack = 0
strength = 0
defense = 4
protection = 8
# speed stats
speed = 0
tempItem = Item(name, desc, uniqueID, price, useable, _type, level, findLevel, hands, health, stamina, attack, strength, defense, protection, speed)
self.basicItems.append(tempItem)
#end Iron Armor
# ---epic---
# addSteal()
# ****Misc****
# ---basic---
# ---advanced---
# ---epic---