X-Git-Url: http://git.veekun.com/zzz-pokedex.git/blobdiff_plain/639e513039ac1ae4389271f4f7a099233c0e064d..2de5a951d1daf84640e1230eb623509d0c24d554:/pokedex/db/tables.py?ds=sidebyside diff --git a/pokedex/db/tables.py b/pokedex/db/tables.py index 4f5b80d..9e0dc88 100644 --- a/pokedex/db/tables.py +++ b/pokedex/db/tables.py @@ -217,6 +217,7 @@ class ItemFlingEffect(TableBase): class ItemPocket(TableBase): __tablename__ = 'item_pockets' id = Column(Integer, primary_key=True, nullable=False) + identifier = Column(Unicode(16), nullable=False) name = Column(Unicode(16), nullable=False) class Language(TableBase): @@ -253,6 +254,11 @@ class Machine(TableBase): version_group_id = Column(Integer, ForeignKey('version_groups.id'), primary_key=True, nullable=False, autoincrement=False) move_id = Column(Integer, ForeignKey('moves.id'), nullable=False) +class MoveBattleStyle(TableBase): + __tablename__ = 'move_battle_styles' + id = Column(Integer, primary_key=True, nullable=False) + name = Column(Unicode(8), nullable=False) + class MoveEffectCategory(TableBase): __tablename__ = 'move_effect_categories' id = Column(Integer, primary_key=True, nullable=False) @@ -321,7 +327,7 @@ class Move(TableBase): damage_class_id = Column(Integer, ForeignKey('move_damage_classes.id'), nullable=False) effect_id = Column(Integer, ForeignKey('move_effects.id'), nullable=False) effect_chance = Column(Integer) - contest_type = Column(Unicode(8), nullable=False) + contest_type_id = Column(Integer, ForeignKey('contest_types.id'), nullable=True) contest_effect_id = Column(Integer, ForeignKey('contest_effects.id'), nullable=True) super_contest_effect_id = Column(Integer, ForeignKey('super_contest_effects.id'), nullable=False) @@ -332,6 +338,26 @@ class Nature(TableBase): name = Column(Unicode(8), nullable=False) decreased_stat_id = Column(Integer, ForeignKey('stats.id'), nullable=False) increased_stat_id = Column(Integer, ForeignKey('stats.id'), nullable=False) + hates_flavor_id = Column(Integer, ForeignKey('contest_types.id'), nullable=False) + likes_flavor_id = Column(Integer, ForeignKey('contest_types.id'), nullable=False) + +class NatureBattleStylePreference(TableBase): + __tablename__ = 'nature_battle_style_preferences' + nature_id = Column(Integer, ForeignKey('natures.id'), primary_key=True, nullable=False) + move_battle_style_id = Column(Integer, ForeignKey('move_battle_styles.id'), primary_key=True, nullable=False) + low_hp_preference = Column(Integer, nullable=False) + high_hp_preference = Column(Integer, nullable=False) + +class NaturePokeathlonStat(TableBase): + __tablename__ = 'nature_pokeathlon_stats' + nature_id = Column(Integer, ForeignKey('natures.id'), primary_key=True, nullable=False) + pokeathlon_stat_id = Column(Integer, ForeignKey('pokeathlon_stats.id'), primary_key=True, nullable=False) + max_change = Column(Integer, nullable=False) + +class PokeathlonStat(TableBase): + __tablename__ = 'pokeathlon_stats' + id = Column(Integer, primary_key=True, nullable=False) + name = Column(Unicode(8), nullable=False) class Pokedex(TableBase): __tablename__ = 'pokedexes' @@ -614,9 +640,13 @@ Generation.main_region = relation(Region) Item.berry = relation(Berry, uselist=False, backref='item') Item.fling_effect = relation(ItemFlingEffect, backref='items') -Item.category = relation(ItemCategory, backref='items') +Item.category = relation(ItemCategory) +Item.pocket = association_proxy('category', 'pocket') + +ItemCategory.items = relation(Item, order_by=Item.name) +ItemCategory.pocket = relation(ItemPocket) -ItemCategory.pocket = relation(ItemPocket, backref='categories') +ItemPocket.categories = relation(ItemCategory, order_by=ItemCategory.name) Location.region = relation(Region, backref='locations') @@ -627,6 +657,7 @@ Machine.version_group = relation(VersionGroup) Move.contest_effect = relation(ContestEffect, backref='moves') Move.contest_combo_next = association_proxy('contest_combo_first', 'second') Move.contest_combo_prev = association_proxy('contest_combo_second', 'first') +Move.contest_type = relation(ContestType, backref='moves') Move.damage_class = relation(MoveDamageClass, backref='moves') Move.flags = association_proxy('move_flags', 'flag') Move.flavor_text = relation(MoveFlavorText, order_by=MoveFlavorText.generation_id, backref='move') @@ -659,6 +690,18 @@ Nature.decreased_stat = relation(Stat, primaryjoin=Nature.decreased_stat_id==Sta backref='decreasing_natures') Nature.increased_stat = relation(Stat, primaryjoin=Nature.increased_stat_id==Stat.id, backref='increasing_natures') +Nature.hates_flavor = relation(ContestType, primaryjoin=Nature.hates_flavor_id==ContestType.id, + backref='hating_natures') +Nature.likes_flavor = relation(ContestType, primaryjoin=Nature.likes_flavor_id==ContestType.id, + backref='liking_natures') +Nature.battle_style_preferences = relation(NatureBattleStylePreference, + order_by=NatureBattleStylePreference.move_battle_style_id, + backref='nature') +Nature.pokeathlon_effects = relation(NaturePokeathlonStat, order_by=NaturePokeathlonStat.pokeathlon_stat_id) + +NatureBattleStylePreference.battle_style = relation(MoveBattleStyle, backref='nature_preferences') + +NaturePokeathlonStat.pokeathlon_stat = relation(PokeathlonStat, backref='nature_effects') Pokedex.region = relation(Region, backref='pokedexes') Pokedex.version_groups = relation(VersionGroup, secondary=PokedexVersionGroup.__table__, backref='pokedexes')