|
@@ -210,114 +210,135 @@ async def load_pokedex(dex_file: Path, force_dex: bool) -> dict:
|
|
|
|
|
|
return dex
|
|
|
|
|
|
-
|
|
|
+SHOWDOWN_STRIP_FORM = (
|
|
|
+ "burmy-plant",
|
|
|
+ "shellos-west", "gastrodon-west",
|
|
|
+ "deerling-spring", "sawsbuck-spring",
|
|
|
+ "flabébé-red", "floette-red", "florges-red",
|
|
|
+ "minior-red",
|
|
|
+ "vivillon-meadow",
|
|
|
+ "furfrou-natural",
|
|
|
+ "alcremie-vanilla-cream-strawberry",
|
|
|
+ "tatsugiri-curly",
|
|
|
+)
|
|
|
+# . for mime jr + mr mime + mr rime
|
|
|
+# ' for farfetch'd + sirfetch'd, also oricorio-pa'u
|
|
|
+# % for zygarde 10%
|
|
|
+# : for type: null
|
|
|
+# space mostly for tapus and paradox mons, but also some others
|
|
|
+SHOWDOWN_REMOVE_SYMBOLS = ".'%: "
|
|
|
SHOWDOWN_REPLACEMENTS = [
|
|
|
("mega-", "mega"), # charizard, mewtwo
|
|
|
("paldea-", "paldea"), # tauros
|
|
|
- ("mr. ", "mr"), # mr mime + mr rime
|
|
|
- (" jr.", "jr"), # mime jr
|
|
|
- ("'d", "d"), # farfetch'd and sirfetch'd
|
|
|
("nidoran-m", "nidoranm"),
|
|
|
- ("-f", "f"), # gender diff forms TODO maybe only do this for some, clean up later fixes
|
|
|
- (re.compile(r"-m$"), ""), # gender diff forms
|
|
|
- (re.compile(r"^ho-oh$"), "hooh"),
|
|
|
- ("burmy-plant", "burmy"),
|
|
|
- ("shellos-west", "shellos"),
|
|
|
- ("gastrodon-west", "gastrodon"),
|
|
|
- ("hippopotasf", "hippopotas-f"),
|
|
|
- ("hippowdonf", "hippowdon-f"),
|
|
|
- ("rotomf", "rotom-f"), # rotom fan + frost special case
|
|
|
+ ("nidoran-f", "nidoranf"),
|
|
|
+ ("ho-oh", "hooh"),
|
|
|
("porygon-z", "porygonz"),
|
|
|
- ("arceusf", "arceus-f"), # fire, flying, fairy, fighting special case
|
|
|
- ("unfezantf", "unfezant-f"),
|
|
|
("-striped", "striped"), # basculin special cases
|
|
|
("-galar-zen", "-galarzen"), # darmanitan special cases
|
|
|
- ("-spring", ""), # deerling, sawsbuck special cases
|
|
|
- ("frillishf", "frillish-f"),
|
|
|
- ("jellicentf", "jellicent-f"),
|
|
|
- ("pyroarf", "pyroar-f"),
|
|
|
- ("flabébé", "flabebe"),
|
|
|
- ("flabebe-red", "flabebe"),
|
|
|
- ("floette-red", "floette"),
|
|
|
- ("florges-red", "florges"),
|
|
|
- ("vivillonfancy", "vivillon-fancy"),
|
|
|
- ("vivillon-meadow", "vivillon"),
|
|
|
+ ("é", "e"), # flabebe
|
|
|
("vivillon-icy-snow", "vivillon-icysnow"),
|
|
|
("vivillon-high-plains", "vivillon-highplains"),
|
|
|
- ("meowsticf", "meowstic-f"),
|
|
|
("furfrou-la-reine", "furfrou-lareine"),
|
|
|
- ("furfrou-natural", "furfrou"),
|
|
|
- ("%", ""), # zygarde 10%,
|
|
|
("oricorio-pom-pom", "oricorio-pompom"),
|
|
|
- ("oricorio-pa'u", "oricorio-pau"),
|
|
|
- ("type: null", "typenull"),
|
|
|
- ("silvallyf", "silvally-f"), # fire, flying, fairy, fighting special case
|
|
|
- ("minior-red", "minior"),
|
|
|
("mo-o", "moo"), # jangmo-o, hakamo-o, kommo-o
|
|
|
- ("tapu ", "tapu"), # tapus
|
|
|
("dusk-mane", "duskmane"), # necrozma
|
|
|
("dawn-wings", "dawnwings"), # necrozma
|
|
|
("low-key", "lowkey"), # toxtricity
|
|
|
- ("swirlflower", "swirl-flower"), # alcremie
|
|
|
- ("creamflower", "cream-flower"), # alcremie
|
|
|
("-swirl", "swirl"), # alcremie
|
|
|
("-cream", "cream"), # alcremie
|
|
|
- ("-vanillacream-strawberry", ""), # alcremie
|
|
|
("-strawberry", ""), # alcremie
|
|
|
- ("indeedeef", "indeedee-f"),
|
|
|
("rapid-strike", "rapidstrike"), # Urshifu
|
|
|
("rapidstrike-gmax", "rapidstrikegmax"), # Urshifu
|
|
|
- ("basculegionf", "basculegion-f"),
|
|
|
- ("oinkolognef", "oinkologne-f"),
|
|
|
- ("mausholdfour", "maushold-four"),
|
|
|
- ("tatsugiri-curly", "tatsugiri"),
|
|
|
# dudunsparce (note - no visual diff on showdown as of 3/17)
|
|
|
("three-segment", "threesegment"),
|
|
|
("wo-chien", "wochien"),
|
|
|
("chien-pao", "chienpao"),
|
|
|
("ting-lu", "tinglu"),
|
|
|
("chi-yu", "chiyu"),
|
|
|
- ("roaring moon", "roaringmoon"),
|
|
|
- ("iron valiant", "ironvaliant"),
|
|
|
- ("walking wake", "walkingwake"),
|
|
|
- ("iron leaves", "ironleaves"),
|
|
|
]
|
|
|
|
|
|
|
|
|
def get_showdown_urls(pkmn: Pokemon, form: Form) -> list[tuple[str, str]]:
|
|
|
name = form.name.lower()
|
|
|
+ if name in SHOWDOWN_STRIP_FORM:
|
|
|
+ name = name.split("-", 1)[0]
|
|
|
+ for c in SHOWDOWN_REMOVE_SYMBOLS:
|
|
|
+ name = name.replace(c, "")
|
|
|
for pat, ins in SHOWDOWN_REPLACEMENTS:
|
|
|
- if isinstance(pat, re.Pattern):
|
|
|
- name = re.sub(pat, ins, name)
|
|
|
- else:
|
|
|
- name = name.replace(pat, ins)
|
|
|
- if 984 <= pkmn.num <= 995:
|
|
|
- # paradox mons
|
|
|
- name = name.replace(" ", "")
|
|
|
+ name = name.replace(pat, ins)
|
|
|
+ name = re.sub(r"-m$", "", name) # gender diff forms
|
|
|
+ # lol they just reuse the male back sprite for wobbuffet
|
|
|
+ back_name = name if name != "wobbuffet-f" else "wobbuffet"
|
|
|
return [
|
|
|
(f"https://play.pokemonshowdown.com/sprites/ani/{name}.gif", "gif"),
|
|
|
- (f"https://play.pokemonshowdown.com/sprites/ani-back/{name}.gif", "gif"),
|
|
|
+ (f"https://play.pokemonshowdown.com/sprites/ani-back/{back_name}.gif", "gif"),
|
|
|
(f"https://play.pokemonshowdown.com/sprites/gen5/{name}.png", "png"),
|
|
|
- (f"https://play.pokemonshowdown.com/sprites/gen5-back/{name}.png", "png"),
|
|
|
+ (f"https://play.pokemonshowdown.com/sprites/gen5-back/{back_name}.png", "png"),
|
|
|
]
|
|
|
|
|
|
|
|
|
+SEREBII_USE_SPECIES = (
|
|
|
+ "Wobbuffet-M",
|
|
|
+ "Shellos-West", "Gastrodon-West",
|
|
|
+ "Hippopotas-M", "Hippowdon-M",
|
|
|
+ "Unfezant-M",
|
|
|
+ "Deerling-Spring", "Sawsbuck-Spring",
|
|
|
+ "Frillish-M", "Jellicent-M",
|
|
|
+ "Pyroar-M",
|
|
|
+ "Furfrou-Natural",
|
|
|
+ "Minior-Meteor",
|
|
|
+ "Tatsugiri-Curly",
|
|
|
+)
|
|
|
+SEREBII_FORM_FIRST_LETTER = (
|
|
|
+ "Deoxys-Attack", "Deoxys-Defense", "Deoxys-Speed",
|
|
|
+ "Burmy-Plant", "Burmy-Sandy", "Burmy-Trash",
|
|
|
+ "Cherrim-Sunshine",
|
|
|
+ "Shellos-East", "Gastrodon-East",
|
|
|
+ "Dialga-Origin", "Palkia-Origin", "Giratina-Origin",
|
|
|
+ "Shaymin-Sky",
|
|
|
+ "Unfezant-F",
|
|
|
+ "Basculin-Blue-Striped", "Basculin-White-Striped",
|
|
|
+ "Deerling-Summer", "Deerling-Autumn", "Deerling-Winter",
|
|
|
+ "Sawsbuck-Summer", "Sawsbuck-Autumn", "Sawsbuck-Winter",
|
|
|
+ "Frillish-F", "Jellicent-F",
|
|
|
+ "Kyurem-Black", "Kyurem-White", "Keldeo-Resolute",
|
|
|
+ "Greninja-Ash",
|
|
|
+ "Pyroar-F",
|
|
|
+ "Flabébé-Blue", "Flabébé-Orange", "Flabébé-White", "Flabébé-Yellow", "Flabébé-Red",
|
|
|
+ "Floette-Blue", "Floette-Orange", "Floette-White", "Floette-Yellow", "Floette-Red",
|
|
|
+ "Florges-Blue", "Florges-Orange", "Florges-White", "Florges-Yellow", "Florges-Red",
|
|
|
+ "Meowstic-F",
|
|
|
+ "Aegislash-Blade",
|
|
|
+ "Hoopa-Unbound",
|
|
|
+ "Lycanroc-Midnight", "Lycanroc-Dusk",
|
|
|
+ "Wishiwashi-School",
|
|
|
+ "Minior-Blue", "Minior-Green", "Minior-Indigo", "Minior-Orange", "Minior-Red", "Minior-Violet", "Minior-Yellow",
|
|
|
+ "Mimikyu-Busted",
|
|
|
+ "Magearna-Original",
|
|
|
+ "Toxtricity-Low-Key",
|
|
|
+ "Eiscue-Noice",
|
|
|
+ "Indeedee-F",
|
|
|
+ "Morpeko-Hangry",
|
|
|
+ "Zacian-Crowned", "Zamazenta-Crowned",
|
|
|
+ "Eternatus-Eternamax",
|
|
|
+ "Zarude-Dada",
|
|
|
+ "Calyrex-Ice", "Calyrex-Shadow",
|
|
|
+ "Basculegion-F",
|
|
|
+ "Oinkologne-F",
|
|
|
+ "Maushold-Four",
|
|
|
+ "Palafin-Hero",
|
|
|
+ "Tatsugiri-Droopy", "Tatsugiri-Stretchy",
|
|
|
+ "Dudunsparce-Three-Segment",
|
|
|
+ "Gimmighoul-Roaming"
|
|
|
+)
|
|
|
SEREBII_SPECIAL = {
|
|
|
"Castform-Rainy": "r",
|
|
|
"Castform-Snowy": "i",
|
|
|
"Castform-Sunny": "s",
|
|
|
- "Deoxys-Attack": "a",
|
|
|
- "Deoxys-Defense": "d",
|
|
|
- "Deoxys-Speed": "s",
|
|
|
- "Burmy-Plant": "p",
|
|
|
- "Burmy-Sandy": "s",
|
|
|
- "Burmy-Trash": "t",
|
|
|
# wormadam plant is default form
|
|
|
"Wormadam-Sandy": "c",
|
|
|
"Wormadam-Trash": "t",
|
|
|
- "Cherrim-Sunshine": "s",
|
|
|
- "Shellos-East": "e",
|
|
|
- "Gastrodon-East": "e",
|
|
|
"Tauros-Paldea-Blaze": "b",
|
|
|
"Tauros-Paldea-Aqua": "a",
|
|
|
"Rotom-Heat": "h",
|
|
@@ -325,32 +346,13 @@ SEREBII_SPECIAL = {
|
|
|
"Rotom-Frost": "f",
|
|
|
"Rotom-Fan": "s",
|
|
|
"Rotom-Mow": "m",
|
|
|
- "Dialga-Origin": "o",
|
|
|
- "Palkia-Origin": "o",
|
|
|
- "Giratina-Origin": "o",
|
|
|
- "Shaymin-Sky": "s",
|
|
|
- "Unfezant-F": "f",
|
|
|
- "Basculin-Blue-Striped": "b",
|
|
|
- "Basculin-White-Striped": "w",
|
|
|
"Darmanitan-Zen": "z",
|
|
|
"Darmanitan-Galar-Zen": "gz",
|
|
|
- "Deerling-Summer": "s",
|
|
|
- "Deerling-Autumn": "a",
|
|
|
- "Deerling-Winter": "w",
|
|
|
- "Sawsbuck-Summer": "s",
|
|
|
- "Sawsbuck-Autumn": "a",
|
|
|
- "Sawsbuck-Winter": "w",
|
|
|
- "Frillish-F": "f",
|
|
|
- "Jellicent-F": "f",
|
|
|
- "Kyurem-Black": "b",
|
|
|
- "Kyurem-White": "w",
|
|
|
- "Keldeo-Resolute": "r",
|
|
|
"Meloetta-Pirouette": "s",
|
|
|
"Genesect-Douse": "w",
|
|
|
"Genesect-Shock": "e",
|
|
|
"Genesect-Burn": "f",
|
|
|
"Genesect-Chill": "i",
|
|
|
- "Greninja-Ash": "a",
|
|
|
"Vivillon-Archipelago": "a",
|
|
|
"Vivillon-Continental": "c",
|
|
|
"Vivillon-Elegant": "e",
|
|
@@ -371,23 +373,6 @@ SEREBII_SPECIAL = {
|
|
|
"Vivillon-Savanna": "sa",
|
|
|
"Vivillon-Sun": "su",
|
|
|
"Vivillon-Tundra": "t",
|
|
|
- "Pyroar-F": "f",
|
|
|
- "Flabébé-Blue": "b",
|
|
|
- "Flabébé-Orange": "o",
|
|
|
- "Flabébé-White": "w",
|
|
|
- "Flabébé-Yellow": "y",
|
|
|
- "Flabébé-Red": "r",
|
|
|
- "Floette-Blue": "b",
|
|
|
- "Floette-Orange": "o",
|
|
|
- "Floette-White": "w",
|
|
|
- "Floette-Yellow": "y",
|
|
|
- "Floette-Red": "r",
|
|
|
- "Florges-Blue": "b",
|
|
|
- "Florges-Orange": "o",
|
|
|
- "Florges-White": "w",
|
|
|
- "Florges-Yellow": "y",
|
|
|
- "Florges-Red": "r",
|
|
|
- "Meowstic-F": "f",
|
|
|
"Furfrou-Dandy": "da",
|
|
|
"Furfrou-Debutante": "de",
|
|
|
"Furfrou-Diamond": "d",
|
|
@@ -397,10 +382,8 @@ SEREBII_SPECIAL = {
|
|
|
"Furfrou-Matron": "m",
|
|
|
"Furfrou-Pharaoh": "p",
|
|
|
"Furfrou-Star": "s",
|
|
|
- "Aegislash-Blade": "b",
|
|
|
"Zygarde-10%": "10",
|
|
|
"Zygarde-Complete": "c",
|
|
|
- "Hoopa-Unbound": "u",
|
|
|
"Pumpkaboo-Small": "s", # kinda dumb but w/e
|
|
|
"Pumpkaboo-Large": "l",
|
|
|
"Pumpkaboo-Super": "h",
|
|
@@ -410,59 +393,18 @@ SEREBII_SPECIAL = {
|
|
|
"Oricorio-Pom-Pom": "p",
|
|
|
"Oricorio-Pa'u": "pau",
|
|
|
"Oricorio-Sensu": "s",
|
|
|
- "Lycanroc-Midnight": "m",
|
|
|
- "Lycanroc-Dusk": "d",
|
|
|
- "Wishiwashi-School": "s",
|
|
|
- "Minior-Blue": "b",
|
|
|
- "Minior-Green": "g",
|
|
|
- "Minior-Indigo": "i",
|
|
|
- "Minior-Orange": "o",
|
|
|
- "Minior-Red": "r",
|
|
|
- "Minior-Violet": "v",
|
|
|
- "Minior-Yellow": "y",
|
|
|
- "Mimikyu-Busted": "b",
|
|
|
"Necrozma-Dusk-Mane": "dm",
|
|
|
"Necrozma-Dawn-Wings": "dw",
|
|
|
"Necrozma-Ultra": "m",
|
|
|
- "Magearna-Original": "o",
|
|
|
"Cramorant-Gulping": "gu",
|
|
|
"Cramorant-Gorging": "go",
|
|
|
- "Toxtricity-Low-Key": "l",
|
|
|
"Sinistea-Antique": "f",
|
|
|
"Polteageist-Antique": "f",
|
|
|
- "Eiscue-Noice": "n",
|
|
|
- "Indeedee-F": "f",
|
|
|
- "Morpeko-Hangry": "h",
|
|
|
- "Zacian-Crowned": "c",
|
|
|
- "Zamazenta-Crowned": "c",
|
|
|
- "Eternatus-Eternamax": "e",
|
|
|
- "Zarude-Dada": "d",
|
|
|
- "Calyrex-Ice": "i",
|
|
|
- "Calyrex-Shadow": "s",
|
|
|
"Urshifu-Rapid-Strike": "r",
|
|
|
"Urshifu-Rapid-Strike-Gmax": "rgi",
|
|
|
- "Basculegion-F": "f",
|
|
|
- "Oinkologne-F": "f",
|
|
|
- "Maushold-Four": "f",
|
|
|
- "Palafin-Hero": "h",
|
|
|
- "Tatsugiri-Droopy": "d",
|
|
|
- "Tatsugiri-Stretchy": "s",
|
|
|
- "Dudunsparce-Three-Segment": "t",
|
|
|
- "Gimmighoul-Roaming": "r",
|
|
|
}
|
|
|
-SEREBII_USE_SPECIES = (
|
|
|
- "Shellos-West", "Gastrodon-West",
|
|
|
- "Hippopotas-M", "Hippowdon-M",
|
|
|
- "Unfezant-M",
|
|
|
- "Deerling-Spring", "Sawsbuck-Spring",
|
|
|
- "Frillish-M", "Jellicent-M",
|
|
|
- "Pyroar-M",
|
|
|
- "Furfrou-Natural",
|
|
|
- "Minior-Meteor",
|
|
|
- "Tatsugiri-Curly",
|
|
|
-)
|
|
|
SEREBII_IGNORE_MISSING = (
|
|
|
- "Hippopotas-F", "Hippowdon-F", "Floette-Eternal",
|
|
|
+ "Wobbuffet-F", "Hippopotas-F", "Hippowdon-F", "Floette-Eternal",
|
|
|
"Squawkabilly-Blue", "Squawkabilly-Yellow", "Squawkabilly-White",
|
|
|
)
|
|
|
|
|
@@ -470,6 +412,9 @@ SEREBII_IGNORE_MISSING = (
|
|
|
def get_serebii_url(pkmn: Pokemon, form: Form) -> str | None:
|
|
|
if form.name == pkmn.species or form.name in SEREBII_USE_SPECIES:
|
|
|
return f"https://www.serebii.net/pokemon/art/{pkmn.num:03d}.png"
|
|
|
+ if form.name in SEREBII_FORM_FIRST_LETTER:
|
|
|
+ letter = form.name.split("-", 1)[1][0].lower()
|
|
|
+ return f"https://www.serebii.net/pokemon/art/{pkmn.num:03d}-{letter}.png"
|
|
|
if form.name in SEREBII_SPECIAL:
|
|
|
return f"https://www.serebii.net/pokemon/art/{pkmn.num:03d}-{SEREBII_SPECIAL[form.name]}.png"
|
|
|
if "gmax" in form.traits:
|