+ id = Column(Integer, primary_key=True, nullable=False,
+ info=dict(description="A numeric ID"))
+ identifier = Column(Unicode(24), nullable=False,
+ info=dict(description="An identifier", format='identifier'))
+ generation_id = Column(Integer, ForeignKey('generations.id'), nullable=False,
+ info=dict(description="ID of the generation this move first appeared in"))
+ type_id = Column(Integer, ForeignKey('types.id'), nullable=False,
+ info=dict(description="ID of the move's elemental type"))
+ power = Column(SmallInteger, nullable=False,
+ info=dict(description="Base power of the move"))
+ pp = Column(SmallInteger, nullable=True,
+ info=dict(description="Base PP (Power Points) of the move, nullable if not applicable (e.g. Struggle and Shadow moves)."))
+ accuracy = Column(SmallInteger, nullable=True,
+ info=dict(description="Accuracy of the move; NULL means it never misses"))
+ priority = Column(SmallInteger, nullable=False,
+ info=dict(description="The move's priority bracket"))
+ target_id = Column(Integer, ForeignKey('move_targets.id'), nullable=False,
+ info=dict(description="ID of the target (range) of the move"))
+ damage_class_id = Column(Integer, ForeignKey('move_damage_classes.id'), nullable=False,
+ info=dict(description="ID of the damage class (physical/special) of the move"))
+ effect_id = Column(Integer, ForeignKey('move_effects.id'), nullable=False,
+ info=dict(description="ID of the move's effect"))
+ effect_chance = Column(Integer, nullable=True,
+ info=dict(description="The chance for a secondary effect. What this is a chance of is specified by the move's effect."))
+ contest_type_id = Column(Integer, ForeignKey('contest_types.id'), nullable=True,
+ info=dict(description="ID of the move's Contest type (e.g. cool or smart)"))
+ contest_effect_id = Column(Integer, ForeignKey('contest_effects.id'), nullable=True,
+ info=dict(description="ID of the move's Contest effect"))
+ super_contest_effect_id = Column(Integer, ForeignKey('super_contest_effects.id'), nullable=True,
+ info=dict(description="ID of the move's Super Contest effect"))
+
+create_translation_table('move_names', Move, 'names',
+ relation_lazy='joined',
+ name = Column(Unicode(24), nullable=False, index=True,
+ info=dict(description="The name", format='plaintext', official=True))
+)
+
+
+class MoveChangelog(TableBase):
+ """History of changes to moves across main game versions."""
+ __tablename__ = 'move_changelog'
+ __singlename__ = 'move_changelog'
+ move_id = Column(Integer, ForeignKey('moves.id'), primary_key=True, nullable=False,
+ info=dict(description="ID of the move that changed"))
+ changed_in_version_group_id = Column(Integer, ForeignKey('version_groups.id'), primary_key=True, nullable=False,
+ info=dict(description="ID of the version group in which the move changed"))
+ type_id = Column(Integer, ForeignKey('types.id'), nullable=True,
+ info=dict(description="Prior type of the move, or NULL if unchanged"))
+ power = Column(SmallInteger, nullable=True,
+ info=dict(description="Prior base power of the move, or NULL if unchanged"))
+ pp = Column(SmallInteger, nullable=True,
+ info=dict(description="Prior base PP of the move, or NULL if unchanged"))
+ accuracy = Column(SmallInteger, nullable=True,
+ info=dict(description="Prior accuracy of the move, or NULL if unchanged"))
+ effect_id = Column(Integer, ForeignKey('move_effects.id'), nullable=True,
+ info=dict(description="Prior ID of the effect, or NULL if unchanged"))
+ effect_chance = Column(Integer, nullable=True,
+ info=dict(description="Prior effect chance, or NULL if unchanged"))
+
+class Nature(TableBase):
+ u"""A nature a Pokémon can have, such as Calm or Brave
+ """
+ __tablename__ = 'natures'
+ __singlename__ = 'nature'
+ id = Column(Integer, primary_key=True, nullable=False,
+ info=dict(description="A numeric ID"))
+ identifier = Column(Unicode(8), nullable=False,
+ info=dict(description="An identifier", format='identifier'))
+ decreased_stat_id = Column(Integer, ForeignKey('stats.id'), nullable=False,
+ info=dict(description="ID of the stat that this nature decreases by 10% (if decreased_stat_id is the same, the effects cancel out)"))
+ increased_stat_id = Column(Integer, ForeignKey('stats.id'), nullable=False,
+ info=dict(description="ID of the stat that this nature increases by 10% (if decreased_stat_id is the same, the effects cancel out)"))
+ hates_flavor_id = Column(Integer, ForeignKey('contest_types.id'), nullable=False,
+ info=dict(description=u"ID of the Berry flavor the Pokémon hates (if likes_flavor_id is the same, the effects cancel out)"))
+ likes_flavor_id = Column(Integer, ForeignKey('contest_types.id'), nullable=False,
+ info=dict(description=u"ID of the Berry flavor the Pokémon likes (if hates_flavor_id is the same, the effects cancel out)"))
+
+ @property
+ def is_neutral(self):
+ u"""Returns True iff this nature doesn't alter a Pokémon's stats,
+ bestow taste preferences, etc.
+ """
+ return self.increased_stat_id == self.decreased_stat_id
+
+create_translation_table('nature_names', Nature, 'names',
+ relation_lazy='joined',
+ name = Column(Unicode(8), nullable=False, index=True,
+ info=dict(description="The name", format='plaintext', official=True)),
+)
+
+class NatureBattleStylePreference(TableBase):
+ u"""Battle Palace move preference
+
+ Specifies how likely a Pokémon with a specific Nature is to use a move of
+ a particular battl style in Battle Palace or Battle Tent
+ """
+ __tablename__ = 'nature_battle_style_preferences'
+ nature_id = Column(Integer, ForeignKey('natures.id'), primary_key=True, nullable=False,
+ info=dict(description=u"ID of the Pokémon's nature"))
+ move_battle_style_id = Column(Integer, ForeignKey('move_battle_styles.id'), primary_key=True, nullable=False,
+ info=dict(description="ID of the battle style"))
+ low_hp_preference = Column(Integer, nullable=False,
+ info=dict(description=u"Chance of using the move, in percent, if HP is under ½"))
+ high_hp_preference = Column(Integer, nullable=False,
+ info=dict(description=u"Chance of using the move, in percent, if HP is over ½"))
+
+class NaturePokeathlonStat(TableBase):
+ u"""Specifies how a Nature affects a Pokéathlon stat
+ """
+ __tablename__ = 'nature_pokeathlon_stats'
+ nature_id = Column(Integer, ForeignKey('natures.id'), primary_key=True, nullable=False,
+ info=dict(description="ID of the nature"))
+ pokeathlon_stat_id = Column(Integer, ForeignKey('pokeathlon_stats.id'), primary_key=True, nullable=False,
+ info=dict(description="ID of the stat"))
+ max_change = Column(Integer, nullable=False,
+ info=dict(description="Maximum change"))
+
+class PokeathlonStat(TableBase):
+ u"""A Pokéathlon stat, such as "Stamina" or "Jump".
+ """
+ __tablename__ = 'pokeathlon_stats'
+ __singlename__ = 'pokeathlon_stat'
+ id = Column(Integer, primary_key=True, nullable=False,
+ info=dict(description="A numeric ID"))
+ identifier = Column(Unicode(8), nullable=False,
+ info=dict(description="An identifier", format='identifier'))
+
+create_translation_table('pokeathlon_stat_names', PokeathlonStat, 'names',
+ name = Column(Unicode(8), nullable=False, index=True,
+ info=dict(description="The name", format='plaintext', official=True)),
+)