Add Dream World abilities. #380

This commit is contained in:
Eevee 2010-11-25 00:09:06 -08:00
parent 247b830e42
commit ade7d9aa19
2 changed files with 1655 additions and 1048 deletions

File diff suppressed because it is too large Load diff

View file

@ -897,6 +897,11 @@ class PokemonAbility(TableBase):
info=dict(description=u"ID of the pokémon")) info=dict(description=u"ID of the pokémon"))
ability_id = Column(Integer, ForeignKey('abilities.id'), nullable=False, ability_id = Column(Integer, ForeignKey('abilities.id'), nullable=False,
info=dict(description=u"ID of the ability")) info=dict(description=u"ID of the ability"))
# XXX having both a method and a slot is kind of gross. "slot" is a
# misnomer, anyway: duplicate abilities don't appear in slot 2.
# Probably should replace that with "order".
is_dream = Column(Boolean, nullable=False, index=True,
info=dict(description=u"Whether this is a Dream World ability"))
slot = Column(Integer, primary_key=True, nullable=False, autoincrement=False, slot = Column(Integer, primary_key=True, nullable=False, autoincrement=False,
info=dict(description=u"The ability slot, i.e. 1 or 2 for gen. IV")) info=dict(description=u"The ability slot, i.e. 1 or 2 for gen. IV"))
@ -1221,6 +1226,9 @@ class Version(TableBase):
Ability.flavor_text = relation(AbilityFlavorText, order_by=AbilityFlavorText.version_group_id, backref='ability') Ability.flavor_text = relation(AbilityFlavorText, order_by=AbilityFlavorText.version_group_id, backref='ability')
Ability.foreign_names = relation(AbilityName, backref='ability') Ability.foreign_names = relation(AbilityName, backref='ability')
Ability.generation = relation(Generation, backref='abilities') Ability.generation = relation(Generation, backref='abilities')
Ability.pokemon = relation(Pokemon,
secondary=PokemonAbility.__table__,
)
AbilityFlavorText.version_group = relation(VersionGroup) AbilityFlavorText.version_group = relation(VersionGroup)
@ -1354,9 +1362,26 @@ NaturePokeathlonStat.pokeathlon_stat = relation(PokeathlonStat, backref='nature_
Pokedex.region = relation(Region, backref='pokedexes') Pokedex.region = relation(Region, backref='pokedexes')
Pokedex.version_groups = relation(VersionGroup, secondary=PokedexVersionGroup.__table__, backref='pokedexes') Pokedex.version_groups = relation(VersionGroup, secondary=PokedexVersionGroup.__table__, backref='pokedexes')
Pokemon.abilities = relation(Ability, secondary=PokemonAbility.__table__, Pokemon.all_abilities = relation(Ability,
secondary=PokemonAbility.__table__,
order_by=PokemonAbility.slot, order_by=PokemonAbility.slot,
backref='pokemon') )
Pokemon.abilities = relation(Ability,
secondary=PokemonAbility.__table__,
primaryjoin=and_(
Pokemon.id == PokemonAbility.pokemon_id,
PokemonAbility.is_dream == False,
),
order_by=PokemonAbility.slot,
)
Pokemon.dream_ability = relation(Ability,
secondary=PokemonAbility.__table__,
primaryjoin=and_(
Pokemon.id == PokemonAbility.pokemon_id,
PokemonAbility.is_dream == True,
),
uselist=False,
)
Pokemon.formes = relation(Pokemon, primaryjoin=Pokemon.id==Pokemon.forme_base_pokemon_id, Pokemon.formes = relation(Pokemon, primaryjoin=Pokemon.id==Pokemon.forme_base_pokemon_id,
backref=backref('forme_base_pokemon', backref=backref('forme_base_pokemon',
remote_side=[Pokemon.id])) remote_side=[Pokemon.id]))