+ pokemon_id = Column(Integer, ForeignKey('pokemon.id'), primary_key=True, nullable=False, autoincrement=False,
+ info=dict(description=u"ID of the pokémon"))
+ version_id = Column(Integer, ForeignKey('versions.id'), primary_key=True, nullable=False, autoincrement=False,
+ info=dict(description=u"ID of the version that has this flavor text"))
+ flavor_text = Column(Unicode(255), nullable=False,
+ info=dict(description=u"ID of the version that has this flavor text", official=True, format='gametext'))
+
+class PokemonForm(TableBase):
+ u"""An individual form of a Pokémon.
+
+ Pokémon that do not have separate forms are still given a single row to
+ represent their single form.
+ """
+ __tablename__ = 'pokemon_forms'
+ __singlename__ = 'pokemon_form'
+ id = Column(Integer, primary_key=True, nullable=False,
+ info=dict(description=u'A unique ID for this form.'))
+ name = Column(Unicode(16), nullable=True,
+ info=dict(description=u"This form's name, e.g. \"Plant\" for Plant Cloak Burmy.", official=True, format='plaintext'))
+ form_base_pokemon_id = Column(Integer, ForeignKey('pokemon.id'), nullable=False, autoincrement=False,
+ info=dict(description=u'The ID of the base Pokémon for this form.'))
+ unique_pokemon_id = Column(Integer, ForeignKey('pokemon.id'), autoincrement=False,
+ info=dict(description=u'The ID of a Pokémon that represents specifically this form, for Pokémon with functionally-different forms like Wormadam.'))
+ introduced_in_version_group_id = Column(Integer, ForeignKey('version_groups.id'), autoincrement=False,
+ info=dict(description=u'The ID of the version group in which this form first appeared.'))
+ is_default = Column(Boolean, nullable=False,
+ info=dict(description=u'Set for exactly one form used as the default for each species.'))
+ order = Column(Integer, nullable=False, autoincrement=False,
+ info=dict(description=u'The order in which forms should be sorted. Multiple forms may have equal order, in which case they should fall back on sorting by name.'))
+
+ @property
+ def full_name(self):
+ u"""Returns the full name of this form, e.g. "Plant Cloak"."""
+
+ if not self.name:
+ return None
+ elif self.form_group and self.form_group.term:
+ return '{0} {1}'.format(self.name, self.form_group.term)
+ else:
+ return self.name
+
+ @property
+ def pokemon_name(self):
+ u"""Returns the name of this Pokémon with this form, e.g. "Plant
+ Burmy".
+ """
+
+ if self.name:
+ return '{0} {1}'.format(self.name, self.form_base_pokemon.name)
+ else:
+ return self.form_base_pokemon.name
+
+class PokemonFormGroup(TableBase):
+ u"""Information about a Pokémon's forms as a group."""
+ __tablename__ = 'pokemon_form_groups'
+ pokemon_id = Column(Integer, ForeignKey('pokemon.id'), primary_key=True, nullable=False, autoincrement=False,
+ info=dict(description=u"ID of the base form Pokémon"))
+ term = Column(Unicode(16), nullable=True,
+ info=dict(description=u"The term for this Pokémon's forms, e.g. \"Cloak\" for Burmy or \"Forme\" for Deoxys.", official=True, format='plaintext'))
+ is_battle_only = Column(Boolean, nullable=False,
+ info=dict(description=u"Set iff the forms only change in battle"))
+ description = Column(markdown.MarkdownColumn(1024), nullable=False,
+ info=dict(description=u"English description of how the forms work", format='markdown'))
+
+class PokemonFormPokeathlonStat(TableBase):
+ u"""A Pokémon form's performance in one Pokéathlon stat."""
+ __tablename__ = 'pokemon_form_pokeathlon_stats'
+ pokemon_form_id = Column(Integer, ForeignKey('pokemon_forms.id'), primary_key=True, nullable=False, autoincrement=False,
+ info=dict(description=u'The ID of the Pokémon form.'))
+ pokeathlon_stat_id = Column(Integer, ForeignKey('pokeathlon_stats.id'), primary_key=True, nullable=False, autoincrement=False,
+ info=dict(description=u'The ID of the Pokéathlon stat.'))
+ minimum_stat = Column(Integer, nullable=False, autoincrement=False,
+ info=dict(description=u'The minimum value for this stat for this Pokémon form.'))
+ base_stat = Column(Integer, nullable=False, autoincrement=False,
+ info=dict(description=u'The default value for this stat for this Pokémon form.'))
+ maximum_stat = Column(Integer, nullable=False, autoincrement=False,
+ info=dict(description=u'The maximum value for this stat for this Pokémon form.'))
+
+class PokemonHabitat(TableBase):
+ u"""The habitat of a pokémon, as given in the FireRed/LeafGreen version pokédex
+ """
+ __tablename__ = 'pokemon_habitats'
+ id = Column(Integer, primary_key=True, nullable=False, autoincrement=False,
+ info=dict(description=u"A numeric ID"))
+ name = Column(Unicode(16), nullable=False,
+ info=dict(description=u"The English name of the habitat", official=True, format='plaintext'))
+
+class PokemonInternalID(TableBase):
+ u"""The number of a pokémon a game uses internally
+ """
+ __tablename__ = 'pokemon_internal_ids'
+ pokemon_id = Column(Integer, ForeignKey('pokemon.id'), primary_key=True, autoincrement=False, nullable=False,
+ info=dict(description=u"Database ID of the pokémon"))
+ generation_id = Column(Integer, ForeignKey('generations.id'), primary_key=True, autoincrement=False, nullable=False,
+ info=dict(description=u"Database ID of the generation"))
+ internal_id = Column(Integer, nullable=False,
+ info=dict(description=u"Internal ID the generation's games use for the pokémon"))
+
+class PokemonItem(TableBase):
+ u"""Record of an item a pokémon can hold in the wild
+ """
+ __tablename__ = 'pokemon_items'
+ pokemon_id = Column(Integer, ForeignKey('pokemon.id'), primary_key=True, nullable=False, autoincrement=False,
+ info=dict(description=u"ID of the pokémon"))
+ version_id = Column(Integer, ForeignKey('versions.id'), primary_key=True, nullable=False, autoincrement=False,
+ info=dict(description=u"ID of the version this applies to"))
+ item_id = Column(Integer, ForeignKey('items.id'), primary_key=True, nullable=False, autoincrement=False,
+ info=dict(description=u"ID of the item"))
+ rarity = Column(Integer, nullable=False,
+ info=dict(description=u"Chance of the pokémon holding the item, in percent"))
+
+class PokemonMove(TableBase):
+ u"""Record of a move a pokémon can learn
+ """
+ __tablename__ = 'pokemon_moves'
+ pokemon_id = Column(Integer, ForeignKey('pokemon.id'), nullable=False, index=True,
+ info=dict(description=u"ID of the pokémon"))
+ version_group_id = Column(Integer, ForeignKey('version_groups.id'), nullable=False, index=True,
+ info=dict(description=u"ID of the version group this applies to"))
+ move_id = Column(Integer, ForeignKey('moves.id'), nullable=False, index=True,
+ info=dict(description=u"ID of the move"))
+ pokemon_move_method_id = Column(Integer, ForeignKey('pokemon_move_methods.id'), nullable=False, index=True,
+ info=dict(description=u"ID of the method this move is learned by"))
+ level = Column(Integer, nullable=True, index=True,
+ info=dict(description=u"Level the move is learned at, if applicable"))
+ order = Column(Integer, nullable=True,
+ info=dict(description=u"A sort key to produce the correct ordering when all else is equal")) # XXX: This needs a better description
+
+ __table_args__ = (
+ PrimaryKeyConstraint('pokemon_id', 'version_group_id', 'move_id', 'pokemon_move_method_id', 'level'),
+ {},
+ )
+
+class PokemonMoveMethod(TableBase):
+ u"""A method a move can be learned by, such as "Level up" or "Tutor".
+ """
+ __tablename__ = 'pokemon_move_methods'
+ id = Column(Integer, primary_key=True, nullable=False, autoincrement=False,
+ info=dict(description=u"A numeric ID"))
+ name = Column(Unicode(64), nullable=False,
+ info=dict(description=u"An English name of the method", format='plaintext'))
+ description = Column(Unicode(255), nullable=False,
+ info=dict(description=u"A detailed description of how the method works", format='plaintext'))