From 8d61be9c4f50995e6a9e1903dd4caf6bd7421ccb Mon Sep 17 00:00:00 2001 From: Dan Date: Mon, 18 Nov 2024 10:00:57 +0000 Subject: [PATCH] - Put the default forms in for pokemon thayt have them when we are trying to match evolutions lines --- ui/workers/gather_evolutions_worker.py | 14 +++---- utility/data.py | 55 ++++++++++++++++++++++++++ 2 files changed, 61 insertions(+), 8 deletions(-) diff --git a/ui/workers/gather_evolutions_worker.py b/ui/workers/gather_evolutions_worker.py index 1d12f47..454f02d 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, alcremie_forms, vivillon_patterns +from utility.data import non_evolution_forms, alcremie_forms, vivillon_patterns, default_pokemon_forms class GatherEvolutionsWorkerSignals(QObject): finished = pyqtSignal(dict) @@ -412,6 +412,9 @@ class GatherEvolutions(QRunnable): if not results: return None + if form is None and name in default_pokemon_forms: + form = default_pokemon_forms[name] + if gender: gender_filtered_results = [] for entry in results: @@ -444,15 +447,10 @@ class GatherEvolutions(QRunnable): for entry in results: stripped_db_form = self.strip_pokemon_name(entry["name"], entry["form_name"]) stripped_db_form_genderless = self.strip_gender_from_form(stripped_db_form) - #if self.fuzzy_match_form(stripped_form, stripped_db_form, threshold): - # return entry["pfic"] + match_score = self.fuzzy_match_form(stripped_form, stripped_db_form) genderless_score = self.fuzzy_match_form(stripped_form, stripped_db_form_genderless) - - #if self.fuzzy_match_form(stripped_form, stripped_db_form, threshold): - # return entry["pfic"] - if match_score > best_score: best_match = entry["pfic"] best_score = match_score @@ -471,7 +469,7 @@ class GatherEvolutions(QRunnable): def strip_pokemon_name(self, pokemon_name: str, form_name: str) -> str: if form_name: - form_name = form_name.replace("Form", "").strip() + form_name = form_name.replace("Forme", "").replace("Form", "").strip() form_name = re.sub(f'{re.escape(pokemon_name)}\\s*', '', form_name, flags=re.IGNORECASE).strip() form_name = form_name.replace(" ", " ") return form_name diff --git a/utility/data.py b/utility/data.py index 4633c48..056230e 100644 --- a/utility/data.py +++ b/utility/data.py @@ -323,6 +323,61 @@ main_line_games = [ scarlet, violet, ] +default_pokemon_forms = { + "Deoxys":"Normal Forme", + "Zacian ":"Hero of Many Battles", + "Zamazenta ":"Hero of Many Battles", + "Giratina": "Altered Forme", + "Shaymin": "Land Forme", + "Keldeo": "Ordinary Form", + "Meloetta": "Aria Forme", + "Furfrou": "Normal Form", + "Aegislash": "Shield Forme", + "Xerneas": "Neutral Mode", + "Hoopa": "Hoopa Confined", + "Wishiwashi": "Solo Form", + "Silvally": "Type: Normal", + "Minior": "Red Core", + "Mimikyu": "Disguised Form", + "Eiscue": "Ice Face", + "Morpeko": "Full Belly Mode", + "Palafin": "Zero Form", + "Tatsugiri": "Curly Form", + "Koraidon": "Apex Build", + "Miraidon": "Ultimate Mode", + "Ogerpon": "Teal Mask", + "Terapagos": "Normal Form", + "Burmy": "Plant Cloak", + "Wormadam": "Plant Cloak", + "Cherrim": "Overcast Form", + "Shellos": "West Sea", + "Gastrodon": "West Sea", + "Arceus": "Normal", + "Basculin": "Red-Striped Form", + "Deerling": "Spring Form", + "Sawsbuck": "Spring Form", + "Tornadus": "Incarnate Forme", + "Thundurus": "Incarnate Forme", + "Landorus": "Incarnate Forme", + "Enamorus": "Incarnate Forme", + "Flabébé": "Red Flower", + "Floette": "Red Flower", + "Florges": "Red Flower", + "Zygarde": "50% Forme", + "Oricorio": "Baile Style", + "Lycanroc": "Midday Form", + "Toxtricity": "Amped Form", + "Alcremie": "Vanilla Cream Strawberry Sweet", + "Urshifu": "Single Strike Style", + "Squawkabilly": "Green Plumage", + "Dudunsparce": "Two-Segment Form", + "Poltchageist": "Counterfeit Form", + "Sinistcha": "Unremarkable Form", + "Sinistea": "Antique Form", + "Polteageist": "Phony Form", + "Gimmighoul": "Chest Form" +} + # If a pokemon is in this form then its generally* not refered to as a form # *I say generally as some do and some don't default_forms = [