@ -40,7 +40,9 @@ all_games = [
" Brilliant Diamond " , " Shining Pearl " ,
" Legends: Arceus " ,
" Scarlet " , " Violet " , " The Teal Mask " , " The Hidden Treasure of Area Zero " , " The Hidden Treasure of Area Zero (Scarlet) " , " The Hidden Treasure of Area Zero (Violet) " , " The Teal Mask (Scarlet) " , " The Teal Mask (Violet) " ,
" Unknown "
" Unknown " ,
" Pokémon Home " ,
" Pokémon Go " ,
]
big_pokemon_list = [ ]
@ -163,14 +165,18 @@ class Pokemon:
self . stage = stage
self . is_baby = self . stage is not None and ' Baby ' in self . stage
def update_encounter_information ( self , exclude_events = True ) :
def update_encounter_information ( self , exclude_events = True , exclude_home = True , exclude_go = True ) :
if not self . encounter_information :
return
non_catchable_methods = [ " trade " , " global link " , " poké transfer " , " time capsule " , " unobtainable " , " pokémon home " ]
non_catchable_methods = [ " trade " , " global link " , " poké transfer " , " time capsule " , " unobtainable " ]
if exclude_events :
non_catchable_methods . append ( " event " )
if exclude_home :
non_catchable_methods . append ( " pokemon home " )
if exclude_go :
non_catchable_methods . append ( " pokémon go " )
for encounter in self . encounter_information :
encounter . method = None
@ -195,13 +201,7 @@ class Pokemon:
else :
encounter . method = " Catchable "
def determine_earliest_game ( self ) :
if not self . encounter_information :
self . earliest_game = None
return
self . update_encounter_information ( )
def parse_encoutners_for_games ( self ) :
game_methods = { }
for encounter in self . encounter_information :
if encounter . method :
@ -212,16 +212,30 @@ class Pokemon:
self . earliest_game = game_methods [ game . lower ( ) ]
return
def determine_earliest_game ( self ) :
if not self . encounter_information :
self . earliest_game = None
return
self . update_encounter_information ( )
self . parse_encoutners_for_games ( )
if self . earliest_game != None :
return
self . update_encounter_information ( exclude_events = False )
self . parse_encoutners_for_games ( )
if self . earliest_game != None :
return
game_methods = { }
for encounter in self . encounter_information :
if encounter . method :
game_methods [ encounter . game . lower ( ) ] = encounter
self . update_encounter_information ( exclude_home = False )
self . parse_encoutners_for_games ( )
if self . earliest_game != None :
return
for game in all_games :
if game . lower ( ) in game_methods :
self . earliest_game = game_methods [ game . lower ( ) ]
self . update_encounter_information ( exclude_go = False )
self . parse_encoutners_for_games ( )
if self . earliest_game != None :
return
self . earliest_game = None
@ -908,7 +922,9 @@ def determine_earliest_games(pokemon_list, cache):
handle_unown ( pokemon , encounter_data )
handle_form_shift ( pokemon , encounter_data )
if pokemon . name == " Gimmighoul " and pokemon . form == " Roaming Form " :
continue
encounter_information = EncounterInformation ( " Pokémon Go " , [ " Pokémon Go " ] )
pokemon . encounter_information . append ( encounter_information )
pokemon . determine_earliest_game ( )
print ( f " Processed { pokemon } : { pokemon . earliest_game . game } ( { pokemon . earliest_game . method } ) " )
@ -1034,14 +1050,14 @@ def save_to_csv(pokemon_list, filename='pokemon_earliest_games.csv'):
for pokemon in big_pokemon_list :
encounter_locations = [ ]
for encounter in pokemon . encounter_information :
if encounter . game == pokemon . earliest_game and encounter . method == pokemon . obtain_method :
encounter_locations . app end( encounter . locations )
if encounter . game == pokemon . earliest_game . game :
encounter_locations . ext end( encounter . locations )
writer . writerow ( {
' number ' : pokemon . number ,
' name ' : pokemon . name ,
' earliest_game ' : pokemon . earliest_game ,
' obtain_method ' : pokemon . obtain_ method,
' encounter_locations ' : ' | ' . join ( str ( item ) for item in encounter_locations )
' name ' : f " { pokemon . name } ( { pokemon . form } ) " ,
' earliest_game ' : pokemon . earliest_game . game ,
' obtain_method ' : pokemon . earliest_game . method ,
' encounter_locations ' : ' | ' . join ( ( str ( item ) for item in encounter_locations ) )
} )
def parse_encounter_locations ( encounter_data , game ) :
@ -1151,7 +1167,7 @@ def check_alternative_sources(pokemon, cache):
def handle_unknown_encounters ( pokemon_list , cache ) :
for pokemon in big_pokemon_list :
if pokemon . earliest_game == None or pokemon . obtain_ method == None :
if pokemon . earliest_game == None or pokemon . earliest_game . method == None :
print ( f " Checking alternative sources for { pokemon . name } " )
return