From c4231271f968681cc1a01e689a824541f001296a Mon Sep 17 00:00:00 2001 From: Dan Date: Wed, 13 Nov 2024 13:54:04 +0000 Subject: [PATCH] - Finish of the mark calculation - Fix up Milcerys evolution line as its mental --- ui/workers/calculate_origin_mark_worker.py | 64 +++++++++++++++++++++ ui/workers/gather_evolutions_worker.py | 15 ++++- utility/data.py | 66 ++++++++++++++++++++++ 3 files changed, 144 insertions(+), 1 deletion(-) diff --git a/ui/workers/calculate_origin_mark_worker.py b/ui/workers/calculate_origin_mark_worker.py index 68b1011..e2d70d1 100644 --- a/ui/workers/calculate_origin_mark_worker.py +++ b/ui/workers/calculate_origin_mark_worker.py @@ -86,6 +86,70 @@ class CalculateOriginMarkWorker(QRunnable): if mark_id != None: self.marks[pfic] = mark_id continue + + #Rule 3b + # Check to see if this is a sub-form pokemon, and if so, use the mark of the base form. + random_encounters = db.get_encounters(pfic, "random") + static_encounters = db.get_encounters(pfic, "static") + encounters = [] + encounters.extend(random_encounters) + encounters.extend(static_encounters) + count = 0 + if encounters: + for encounter in encounters: + game_info = db.get_game_by_id(encounter["game_id"]) + if game_info["generation"] == target_generation: + count += 1 + if count == 0: + + shiftable_forms = get_shiftable_forms(pfic) + if len(shiftable_forms) > 0: + form_found = False + for shiftable_form in shiftable_forms: + mark_id = self.determine_origin_mark(shiftable_form["to_pfic"], target_generation) + if mark_id != None: + self.marks[pfic] = mark_id + form_found = True + break + if form_found: + continue + + #Rule 4 + # If there are no encounters for the pokemon form or its evolution line from this generation, + # use the mark of the earliest game of the generation is marked as being introducted in. + if encounters: + earliest_game = 100 + for encounter in encounters: + game_info = db.get_game_by_id(encounter["game_id"]) + if game_info["id"] <= earliest_game: + earliest_game = game_info["id"] + if earliest_game < 100: + form_info = db.get_pokemon_details(pfic) + mark_id = game_info["mark"] + if mark_id == None: + print(f"No mark found for {get_display_name(form_info)}") + pass + else: + print(f"Mark for {get_display_name(form_info)} is {mark_id}") + self.marks[pfic] = mark_id + continue + + event_encounters = db.get_encounters(pfic, "event") + if event_encounters: + earliest_game = 100 + for encounter in event_encounters: + game_info = game_info = db.get_game_by_id(encounter["game_id"]) + if game_info["id"] <= earliest_game: + earliest_game = game_info["id"] + if earliest_game < 100: + form_info = db.get_pokemon_details(pfic) + mark_id = game_info["mark"] + if mark_id == None: + print(f"No mark found for {get_display_name(form_info)}") + else: + print(f"Mark for {get_display_name(form_info)} is {mark_id}") + self.marks[pfic] = mark_id + continue; pass def determine_origin_mark(self, pfic, target_generation): diff --git a/ui/workers/gather_evolutions_worker.py b/ui/workers/gather_evolutions_worker.py index f51ec19..0f1da14 100644 --- a/ui/workers/gather_evolutions_worker.py +++ b/ui/workers/gather_evolutions_worker.py @@ -9,7 +9,7 @@ from db import db import re from utility.functions import get_form_name, get_display_name, parse_pfic -from utility.data import non_evolution_forms +from utility.data import non_evolution_forms, alcremie_forms class GatherEvolutionsWorkerSignals(QObject): finished = pyqtSignal(dict) @@ -94,6 +94,19 @@ class GatherEvolutions(QRunnable): else: evolution_tree = self.parse_evolution_chain(evolution_table, pokemon_form) + if evolution_tree["pokemon"] == "Milcery": + evolution_tree["evolves_to"] = [] + for alcremie_form in alcremie_forms: + node = { + "pokemon": "Alcremie", + "form": alcremie_form, + "requirement": None, + "method": "Complicated", + "evolves_to": [], + "stage": 1 + } + evolution_tree["evolves_to"].append(node) + cacheable_container = {} if evolution_tree: self.traverse_and_store(evolution_tree, cacheable_container, gender) diff --git a/utility/data.py b/utility/data.py index df4a40c..52b4c1c 100644 --- a/utility/data.py +++ b/utility/data.py @@ -416,4 +416,70 @@ shiftable_forms = [ {"from_pfic":"0720-06-002-0", "to_pfic":"0720-06-001-0"}, {"from_pfic":"0905-08-002-0", "to_pfic":"0905-08-001-0"}, {"from_pfic":"0492-04-002-0", "to_pfic":"0492-04-001-0"} +] + +alcremie_forms = [ + "Caramel Swirl Berry Sweet", + "Caramel Swirl Clover Sweet", + "Caramel Swirl Flower Sweet", + "Caramel Swirl Love Sweet", + "Caramel Swirl Ribbon Sweet", + "Caramel Swirl Star Sweet", + "Caramel Swirl Strawberry Sweet", + "Vannila Cream Berry Sweet", + "Vannila Cream Clover Sweet", + "Vannila Cream Flower Sweet", + "Vannila Cream Love Sweet", + "Vannila Cream Ribbon Sweet", + "Vannila Cream Star Sweet", + "Vannila Cream Strawberry Sweet", + "Lemon Cream Berry Sweet", + "Lemon Cream Clover Sweet", + "Lemon Cream Flower Sweet", + "Lemon Cream Love Sweet", + "Lemon Cream Ribbon Sweet", + "Lemon Cream Star Sweet", + "Lemon Cream Strawberry Sweet", + "Matcha Cream Berry Sweet", + "Matcha Cream Clover Sweet", + "Matcha Cream Flower Sweet", + "Matcha Cream Love Sweet", + "Matcha Cream Ribbon Sweet", + "Matcha Cream Star Sweet", + "Matcha Cream Strawberry Sweet", + "Mint Cream Berry Sweet", + "Mint Cream Clover Sweet", + "Mint Cream Flower Sweet", + "Mint Cream Love Sweet", + "Mint Cream Ribbon Sweet", + "Mint Cream Star Sweet", + "Mint Cream Strawberry Sweet", + "Rainbow Swirl Berry Sweet", + "Rainbow Swirl Clover Sweet", + "Rainbow Swirl Flower Sweet", + "Rainbow Swirl Love Sweet", + "Rainbow Swirl Ribbon Sweet", + "Rainbow Swirl Star Sweet", + "Rainbow Swirl Strawberry Sweet", + "Ruby Cream Berry Sweet", + "Ruby Cream Clover Sweet", + "Ruby Cream Flower Sweet", + "Ruby Cream Love Sweet", + "Ruby Cream Ribbon Sweet", + "Ruby Cream Star Sweet", + "Ruby Cream Strawberry Sweet", + "Ruby Swirl Berry Sweet", + "Ruby Swirl Clover Sweet", + "Ruby Swirl Flower Sweet", + "Ruby Swirl Love Sweet", + "Ruby Swirl Ribbon Sweet", + "Ruby Swirl Star Sweet", + "Ruby Swirl Strawberry Sweet", + "Salted Cream Berry Sweet", + "Salted Cream Clover Sweet", + "Salted Cream Flower Sweet", + "Salted Cream Love Sweet", + "Salted Cream Ribbon Sweet", + "Salted Cream Star Sweet", + "Salted Cream Strawberry Sweet", ] \ No newline at end of file