-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathTeamData.py
45 lines (39 loc) · 1.53 KB
/
TeamData.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
class TeamData:
def __init__(self):
self.team = []
self.money = 100
self.HTCList = []
self.WTCList = []
self.itemList = []
self.shit = dict()
def add(self, character):
self.team.append(character)
def remove(self, character):
self.team.remove(character)
def addShit(self, shit):
if shit.name in self.shit:
self.shit[shit.name].quantity += shit.quantity
else:
self.shit[shit.name] = shit
for x in shit.types:
#print x
if x.strip() == "WTC":
#print "WTC"
self.WTCList.append(shit.name)
if x.strip() == "HTC":
self.HTCList.append(shit.name)
if x.strip() == "ITEM":
self.itemList.append(shit.name)
def removeShit(self, shit):
if shit.name in self.shit:
self.shit[shit.name].quantity -= shit.quantity
if self.shit[shit.name].quantity <= 0:
del self.shit[shit.name]
if self.WTCList.count(shit.name) > 0:
self.WTCList.remove(shit.name)
if self.HTCList.count(shit.name) > 0:
self.HTCList.remove(shit.name)
if self.itemList.count(shit.name) > 0:
self.itemList.remove(shit.name)
else:
return -1 #this should not happen