|
|
|
@ -79,6 +79,19 @@ class Pokemon: |
|
|
|
self.is_baby = False |
|
|
|
self.encounter_information: Optional[List['EncounterInformation']] = [] |
|
|
|
self.earliest_game: Optional['EncounterInformation'] = None |
|
|
|
self.obtain_method: Optional[str] = None |
|
|
|
|
|
|
|
def get_earliest_game_and_method(self): |
|
|
|
if self.evolution_chain: |
|
|
|
for stage in self.evolution_chain: |
|
|
|
if self.is_baby: |
|
|
|
return stage.pokemon.earliest_game.game, "Breed" |
|
|
|
else: |
|
|
|
return stage.pokemon.earliest_game.game, "Evolve" |
|
|
|
|
|
|
|
if self.earliest_game: |
|
|
|
return self.earliest_game.game, self.earliest_game.method |
|
|
|
return None, None |
|
|
|
|
|
|
|
def __str__(self): |
|
|
|
return f"{self.name} {self.form if self.form else ''} (#{self.number})" |
|
|
|
@ -649,15 +662,15 @@ def determine_earliest_games(pokemon_list, cache): |
|
|
|
pokemon.determine_earliest_game() |
|
|
|
print(f"Processed {pokemon}: {pokemon.earliest_game.game} ({pokemon.earliest_game.method})") |
|
|
|
|
|
|
|
for pokemon in pokemon_list: |
|
|
|
print(f"Processing {pokemon['name']} (#{pokemon['number']})") |
|
|
|
encounter_data = get_locations_from_bulbapedia(pokemon['base_name'], pokemon['form'], cache) |
|
|
|
pokemon['earliest_game'], pokemon['obtain_method'] = get_earliest_game(encounter_data, pokemon['base_name'], pokemon['form']) |
|
|
|
print(f"Processed {pokemon['name']} (#{pokemon['number']}): {pokemon['earliest_game']} ({pokemon['obtain_method']})") |
|
|
|
#pokemon_data = get_pokemon_data(pokemon['base_name'], pokemon['form'], cache) |
|
|
|
#encounter_data = get_pokemon_encounter_data(pokemon['base_name'], pokemon['form'], cache) |
|
|
|
#pokemon['earliest_game'], pokemon['obtain_method'] = get_earliest_game(encounter_data) |
|
|
|
#print(f"Processed {pokemon['name']} (#{pokemon['number']}): {pokemon['earliest_game']} ({pokemon['obtain_method']})") |
|
|
|
#for pokemon in pokemon_list: |
|
|
|
# print(f"Processing {pokemon['name']} (#{pokemon['number']})") |
|
|
|
# encounter_data = get_locations_from_bulbapedia(pokemon['base_name'], pokemon['form'], cache) |
|
|
|
# pokemon['earliest_game'], pokemon['obtain_method'] = get_earliest_game(encounter_data, pokemon['base_name'], pokemon['form']) |
|
|
|
# print(f"Processed {pokemon['name']} (#{pokemon['number']}): {pokemon['earliest_game']} ({pokemon['obtain_method']})") |
|
|
|
# #pokemon_data = get_pokemon_data(pokemon['base_name'], pokemon['form'], cache) |
|
|
|
# #encounter_data = get_pokemon_encounter_data(pokemon['base_name'], pokemon['form'], cache) |
|
|
|
# #pokemon['earliest_game'], pokemon['obtain_method'] = get_earliest_game(encounter_data) |
|
|
|
# #print(f"Processed {pokemon['name']} (#{pokemon['number']}): {pokemon['earliest_game']} ({pokemon['obtain_method']})") |
|
|
|
return pokemon_list |
|
|
|
|
|
|
|
def get_species_data(pokemon_name, cache): |
|
|
|
@ -689,6 +702,7 @@ def get_evolution_chain(pokemon_name, cache): |
|
|
|
if evolution_response.status_code == 200: |
|
|
|
evolution_data = evolution_response.json() |
|
|
|
update_cache(cache_key, evolution_data) |
|
|
|
|
|
|
|
return evolution_data |
|
|
|
return None |
|
|
|
|
|
|
|
@ -720,6 +734,12 @@ def get_base_form(evolution_chain:List[EvolutionStage]): |
|
|
|
return None |
|
|
|
|
|
|
|
def adjust_for_evolution(pokemon_list, cache): |
|
|
|
for pokemon in big_pokemon_list: |
|
|
|
evolution_chain = get_evolution_data_from_bulbapedia(pokemon.name, pokemon.form, cache) |
|
|
|
pokemon.add_evolution_data(evolution_chain) |
|
|
|
game, method = pokemon.get_earliest_game_and_method() |
|
|
|
print(f"Adjusted {pokemon.name} (#{pokemon.number}): {game} ({method})") |
|
|
|
|
|
|
|
pokemon_dict = {f"{pokemon['base_name']}_{pokemon['form']}".lower(): pokemon for pokemon in pokemon_list} |
|
|
|
|
|
|
|
for pokemon in pokemon_list: |
|
|
|
|