1
0
Fork 0
mirror of https://github.com/veekun/pokedex.git synced 2024-08-20 18:16:34 +00:00

Added remaining Pokémon form data.

Types, abilities, egg groups, and stats for Shaymin, Giratina, and Rotom forms.
Updated height and weight for Shaymin and Giratina forms.
Added Giratina's form descriptions and updated Shaymin's to mention link
battles and freezing.
This commit is contained in:
Eevee 2009-06-20 22:32:37 -07:00
parent f9391b409a
commit 4397dfbb0c
7 changed files with 105 additions and 12 deletions
pokedex/db

View file

@ -180,6 +180,14 @@ class Move(TableBase):
super_contest_effect_id = Column(Integer, nullable=False)
class Pokemon(TableBase):
"""The core to this whole mess.
Note that I use both 'forme' and 'form' in both code and the database. I
only use 'forme' when specifically referring to Pokémon that have multiple
distinct species as formsi.e., different stats or movesets. 'Form' is a
more general term referring to any variation within a species, including
purely cosmetic forms like Unown.
"""
__tablename__ = 'pokemon'
id = Column(Integer, primary_key=True, nullable=False)
name = Column(Unicode(20), nullable=False)
@ -225,6 +233,17 @@ class Pokemon(TableBase):
return "%s %s" % (self.forme_name.capitalize(), self.name)
return self.name
@property
def normal_form(self):
"""Returns the normal form for this Pokémon; i.e., this will return
regular Deoxys when called on any Deoxys form.
"""
if self.forme_base_pokemon:
return self.forme_base_pokemon
return self
class PokemonAbility(TableBase):
__tablename__ = 'pokemon_abilities'
pokemon_id = Column(Integer, ForeignKey('pokemon.id'), primary_key=True, nullable=False, autoincrement=False)
@ -332,6 +351,9 @@ LocationArea.location = relation(Location, backref='areas')
Pokemon.abilities = relation(Ability, secondary=PokemonAbility.__table__,
order_by=PokemonAbility.slot,
backref='pokemon')
Pokemon.formes = relation(Pokemon, primaryjoin=Pokemon.id==Pokemon.forme_base_pokemon_id,
backref=backref('forme_base_pokemon',
remote_side=[Pokemon.id]))
Pokemon.dex_numbers = relation(PokemonDexNumber, backref='pokemon')
Pokemon.egg_groups = relation(EggGroup, secondary=PokemonEggGroup.__table__,
order_by=PokemonEggGroup.egg_group_id,