diff --git a/pokedex/data/csv/conquest_pokemon_evolution.csv b/pokedex/data/csv/conquest_pokemon_evolution.csv index a140797..09d8fef 100644 --- a/pokedex/data/csv/conquest_pokemon_evolution.csv +++ b/pokedex/data/csv/conquest_pokemon_evolution.csv @@ -1,4 +1,4 @@ -evolved_species_id,required_stat_id,minimum_stat,minimum_link,kingdom_id,warrior_gender,item_id,recruiting_ko_required +evolved_species_id,required_stat_id,minimum_stat,minimum_link,kingdom_id,warrior_gender_id,item_id,recruiting_ko_required 5,2,50,,,,,0 6,2,83,,,,,0 24,2,59,,,,,0 @@ -68,9 +68,9 @@ evolved_species_id,required_stat_id,minimum_stat,minimum_link,kingdom_id,warrior 464,,,,,,298,1 470,3,94,,5,,,0 471,2,91,,6,,,0 -475,,,,,male,109,0 +475,,,,,2,109,0 477,,,,,,302,1 -478,,,,,female,109,0 +478,,,,,1,109,0 496,6,54,,,,,0 497,6,104,,,,,0 499,2,41,,,,,0 diff --git a/pokedex/data/csv/genders.csv b/pokedex/data/csv/genders.csv new file mode 100644 index 0000000..c2d17be --- /dev/null +++ b/pokedex/data/csv/genders.csv @@ -0,0 +1,4 @@ +id,identifier +1,female +2,male +3,genderless diff --git a/pokedex/data/csv/pokemon_evolution.csv b/pokedex/data/csv/pokemon_evolution.csv index c9b1b64..2c7bfe1 100644 --- a/pokedex/data/csv/pokemon_evolution.csv +++ b/pokedex/data/csv/pokemon_evolution.csv @@ -1,4 +1,4 @@ -id,evolved_species_id,evolution_trigger_id,trigger_item_id,minimum_level,gender,location_id,held_item_id,time_of_day,known_move_id,minimum_happiness,minimum_beauty,relative_physical_stats,party_species_id,trade_species_id +id,evolved_species_id,evolution_trigger_id,trigger_item_id,minimum_level,gender_id,location_id,held_item_id,time_of_day,known_move_id,minimum_happiness,minimum_beauty,relative_physical_stats,party_species_id,trade_species_id 1,2,1,,16,,,,,,,,,, 2,3,1,,32,,,,,,,,,, 3,5,1,,16,,,,,,,,,, @@ -205,9 +205,9 @@ id,evolved_species_id,evolution_trigger_id,trigger_item_id,minimum_level,gender, 204,407,3,107,,,,,,,,,,, 205,409,1,,30,,,,,,,,,, 206,411,1,,30,,,,,,,,,, -207,413,1,,20,female,,,,,,,,, -208,414,1,,20,male,,,,,,,,, -209,416,1,,21,female,,,,,,,,, +207,413,1,,20,1,,,,,,,,, +208,414,1,,20,2,,,,,,,,, +209,416,1,,21,1,,,,,,,,, 210,419,1,,26,,,,,,,,,, 211,421,1,,25,,,,,,,,,, 212,423,1,,30,,,,,,,,,, @@ -241,10 +241,10 @@ id,evolved_species_id,evolution_trigger_id,trigger_item_id,minimum_level,gender, 240,472,1,,,,,304,night,,,,,, 241,473,1,,,,,,,246,,,,, 242,474,2,,,,,301,,,,,,, -243,475,3,109,,male,,,,,,,,, +243,475,3,109,,2,,,,,,,,, 244,476,1,,,,10,,,,,,,, 245,477,2,,,,,302,,,,,,, -246,478,3,109,,female,,,,,,,,, +246,478,3,109,,1,,,,,,,,, 247,496,1,,17,,,,,,,,,, 248,497,1,,36,,,,,,,,,, 249,499,1,,17,,,,,,,,,, diff --git a/pokedex/db/tables.py b/pokedex/db/tables.py index 4f4579f..2d6f859 100644 --- a/pokedex/db/tables.py +++ b/pokedex/db/tables.py @@ -252,8 +252,8 @@ class ConquestPokemonEvolution(TableBase): info=dict(description=u"The minimum link percentage the Pokémon must have with its warrior.")) kingdom_id = Column(Integer, ForeignKey('conquest_kingdoms.id'), nullable=True, info=dict(description=u"The ID of the kingdom in which this Pokémon must complete an action after meeting all other requirements.")) - warrior_gender = Column(Enum('male', 'female', name='conquest_warrior_gender'), nullable=True, - info=dict(description=u"The required gender for the Pokémon's warrior.")) + warrior_gender_id = Column(Integer, ForeignKey('genders.id'), nullable=True, + info=dict(description=u"The ID of the gender the Pokémon's warrior must be.")) item_id = Column(Integer, ForeignKey('items.id'), nullable=True, info=dict(description=u"The ID of the item the Pokémon's warrior must have equipped.")) recruiting_ko_required = Column(Boolean, nullable=False, server_default='False', @@ -480,6 +480,16 @@ class Experience(TableBase): experience = Column(Integer, nullable=False, info=dict(description="The number of EXP points needed to get to that level")) +class Gender(TableBase): + u"""A gender. + """ + __tablename__ = 'genders' + __singlename__ = 'gender' + id = Column(Integer, primary_key=True, nullable=False, autoincrement=True, + info=dict(description='An ID for this gender.')) + identifier = Column(Unicode(10), nullable=False, + info=dict(description='A readable identifier for this gender.')) + class Generation(TableBase): u"""A Generation of the Pokémon franchise """ @@ -1268,8 +1278,8 @@ class PokemonEvolution(TableBase): info=dict(description=u"The ID of the item that must be used on the Pokémon.")) minimum_level = Column(Integer, nullable=True, info=dict(description=u"The minimum level for the Pokémon.")) - gender = Column(Enum('male', 'female', name='pokemon_evolution_gender'), nullable=True, - info=dict(description=u"The Pokémon's required gender, or None if gender doesn't matter")) + gender_id = Column(Integer, ForeignKey('genders.id'), nullable=True, + info=dict(description=u"The ID of the Pokémon's required gender, or None if gender doesn't matter")) location_id = Column(Integer, ForeignKey('locations.id'), nullable=True, info=dict(description=u"The ID of the location the evolution must be triggered at.")) held_item_id = Column(Integer, ForeignKey('items.id'), nullable=True, @@ -2070,6 +2080,8 @@ PokemonEvolution.party_species = relationship(PokemonSpecies, backref='triggered_evolutions') PokemonEvolution.trade_species = relationship(PokemonSpecies, primaryjoin=PokemonEvolution.trade_species_id==PokemonSpecies.id) +PokemonEvolution.gender = relationship(Gender, + backref='required_for_evolutions') PokemonForm.pokemon = relationship(Pokemon, primaryjoin=PokemonForm.pokemon_id==Pokemon.id,