forked from NJWasTaken/PokemonMelee
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pokedex.py
284 lines (257 loc) · 6.72 KB
/
pokedex.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
import pandas as pd
types = ['Fire', 'Water', 'Grass', 'Electric', 'Flying', 'Psychic', 'Fighting', 'Rock', 'Poison', 'Bug', 'Ground', 'Ice', 'Normal', 'Dragon', 'Ghost']
#parent class
class poketype:
def __init__(self, name, strength, weakness, null):
reg = list(filter(lambda x:x not in strength+weakness+null,types))
self.name = name
#These values are with respect to damage done to the opponent
self.strength = strength #2x damage
self.weakness = weakness #1/2x damage
self.null = null #0 damage
def regular(self):
reg = list(filter(lambda x:x not in self.strength+self.weakness+self.null,types))
self.reg = reg #1x damage
return self.reg
#child classes
class Normal(poketype):
name = 'Normal'
strength = []
weakness = ['Rock']
null = ['Ghost']
class Fire(poketype):
name = 'Fire'
strength = ['Bug', 'Grass', 'Ice']
weakness = ['Fire', 'Rock', 'Water', 'Dragon']
null = []
class Water(poketype):
name = 'Water'
strength = ['Fire', 'Ground', 'Rock']
weakness = ['Water', 'Grass', 'Dragon']
null = []
class Electric(poketype):
name = 'Electric'
strength = ['Flying', 'Water']
weakness = ['Electric','Grass','Dragon']
null = ['Ground']
class Grass(poketype):
name = 'Grass'
strength = ['Ground', 'Rock', 'Water']
weakness = ['Bug', 'Fire', 'Flying', 'Dragon', 'Poison', 'Grass']
null = []
class Ice(poketype):
name = 'Ice'
strength = ['Dragon', 'Flying', 'Grass', 'Ground']
weakness = ['Water', 'Ice']
null = []
class Fighting(poketype):
name = 'Fighting'
strength = ['Ice', 'Normal', 'Rock']
weakness = ['Poison', 'Flying', 'Psychic', 'Bug']
null = ['Ghost']
class Poison(poketype):
name = 'Poison'
strength = ['Bug', 'Grass']
weakness = ['Poison', 'Ground', 'Rock','Ghost']
null = []
class Ground(poketype):
name = 'Ground'
strength = ['Electric', 'Fire', 'Poison', 'Rock']
weakness = ['Grass', 'Bug']
null = ['Flying']
class Flying(poketype):
name = 'Flying'
strength = ['Bug', 'Fighting', 'Grass']
weakness = ['Electric', 'Rock']
null = []
class Psychic(poketype):
name = 'Psychic'
strength = ['Fighting', 'Poison']
weakness = ['Psychic']
null = []
class Bug(poketype):
name = 'Bug'
strength = ['Grass', 'Poison', 'Psychic']
weakness = ['Fire', 'Fighting','Flying', 'Ghost']
null = []
class Rock(poketype):
name = 'Rock'
strength = ['Bug', 'Fire', 'Flying', 'Ice']
weakness = ['Fighting', 'Ground']
null = []
class Ghost(poketype):
name = 'Ghost'
strength = ['Ghost']
weakness = []
null = ['Normal','Psychic']
class Dragon(poketype):
name = 'Dragon'
strength = ['Dragon']
weakness = []
null = []
bulbasaur=Grass
ivysaur=Grass
venusaur=Grass
charmander=Fire
charmeleon=Fire
charizard=Fire
squirtle=Water
wartortle=Water
blastoise=Water
caterpie=Bug
metapod=Bug
butterfree=Bug
weedle=Bug
kakuna=Bug
beedrill=Bug
pidgey=Normal
pidgeotto=Normal
pidgeot=Normal
rattata=Normal
raticate=Normal
spearow=Normal
fearow=Normal
ekans=Poison
arbok=Poison
pikachu=Electric
raichu=Electric
sandshrew=Ground
sandslash=Ground
nidoran_f=Poison
nidorina=Poison
nidoqueen=Poison
nidoran_m=Poison
nidorino=Poison
nidoking=Poison
clefairy=Normal
clefable=Normal
vulpix=Fire
ninetales=Fire
jigglypuff=Normal
wigglytuff=Normal
zubat=Poison
golbat=Poison
oddish=Grass
gloom=Grass
vileplume=Grass
paras=Bug
parasect=Bug
venonat=Bug
venomoth=Bug
diglett=Ground
dugtrio=Ground
meowth=Normal
persian=Normal
psyduck=Water
golduck=Water
mankey=Fighting
primeape=Fighting
growlithe=Fire
arcanine=Fire
poliwag=Water
poliwhirl=Water
poliwrath=Water
abra=Psychic
kadabra=Psychic
alakazam=Psychic
machop=Fighting
machoke=Fighting
machamp=Fighting
bellsprout=Grass
weepinbell=Grass
victreebel=Grass
tentacool=Water
tentacruel=Water
geodude=Rock
graveler=Rock
golem=Rock
ponyta=Fire
rapidash=Fire
slowpoke=Water
slowbro=Water
magnemite=Electric
magneton=Electric
farfetchd=Normal
doduo=Normal
dodrio=Normal
seel=Water
dewgong=Water
grimer=Poison
muk=Poison
shellder=Water
cloyster=Water
gastly=Ghost
haunter=Ghost
gengar=Ghost
onix=Rock
drowzee=Psychic
hypno=Psychic
krabby=Water
kingler=Water
voltorb=Electric
electrode=Electric
exeggcute=Grass
exeggutor=Grass
cubone=Ground
marowak=Ground
hitmonlee=Fighting
hitmonchan=Fighting
lickitung=Normal
koffing=Poison
weezing=Poison
rhyhorn=Ground
rhydon=Ground
chansey=Normal
tangela=Grass
kangaskhan=Normal
horsea=Water
seadra=Water
goldeen=Water
seaking=Water
staryu=Water
starmie=Water
mr_mime=Psychic
scyther=Bug
jynx=Ice
electabuzz=Electric
magmar=Fire
pinsir=Bug
tauros=Normal
magikarp=Water
gyarados=Water
lapras=Water
ditto=Normal
eevee=Normal
vaporeon=Water
jolteon=Electric
flareon=Fire
porygon=Normal
omanyte=Rock
omastar=Rock
kabuto=Rock
kabutops=Rock
aerodactyl=Rock
snorlax=Normal
articuno=Ice
zapdos=Electric
moltres=Fire
dratini=Dragon
dragonair=Dragon
dragonite=Dragon
mewtwo=Psychic
mew=Psychic
def typelist():
l = [bulbasaur,ivysaur,venusaur,charmander,charmeleon,charizard,squirtle,wartortle,blastoise,caterpie,metapod,butterfree,weedle,kakuna,beedrill,pidgey,pidgeotto,pidgeot,rattata,raticate,spearow,fearow,ekans,arbok,pikachu,raichu,sandshrew,sandslash,nidoran_f,nidorina,nidoqueen,nidoran_m,nidorino,nidoking,clefairy,clefable,vulpix,ninetales,jigglypuff,wigglytuff,zubat,golbat,oddish,gloom,vileplume,paras,parasect,venonat,venomoth,diglett,dugtrio,meowth,persian,psyduck,golduck,mankey,primeape,growlithe,arcanine,poliwag,poliwhirl,poliwrath,abra,kadabra,alakazam,machop,machoke,machamp,bellsprout,weepinbell,victreebel,tentacool,tentacruel,geodude,graveler,golem,ponyta,rapidash,slowpoke,slowbro,magnemite,magneton,farfetchd,doduo,dodrio,seel,dewgong,grimer,muk,shellder,cloyster,gastly,haunter,gengar,onix,drowzee,hypno,krabby,kingler,voltorb,electrode,exeggcute,exeggutor,cubone,marowak,hitmonlee,hitmonchan,lickitung,koffing,weezing,rhyhorn,rhydon,chansey,tangela,kangaskhan,horsea,seadra,goldeen,seaking,staryu,starmie,mr_mime,scyther,jynx,electabuzz,magmar,pinsir,tauros,magikarp,gyarados,lapras,ditto,eevee,vaporeon,jolteon,flareon,porygon,omanyte,omastar,kabuto,kabutops,aerodactyl,snorlax,articuno,zapdos,moltres,dratini,dragonair,dragonite,mewtwo,mew]
return l
df = pd.read_csv('PokemonData.csv')
pokedata = pd.DataFrame(columns=['Name','Type','Attack','HP'])
pokedata['Name']= df['Name']
pokedata['Type']= typelist()
pokedata['Attack']= list(map(lambda x: x//5,df['Attack']))
pokedata['HP']= list(map(lambda x: x*2,df['HP']))
def name():
return pokedata['Name']
def attack():
return pokedata['Attack']
def hp():
return pokedata['HP']