diff --git a/public/images/pokemon/variant/_exp_masterlist.json b/public/images/pokemon/variant/_exp_masterlist.json new file mode 100644 index 00000000000..0ef5f209439 --- /dev/null +++ b/public/images/pokemon/variant/_exp_masterlist.json @@ -0,0 +1,656 @@ +{ + "3-mega": [0, 2, 2], + "6-mega-x": [0, 2, 2], + "6-mega-y": [0, 2, 2], + "80-mega": [0, 1, 1], + "94-mega": [2, 2, 2], + "127-mega": [0, 1, 1], + "130-mega": [0, 1, 1], + "142-mega": [0, 1, 1], + "150-mega-x": [0, 1, 1], + "150-mega-y": [0, 1, 1], + "181-mega": [0, 1, 2], + "212-mega": [1, 1, 2], + "229-mega": [0, 1, 1], + "248-mega": [0, 1, 1], + "257-mega": [0, 1, 1], + "282-mega": [0, 2, 2], + "302-mega": [0, 1, 1], + "303-mega": [0, 1, 1], + "306-mega": [1, 1, 1], + "308-mega": [0, 1, 1], + "310-mega": [0, 1, 1], + "334-mega": [0, 2, 1], + "354-mega": [0, 1, 1], + "359-mega": [0, 1, 1], + "362-mega": [0, 1, 1], + "373-mega": [0, 1, 1], + "376-mega": [0, 1, 1], + "380-mega": [0, 1, 1], + "381-mega": [0, 1, 1], + "382-primal": [0, 1, 1], + "383-primal": [0, 1, 1], + "384-mega": [0, 2, 1], + "428-mega": [0, 1, 1], + "445-mega": [1, 1, 1], + "448-mega": [1, 1, 1], + "475-mega": [0, 2, 2], + "531-mega": [0, 1, 1], + "653": [0, 1, 1], + "654": [0, 1, 1], + "655": [0, 1, 1], + "656": [0, 1, 1], + "657": [0, 1, 1], + "658": [0, 1, 1], + "658-ash": [0, 1, 1], + "664": [0, 1, 1], + "665": [0, 1, 1], + "666-archipelago": [0, 1, 1], + "666-continental": [0, 1, 1], + "666-elegant": [0, 1, 1], + "666-fancy": [0, 1, 1], + "666-garden": [0, 1, 1], + "666-high-plains": [0, 1, 1], + "666-icy-snow": [0, 1, 1], + "666-jungle": [0, 1, 1], + "666-marine": [0, 1, 1], + "666-meadow": [0, 1, 1], + "666-modern": [0, 1, 1], + "666-monsoon": [0, 1, 1], + "666-ocean": [0, 1, 1], + "666-poke-ball": [0, 1, 1], + "666-polar": [0, 1, 1], + "666-river": [0, 1, 1], + "666-sandstorm": [0, 1, 1], + "666-savanna": [0, 1, 1], + "666-sun": [0, 1, 1], + "666-tundra": [0, 1, 1], + "669-red": [0, 2, 2], + "669-blue": [0, 1, 1], + "669-white": [0, 1, 1], + "669-yellow": [0, 1, 1], + "669-orange": [0, 2, 2], + "670-white": [0, 1, 1], + "670-blue": [0, 1, 1], + "670-orange": [0, 1, 1], + "670-red": [0, 1, 1], + "670-yellow": [0, 1, 1], + "671-red": [0, 1, 2], + "671-blue": [0, 1, 2], + "671-yellow": [0, 1, 1], + "671-white": [0, 1, 2], + "671-orange": [0, 1, 2], + "672": [0, 1, 1], + "673": [0, 1, 1], + "676": [0, 1, 1], + "677": [0, 1, 1], + "678-female": [0, 1, 1], + "678": [0, 1, 1], + "682": [0, 1, 1], + "683": [0, 1, 1], + "684": [0, 1, 1], + "685": [0, 1, 1], + "688": [0, 1, 1], + "689": [0, 1, 1], + "690": [0, 1, 1], + "691": [0, 1, 1], + "696": [0, 1, 1], + "697": [0, 1, 1], + "699": [0, 1, 1], + "700": [0, 1, 1], + "702": [0, 1, 1], + "704": [0, 1, 1], + "705": [0, 1, 1], + "706": [0, 1, 1], + "709": [0, 1, 1], + "710": [0, 1, 1], + "711": [1, 1, 1], + "712": [0, 1, 1], + "713": [0, 1, 1], + "715": [0, 1, 1], + "716-active": [0, 1, 1], + "716-neutral": [0, 1, 1], + "717": [0, 2, 2], + "720-unbound": [1, 1, 1], + "720": [1, 1, 1], + "728": [0, 1, 1], + "729": [0, 1, 1], + "730": [0, 1, 1], + "734": [0, 1, 1], + "735": [0, 1, 1], + "742": [0, 2, 2], + "743": [0, 2, 2], + "747": [0, 2, 2], + "748": [0, 1, 1], + "751": [0, 1, 1], + "752": [0, 1, 1], + "753": [0, 1, 1], + "754": [0, 2, 2], + "755": [0, 1, 1], + "756": [0, 1, 1], + "761": [0, 1, 1], + "762": [0, 1, 1], + "763": [0, 1, 1], + "767": [0, 1, 1], + "768": [0, 1, 1], + "770": [0, 0, 0], + "771": [0, 2, 2], + "772": [0, 1, 1], + "773-fighting": [0, 1, 1], + "773-psychic": [0, 1, 1], + "773-poison": [0, 1, 1], + "773-ground": [0, 1, 1], + "773-ghost": [0, 1, 1], + "773-steel": [0, 1, 1], + "773-rock": [0, 1, 1], + "773-grass": [0, 1, 1], + "773-dragon": [0, 1, 1], + "773-bug": [0, 1, 1], + "773-ice": [0, 1, 1], + "773-dark": [0, 1, 1], + "773": [0, 1, 1], + "773-fairy": [0, 1, 1], + "773-water": [0, 1, 1], + "773-electric": [0, 1, 1], + "773-flying": [0, 1, 1], + "773-fire": [0, 1, 1], + "776": [0, 1, 1], + "777": [0, 1, 1], + "778-busted": [0, 1, 1], + "778-disguised": [0, 1, 1], + "779": [0, 1, 1], + "789": [1, 1, 1], + "790": [0, 1, 1], + "791": [2, 1, 1], + "792": [0, 1, 1], + "793": [0, 2, 2], + "797": [0, 1, 1], + "798": [0, 1, 1], + "800-dawn-wings": [0, 1, 1], + "800-dusk-mane": [0, 1, 1], + "800-ultra": [0, 1, 1], + "800": [0, 1, 1], + "802": [1, 1, 1], + "803": [0, 1, 1], + "804": [0, 1, 1], + "807": [0, 1, 1], + "808": [0, 1, 1], + "809": [0, 1, 1], + "816": [0, 1, 1], + "817": [0, 1, 1], + "818": [1, 1, 1], + "821": [0, 2, 2], + "822": [0, 1, 1], + "823": [0, 1, 1], + "829": [0, 1, 1], + "830": [0, 1, 1], + "835": [0, 1, 1], + "836": [0, 2, 2], + "850": [0, 1, 1], + "851": [0, 1, 1], + "854": [0, 1, 1], + "855": [0, 1, 1], + "856": [0, 1, 1], + "857": [0, 2, 2], + "858": [0, 1, 1], + "859": [0, 1, 1], + "860": [0, 1, 1], + "861": [0, 1, 1], + "862": [0, 1, 1], + "863": [0, 1, 1], + "864": [0, 1, 1], + "867": [0, 1, 1], + "872": [1, 1, 1], + "873": [1, 1, 1], + "876-female": [0, 1, 1], + "876": [0, 1, 1], + "877-hangry": [1, 1, 1], + "877": [1, 1, 1], + "880": [0, 1, 1], + "881": [0, 1, 1], + "882": [0, 2, 1], + "883": [0, 1, 1], + "884": [0, 1, 1], + "885": [1, 1, 1], + "886": [1, 1, 1], + "887": [1, 1, 1], + "888": [0, 1, 1], + "888-crowned": [0, 1, 1], + "889": [0, 1, 1], + "889-crowned": [0, 1, 1], + "890": [0, 2, 1], + "890-eternamax": [0, 1, 1], + "891": [1, 1, 1], + "892-rapid-strike": [1, 1, 1], + "892": [1, 1, 1], + "894": [0, 1, 1], + "895": [0, 1, 1], + "896": [1, 1, 1], + "897": [1, 1, 1], + "898": [1, 1, 1], + "898-ice": [1, 1, 1], + "898-shadow": [1, 1, 1], + "900": [0, 1, 1], + "901": [0, 1, 1], + "903": [0, 1, 1], + "909": [0, 1, 1], + "910": [0, 2, 2], + "911": [0, 2, 2], + "912": [0, 1, 2], + "913": [0, 1, 2], + "914": [0, 2, 1], + "919": [1, 1, 1], + "920": [1, 1, 1], + "924": [1, 1, 1], + "925-four": [1, 2, 2], + "925-three": [1, 2, 2], + "932": [0, 2, 2], + "933": [0, 2, 2], + "934": [0, 1, 1], + "935": [1, 1, 2], + "936": [2, 2, 2], + "937": [2, 2, 2], + "940": [0, 1, 1], + "941": [0, 1, 1], + "944": [0, 1, 1], + "945": [0, 1, 1], + "948": [0, 1, 1], + "949": [0, 1, 1], + "951": [0, 1, 1], + "952": [0, 1, 1], + "953": [0, 1, 1], + "954": [0, 1, 1], + "957": [2, 2, 2], + "958": [2, 2, 2], + "959": [2, 2, 2], + "962": [1, 1, 1], + "967": [0, 1, 1], + "968": [0, 1, 1], + "969": [0, 1, 1], + "970": [0, 1, 1], + "973": [1, 1, 1], + "974": [0, 1, 1], + "975": [0, 1, 1], + "978-curly": [0, 2, 2], + "978-droopy": [0, 2, 2], + "978-stretchy": [0, 2, 2], + "979": [2, 2, 2], + "981": [0, 1, 1], + "982": [0, 1, 1], + "982-three-segment": [0, 1, 1], + "987": [1, 1, 1], + "988": [0, 1, 2], + "993": [0, 1, 1], + "994": [0, 1, 2], + "995": [0, 1, 1], + "996": [0, 1, 1], + "997": [0, 2, 2], + "998": [0, 2, 2], + "999": [2, 1, 1], + "1000": [1, 1, 1], + "1001": [0, 1, 1], + "1003": [0, 1, 1], + "1004": [0, 1, 1], + "1006": [0, 2, 1], + "1007-apex-build": [0, 2, 2], + "1008-ultimate-mode": [1, 1, 1], + "2026": [0, 1, 1], + "2027": [0, 1, 1], + "2028": [0, 1, 1], + "2052": [0, 1, 1], + "2053": [0, 1, 0], + "2103": [0, 1, 1], + "4052": [0, 1, 1], + "4077": [0, 1, 1], + "4078": [0, 1, 1], + "4079": [0, 1, 1], + "4080": [2, 1, 1], + "4144": [0, 1, 1], + "4145": [0, 1, 1], + "4146": [0, 1, 1], + "4199": [2, 1, 1], + "4222": [0, 1, 1], + "4263": [0, 1, 1], + "4264": [0, 1, 1], + "4562": [0, 1, 1], + "6100": [0, 1, 1], + "6101": [0, 1, 1], + "6215": [0, 1, 1], + "6503": [0, 1, 1], + "6549": [0, 1, 1], + "6570": [0, 1, 1], + "6571": [0, 1, 1], + "6705": [0, 1, 1], + "6706": [0, 1, 1], + "6713": [0, 1, 1], + "female": { + "6215": [0, 1, 1] + }, + "back": { + "3-mega": [0, 2, 2], + "6-mega-x": [0, 2, 2], + "6-mega-y": [0, 1, 2], + "80-mega": [0, 1, 1], + "94-mega": [1, 1, 1], + "127-mega": [0, 1, 1], + "130-mega": [0, 1, 1], + "142-mega": [0, 1, 1], + "150-mega-x": [0, 1, 1], + "150-mega-y": [0, 1, 1], + "181-mega": [0, 1, 2], + "212-mega": [1, 2, 2], + "229-mega": [0, 1, 1], + "248-mega": [0, 1, 1], + "257-mega": [0, 1, 1], + "282-mega": [0, 1, 1], + "302-mega": [0, 1, 1], + "303-mega": [0, 1, 1], + "306-mega": [1, 1, 1], + "308-mega": [0, 1, 1], + "310-mega": [0, 1, 1], + "334-mega": [0, 1, 1], + "354-mega": [0, 1, 1], + "359-mega": [0, 1, 1], + "362-mega": [0, 1, 1], + "373-mega": [0, 1, 1], + "376-mega": [0, 1, 1], + "380-mega": [0, 1, 1], + "381-mega": [0, 1, 1], + "382-primal": [0, 1, 1], + "383-primal": [0, 1, 1], + "384-mega": [0, 1, 1], + "428-mega": [0, 1, 1], + "445-mega": [1, 1, 1], + "448-mega": [1, 1, 1], + "475-mega": [0, 2, 2], + "531-mega": [0, 1, 1], + "653": [0, 1, 1], + "654": [0, 1, 1], + "655": [0, 1, 1], + "656": [0, 1, 1], + "657": [0, 1, 1], + "658": [0, 1, 1], + "658-ash": [0, 1, 1], + "664": [0, 1, 1], + "665": [0, 1, 1], + "666-archipelago": [0, 1, 1], + "666-continental": [0, 1, 1], + "666-elegant": [0, 1, 1], + "666-fancy": [0, 1, 1], + "666-garden": [0, 1, 1], + "666-high-plains": [0, 1, 1], + "666-icy-snow": [0, 1, 1], + "666-jungle": [0, 1, 1], + "666-marine": [0, 1, 1], + "666-meadow": [0, 1, 1], + "666-modern": [0, 1, 1], + "666-monsoon": [0, 1, 1], + "666-ocean": [0, 1, 1], + "666-poke-ball": [0, 1, 1], + "666-polar": [0, 1, 1], + "666-river": [0, 1, 1], + "666-sandstorm": [0, 1, 1], + "666-savanna": [0, 1, 1], + "666-sun": [0, 1, 1], + "666-tundra": [0, 1, 1], + "669-red": [0, 2, 2], + "669-blue": [0, 2, 2], + "669-white": [0, 2, 2], + "669-yellow": [0, 2, 2], + "669-orange": [0, 2, 2], + "670-white": [0, 1, 1], + "670-blue": [0, 2, 2], + "670-orange": [0, 1, 1], + "670-red": [0, 1, 1], + "670-yellow": [0, 1, 1], + "671-red": [0, 1, 1], + "671-blue": [0, 1, 1], + "671-yellow": [0, 1, 1], + "671-white": [0, 1, 1], + "671-orange": [0, 1, 1], + "672": [0, 1, 1], + "673": [0, 1, 1], + "676": [0, 1, 1], + "677": [0, 1, 1], + "678-female": [0, 1, 1], + "678": [0, 1, 1], + "682": [0, 1, 1], + "683": [0, 1, 1], + "684": [0, 1, 1], + "685": [0, 1, 1], + "688": [0, 1, 1], + "689": [0, 1, 1], + "690": [0, 1, 1], + "691": [0, 1, 1], + "696": [0, 1, 1], + "697": [0, 1, 1], + "699": [0, 2, 2], + "700": [0, 1, 1], + "702": [0, 1, 1], + "704": [0, 1, 1], + "705": [0, 1, 1], + "706": [0, 1, 1], + "709": [0, 1, 1], + "710": [0, 1, 1], + "711": [1, 1, 1], + "712": [0, 1, 1], + "713": [0, 1, 1], + "715": [0, 1, 1], + "716-active": [0, 1, 1], + "716-neutral": [0, 1, 1], + "717": [0, 1, 1], + "720-unbound": [1, 1, 1], + "720": [1, 1, 1], + "728": [0, 1, 1], + "729": [0, 1, 1], + "730": [0, 1, 1], + "734": [0, 1, 1], + "735": [0, 1, 1], + "742": [0, 2, 2], + "743": [0, 2, 2], + "747": [0, 2, 2], + "748": [0, 1, 1], + "751": [0, 1, 1], + "752": [0, 1, 1], + "753": [0, 1, 1], + "754": [0, 2, 2], + "755": [0, 1, 1], + "756": [0, 1, 1], + "761": [0, 1, 1], + "762": [0, 1, 1], + "763": [0, 1, 1], + "767": [0, 1, 1], + "768": [0, 1, 1], + "771": [0, 1, 1], + "772": [0, 1, 1], + "773-fighting": [0, 1, 1], + "773-psychic": [0, 1, 1], + "773-poison": [0, 1, 1], + "773-ground": [0, 1, 1], + "773-ghost": [0, 1, 1], + "773-steel": [0, 1, 1], + "773-rock": [0, 1, 1], + "773-grass": [0, 1, 1], + "773-dragon": [0, 1, 1], + "773-bug": [0, 1, 1], + "773-ice": [0, 1, 1], + "773-dark": [0, 1, 1], + "773": [0, 1, 1], + "773-fairy": [0, 1, 1], + "773-water": [0, 1, 1], + "773-electric": [0, 1, 1], + "773-flying": [0, 1, 1], + "773-fire": [0, 1, 1], + "776": [0, 2, 2], + "777": [0, 1, 1], + "778-busted": [0, 1, 1], + "778-disguised": [0, 1, 1], + "779": [0, 1, 1], + "789": [1, 1, 1], + "790": [0, 1, 1], + "791": [1, 1, 1], + "792": [0, 1, 1], + "793": [0, 1, 1], + "797": [0, 1, 1], + "798": [0, 1, 1], + "800-dawn-wings": [0, 1, 1], + "800-dusk-mane": [0, 1, 1], + "800-ultra": [0, 1, 1], + "800": [0, 1, 1], + "802": [1, 1, 1], + "803": [0, 1, 1], + "804": [0, 1, 1], + "807": [0, 1, 1], + "808": [0, 1, 1], + "809": [0, 1, 1], + "816": [0, 1, 1], + "817": [0, 1, 1], + "818": [0, 1, 1], + "821": [0, 1, 1], + "822": [0, 1, 1], + "823": [0, 1, 1], + "829": [0, 1, 1], + "830": [0, 1, 1], + "835": [0, 1, 1], + "836": [0, 1, 1], + "850": [0, 1, 1], + "851": [0, 1, 1], + "854": [0, 1, 1], + "855": [0, 1, 1], + "856": [0, 1, 1], + "857": [0, 2, 2], + "858": [0, 1, 1], + "859": [0, 1, 1], + "860": [0, 1, 1], + "861": [0, 1, 1], + "862": [0, 1, 1], + "863": [0, 1, 1], + "864": [0, 1, 1], + "867": [0, 1, 1], + "872": [1, 1, 1], + "873": [1, 1, 1], + "876-female": [0, 1, 1], + "876": [0, 1, 1], + "877-hangry": [1, 1, 1], + "877": [1, 1, 1], + "880": [0, 1, 1], + "881": [0, 1, 1], + "882": [0, 1, 1], + "883": [0, 1, 1], + "884": [0, 1, 1], + "885": [1, 1, 1], + "886": [1, 1, 1], + "887": [1, 1, 1], + "888": [0, 1, 1], + "888-crowned": [0, 1, 1], + "889": [0, 1, 1], + "889-crowned": [0, 1, 1], + "890": [0, 1, 1], + "891": [1, 1, 1], + "892-rapid-strike": [1, 1, 1], + "892": [1, 1, 1], + "894": [0, 1, 1], + "895": [0, 1, 1], + "896": [1, 1, 1], + "897": [1, 1, 1], + "898": [1, 1, 1], + "898-ice": [1, 1, 1], + "898-shadow": [1, 1, 1], + "900": [0, 1, 1], + "901": [0, 1, 1], + "903": [0, 1, 1], + "909": [0, 1, 1], + "910": [0, 2, 2], + "911": [0, 1, 1], + "912": [0, 1, 1], + "913": [0, 1, 1], + "914": [0, 2, 2], + "919": [1, 1, 1], + "920": [1, 1, 1], + "924": [1, 1, 1], + "925-four": [1, 2, 2], + "925-three": [1, 2, 2], + "932": [0, 1, 1], + "933": [0, 1, 1], + "934": [0, 1, 1], + "935": [2, 2, 2], + "936": [2, 2, 2], + "937": [2, 2, 2], + "940": [0, 1, 1], + "941": [0, 1, 1], + "944": [0, 1, 1], + "945": [0, 1, 1], + "948": [0, 1, 1], + "949": [0, 1, 1], + "951": [0, 1, 1], + "952": [0, 2, 1], + "953": [0, 1, 1], + "954": [0, 1, 1], + "957": [1, 1, 1], + "958": [1, 1, 1], + "959": [1, 1, 1], + "962": [1, 1, 1], + "967": [0, 1, 1], + "968": [0, 2, 2], + "969": [0, 1, 1], + "970": [0, 1, 1], + "973": [1, 1, 1], + "974": [0, 1, 1], + "975": [0, 1, 1], + "978-curly": [0, 2, 2], + "978-droopy": [0, 2, 2], + "978-stretchy": [0, 1, 1], + "979": [1, 1, 1], + "981": [0, 1, 1], + "982": [0, 1, 1], + "982-three-segment": [0, 1, 1], + "987": [1, 1, 1], + "988": [0, 1, 1], + "993": [0, 1, 1], + "994": [0, 1, 1], + "995": [0, 1, 1], + "996": [0, 1, 1], + "997": [0, 1, 1], + "998": [0, 1, 1], + "999": [1, 1, 1], + "1000": [1, 1, 1], + "1001": [0, 1, 1], + "1003": [0, 1, 1], + "1004": [0, 1, 1], + "1006": [0, 2, 2], + "1007-apex-build": [0, 2, 2], + "1008-ultimate-mode": [1, 1, 1], + "2026": [0, 1, 1], + "2027": [0, 1, 1], + "2028": [0, 1, 1], + "2052": [0, 1, 1], + "2053": [0, 1, 1], + "2103": [0, 1, 1], + "4052": [0, 1, 1], + "4077": [0, 1, 1], + "4078": [0, 1, 1], + "4079": [0, 1, 1], + "4080": [2, 2, 2], + "4144": [0, 1, 1], + "4145": [0, 1, 1], + "4146": [0, 1, 1], + "4199": [2, 1, 1], + "4222": [0, 1, 1], + "4263": [0, 1, 1], + "4264": [0, 1, 1], + "4562": [0, 1, 1], + "6100": [0, 1, 1], + "6101": [0, 1, 1], + "6215": [0, 1, 1], + "6503": [0, 1, 1], + "6549": [0, 1, 1], + "6570": [0, 1, 1], + "6571": [0, 1, 1], + "6705": [0, 1, 1], + "6706": [0, 1, 1], + "6713": [0, 1, 1], + "female": { + "6215": [0, 1, 1] + } + } +} \ No newline at end of file diff --git a/public/images/pokemon/variant/_masterlist.json b/public/images/pokemon/variant/_masterlist.json index 175b56139a6..ac683d9544e 100644 --- a/public/images/pokemon/variant/_masterlist.json +++ b/public/images/pokemon/variant/_masterlist.json @@ -1813,669 +1813,5 @@ "593": [1, 1, 1], "6215": [0, 1, 1] } - }, - "exp": { - "3-mega": [0, 2, 2], - "6-mega-x": [0, 2, 2], - "6-mega-y": [0, 2, 2], - "80-mega": [0, 1, 1], - "94-mega": [2, 2, 2], - "127-mega": [0, 1, 1], - "130-mega": [0, 1, 1], - "142-mega": [0, 1, 1], - "150-mega-x": [0, 1, 1], - "150-mega-y": [0, 1, 1], - "181-mega": [0, 1, 2], - "212-mega": [1, 1, 2], - "229-mega": [0, 1, 1], - "248-mega": [0, 1, 1], - "257-mega": [0, 1, 1], - "282-mega": [0, 2, 2], - "302-mega": [0, 1, 1], - "303-mega": [0, 1, 1], - "306-mega": [1, 1, 1], - "308-mega": [0, 1, 1], - "310-mega": [0, 1, 1], - "334-mega": [0, 2, 1], - "354-mega": [0, 1, 1], - "359-mega": [0, 1, 1], - "362-mega": [0, 1, 1], - "373-mega": [0, 1, 1], - "376-mega": [0, 1, 1], - "380-mega": [0, 1, 1], - "381-mega": [0, 1, 1], - "382-primal": [0, 1, 1], - "383-primal": [0, 1, 1], - "384-mega": [0, 2, 1], - "428-mega": [0, 1, 1], - "445-mega": [1, 1, 1], - "448-mega": [1, 1, 1], - "475-mega": [0, 2, 2], - "531-mega": [0, 1, 1], - "653": [0, 1, 1], - "654": [0, 1, 1], - "655": [0, 1, 1], - "656": [0, 1, 1], - "657": [0, 1, 1], - "658": [0, 1, 1], - "658-ash": [0, 1, 1], - "664": [0, 1, 1], - "665": [0, 1, 1], - "666-archipelago": [0, 1, 1], - "666-continental": [0, 1, 1], - "666-elegant": [0, 1, 1], - "666-fancy": [0, 1, 1], - "666-garden": [0, 1, 1], - "666-high-plains": [0, 1, 1], - "666-icy-snow": [0, 1, 1], - "666-jungle": [0, 1, 1], - "666-marine": [0, 1, 1], - "666-meadow": [0, 1, 1], - "666-modern": [0, 1, 1], - "666-monsoon": [0, 1, 1], - "666-ocean": [0, 1, 1], - "666-poke-ball": [0, 1, 1], - "666-polar": [0, 1, 1], - "666-river": [0, 1, 1], - "666-sandstorm": [0, 1, 1], - "666-savanna": [0, 1, 1], - "666-sun": [0, 1, 1], - "666-tundra": [0, 1, 1], - "669-red": [0, 2, 2], - "669-blue": [0, 1, 1], - "669-white": [0, 1, 1], - "669-yellow": [0, 1, 1], - "669-orange": [0, 2, 2], - "670-white": [0, 1, 1], - "670-blue": [0, 1, 1], - "670-orange": [0, 1, 1], - "670-red": [0, 1, 1], - "670-yellow": [0, 1, 1], - "671-red": [0, 1, 2], - "671-blue": [0, 1, 2], - "671-yellow": [0, 1, 1], - "671-white": [0, 1, 2], - "671-orange": [0, 1, 2], - "672": [0, 1, 1], - "673": [0, 1, 1], - "676": [0, 1, 1], - "677": [0, 1, 1], - "678-female": [0, 1, 1], - "678": [0, 1, 1], - "682": [0, 1, 1], - "683": [0, 1, 1], - "684": [0, 1, 1], - "685": [0, 1, 1], - "688": [0, 1, 1], - "689": [0, 1, 1], - "690": [0, 1, 1], - "691": [0, 1, 1], - "696": [0, 1, 1], - "697": [0, 1, 1], - "698": [0, 1, 1], - "699": [0, 1, 1], - "700": [0, 1, 1], - "702": [0, 1, 1], - "703": [0, 1, 1], - "704": [0, 1, 1], - "705": [0, 1, 1], - "706": [0, 1, 1], - "708": [0, 1, 1], - "709": [0, 1, 1], - "710": [0, 1, 1], - "711": [1, 1, 1], - "712": [0, 1, 1], - "713": [0, 1, 1], - "714": [0, 1, 1], - "715": [0, 1, 1], - "716-active": [0, 1, 1], - "716-neutral": [0, 1, 1], - "717": [0, 2, 2], - "720-unbound": [1, 1, 1], - "720": [1, 1, 1], - "728": [0, 1, 1], - "729": [0, 1, 1], - "730": [0, 1, 1], - "734": [0, 1, 1], - "735": [0, 1, 1], - "742": [0, 2, 2], - "743": [0, 2, 2], - "747": [0, 2, 2], - "748": [0, 1, 1], - "751": [0, 1, 1], - "752": [0, 1, 1], - "753": [0, 1, 1], - "754": [0, 2, 2], - "755": [0, 1, 1], - "756": [0, 1, 1], - "761": [0, 1, 1], - "762": [0, 1, 1], - "763": [0, 1, 1], - "767": [0, 1, 1], - "768": [0, 1, 1], - "770": [0, 0, 0], - "771": [0, 2, 2], - "772": [0, 1, 1], - "773-fighting": [0, 1, 1], - "773-psychic": [0, 1, 1], - "773-poison": [0, 1, 1], - "773-ground": [0, 1, 1], - "773-ghost": [0, 1, 1], - "773-steel": [0, 1, 1], - "773-rock": [0, 1, 1], - "773-grass": [0, 1, 1], - "773-dragon": [0, 1, 1], - "773-bug": [0, 1, 1], - "773-ice": [0, 1, 1], - "773-dark": [0, 1, 1], - "773": [0, 1, 1], - "773-fairy": [0, 1, 1], - "773-water": [0, 1, 1], - "773-electric": [0, 1, 1], - "773-flying": [0, 1, 1], - "773-fire": [0, 1, 1], - "776": [0, 1, 1], - "777": [0, 1, 1], - "778-busted": [0, 1, 1], - "778-disguised": [0, 1, 1], - "779": [0, 1, 1], - "789": [1, 1, 1], - "790": [0, 1, 1], - "791": [2, 1, 1], - "792": [0, 1, 1], - "793": [0, 2, 2], - "797": [0, 1, 1], - "798": [0, 1, 1], - "800-dawn-wings": [0, 1, 1], - "800-dusk-mane": [0, 1, 1], - "800-ultra": [0, 1, 1], - "800": [0, 1, 1], - "802": [1, 1, 1], - "803": [0, 1, 1], - "804": [0, 1, 1], - "807": [0, 1, 1], - "808": [0, 1, 1], - "809": [0, 1, 1], - "816": [0, 1, 1], - "817": [0, 1, 1], - "818": [1, 1, 1], - "821": [0, 2, 2], - "822": [0, 1, 1], - "823": [0, 1, 1], - "829": [0, 1, 1], - "830": [0, 1, 1], - "835": [0, 1, 1], - "836": [0, 2, 2], - "850": [0, 1, 1], - "851": [0, 1, 1], - "854": [0, 1, 1], - "855": [0, 1, 1], - "856": [0, 1, 1], - "857": [0, 2, 2], - "858": [0, 1, 1], - "859": [0, 1, 1], - "860": [0, 1, 1], - "861": [0, 1, 1], - "862": [0, 1, 1], - "863": [0, 1, 1], - "864": [0, 1, 1], - "867": [0, 1, 1], - "872": [1, 1, 1], - "873": [1, 1, 1], - "876-female": [0, 1, 1], - "876": [0, 1, 1], - "877-hangry": [1, 1, 1], - "877": [1, 1, 1], - "880": [0, 1, 1], - "881": [0, 1, 1], - "882": [0, 2, 1], - "883": [0, 1, 1], - "884": [0, 1, 1], - "885": [1, 1, 1], - "886": [1, 1, 1], - "887": [1, 1, 1], - "888": [0, 1, 1], - "888-crowned": [0, 1, 1], - "889": [0, 1, 1], - "889-crowned": [0, 1, 1], - "890": [0, 2, 1], - "890-eternamax": [0, 1, 1], - "891": [1, 1, 1], - "892-rapid-strike": [1, 1, 1], - "892": [1, 1, 1], - "894": [0, 1, 1], - "895": [0, 1, 1], - "896": [1, 1, 1], - "897": [1, 1, 1], - "898": [1, 1, 1], - "898-ice": [1, 1, 1], - "898-shadow": [1, 1, 1], - "900": [0, 1, 1], - "901": [0, 1, 1], - "903": [0, 1, 1], - "909": [0, 1, 1], - "910": [0, 2, 2], - "911": [0, 2, 2], - "912": [0, 1, 2], - "913": [0, 1, 2], - "914": [0, 2, 1], - "919": [1, 1, 1], - "920": [1, 1, 1], - "924": [1, 1, 1], - "925-four": [1, 2, 2], - "925-three": [1, 2, 2], - "932": [0, 2, 2], - "933": [0, 2, 2], - "934": [0, 1, 1], - "935": [1, 1, 2], - "936": [2, 2, 2], - "937": [2, 2, 2], - "940": [0, 1, 1], - "941": [0, 1, 1], - "944": [0, 1, 1], - "945": [0, 1, 1], - "948": [0, 1, 1], - "949": [0, 1, 1], - "951": [0, 1, 1], - "952": [0, 1, 1], - "953": [0, 1, 1], - "954": [0, 1, 1], - "957": [2, 2, 2], - "958": [2, 2, 2], - "959": [2, 2, 2], - "962": [1, 1, 1], - "967": [0, 1, 1], - "968": [0, 1, 1], - "969": [0, 1, 1], - "970": [0, 1, 1], - "973": [1, 1, 1], - "974": [0, 1, 1], - "975": [0, 1, 1], - "978-curly": [0, 2, 2], - "978-droopy": [0, 2, 2], - "978-stretchy": [0, 2, 2], - "979": [2, 2, 2], - "981": [0, 1, 1], - "982": [0, 1, 1], - "982-three-segment": [0, 1, 1], - "987": [1, 1, 1], - "988": [0, 1, 2], - "993": [0, 1, 1], - "994": [0, 1, 2], - "995": [0, 1, 1], - "996": [0, 1, 1], - "997": [0, 2, 2], - "998": [0, 2, 2], - "999": [2, 1, 1], - "1000": [1, 1, 1], - "1001": [0, 1, 1], - "1003": [0, 1, 1], - "1004": [0, 1, 1], - "1006": [0, 2, 1], - "1007-apex-build": [0, 2, 2], - "1008-ultimate-mode": [1, 1, 1], - "2026": [0, 1, 1], - "2027": [0, 1, 1], - "2028": [0, 1, 1], - "2052": [0, 1, 1], - "2053": [0, 1, 0], - "2103": [0, 1, 1], - "4052": [0, 1, 1], - "4077": [0, 1, 1], - "4078": [0, 1, 1], - "4079": [0, 1, 1], - "4080": [2, 1, 1], - "4144": [0, 1, 1], - "4145": [0, 1, 1], - "4146": [0, 1, 1], - "4199": [2, 1, 1], - "4222": [0, 1, 1], - "4263": [0, 1, 1], - "4264": [0, 1, 1], - "4562": [0, 1, 1], - "6100": [0, 1, 1], - "6101": [0, 1, 1], - "6215": [0, 1, 1], - "6503": [0, 1, 1], - "6549": [0, 1, 1], - "6570": [0, 1, 1], - "6571": [0, 1, 1], - "6705": [0, 1, 1], - "6706": [0, 1, 1], - "6713": [0, 1, 1], - "female": { - "6215": [0, 1, 1] - }, - "back": { - "3-mega": [0, 2, 2], - "6-mega-x": [0, 2, 2], - "6-mega-y": [0, 1, 2], - "80-mega": [0, 1, 1], - "94-mega": [1, 1, 1], - "127-mega": [0, 1, 1], - "130-mega": [0, 1, 1], - "142-mega": [0, 1, 1], - "150-mega-x": [0, 1, 1], - "150-mega-y": [0, 1, 1], - "181-mega": [0, 1, 2], - "212-mega": [1, 2, 2], - "229-mega": [0, 1, 1], - "248-mega": [0, 1, 1], - "257-mega": [0, 1, 1], - "282-mega": [0, 1, 1], - "302-mega": [0, 1, 1], - "303-mega": [0, 1, 1], - "306-mega": [1, 1, 1], - "308-mega": [0, 1, 1], - "310-mega": [0, 1, 1], - "334-mega": [0, 1, 1], - "354-mega": [0, 1, 1], - "359-mega": [0, 1, 1], - "362-mega": [0, 1, 1], - "373-mega": [0, 1, 1], - "376-mega": [0, 1, 1], - "380-mega": [0, 1, 1], - "381-mega": [0, 1, 1], - "382-primal": [0, 1, 1], - "383-primal": [0, 1, 1], - "384-mega": [0, 1, 1], - "428-mega": [0, 1, 1], - "445-mega": [1, 1, 1], - "448-mega": [1, 1, 1], - "475-mega": [0, 2, 2], - "531-mega": [0, 1, 1], - "653": [0, 1, 1], - "654": [0, 1, 1], - "655": [0, 1, 1], - "656": [0, 1, 1], - "657": [0, 1, 1], - "658": [0, 1, 1], - "658-ash": [0, 1, 1], - "664": [0, 1, 1], - "665": [0, 1, 1], - "666-archipelago": [0, 1, 1], - "666-continental": [0, 1, 1], - "666-elegant": [0, 1, 1], - "666-fancy": [0, 1, 1], - "666-garden": [0, 1, 1], - "666-high-plains": [0, 1, 1], - "666-icy-snow": [0, 1, 1], - "666-jungle": [0, 1, 1], - "666-marine": [0, 1, 1], - "666-meadow": [0, 1, 1], - "666-modern": [0, 1, 1], - "666-monsoon": [0, 1, 1], - "666-ocean": [0, 1, 1], - "666-poke-ball": [0, 1, 1], - "666-polar": [0, 1, 1], - "666-river": [0, 1, 1], - "666-sandstorm": [0, 1, 1], - "666-savanna": [0, 1, 1], - "666-sun": [0, 1, 1], - "666-tundra": [0, 1, 1], - "669-red": [0, 2, 2], - "669-blue": [0, 2, 2], - "669-white": [0, 2, 2], - "669-yellow": [0, 2, 2], - "669-orange": [0, 2, 2], - "670-white": [0, 1, 1], - "670-blue": [0, 2, 2], - "670-orange": [0, 1, 1], - "670-red": [0, 1, 1], - "670-yellow": [0, 1, 1], - "671-red": [0, 1, 1], - "671-blue": [0, 1, 1], - "671-yellow": [0, 1, 1], - "671-white": [0, 1, 1], - "671-orange": [0, 1, 1], - "672": [0, 1, 1], - "673": [0, 1, 1], - "676": [0, 1, 1], - "677": [0, 1, 1], - "678-female": [0, 1, 1], - "678": [0, 1, 1], - "682": [0, 1, 1], - "683": [0, 1, 1], - "684": [0, 1, 1], - "685": [0, 1, 1], - "688": [0, 1, 1], - "689": [0, 1, 1], - "690": [0, 1, 1], - "691": [0, 1, 1], - "696": [0, 1, 1], - "697": [0, 1, 1], - "698": [0, 1, 1], - "699": [0, 2, 2], - "700": [0, 1, 1], - "702": [0, 1, 1], - "703": [0, 1, 1], - "704": [0, 1, 1], - "705": [0, 1, 1], - "706": [0, 1, 1], - "708": [0, 1, 1], - "709": [0, 1, 1], - "710": [0, 1, 1], - "711": [1, 1, 1], - "712": [0, 1, 1], - "713": [0, 1, 1], - "714": [0, 1, 1], - "715": [0, 1, 1], - "716-active": [0, 1, 1], - "716-neutral": [0, 1, 1], - "717": [0, 1, 1], - "720-unbound": [1, 1, 1], - "720": [1, 1, 1], - "728": [0, 1, 1], - "729": [0, 1, 1], - "730": [0, 1, 1], - "734": [0, 1, 1], - "735": [0, 1, 1], - "742": [0, 2, 2], - "743": [0, 2, 2], - "747": [0, 2, 2], - "748": [0, 1, 1], - "751": [0, 1, 1], - "752": [0, 1, 1], - "753": [0, 1, 1], - "754": [0, 2, 2], - "755": [0, 1, 1], - "756": [0, 1, 1], - "761": [0, 1, 1], - "762": [0, 1, 1], - "763": [0, 1, 1], - "767": [0, 1, 1], - "768": [0, 1, 1], - "771": [0, 1, 1], - "772": [0, 1, 1], - "773-fighting": [0, 1, 1], - "773-psychic": [0, 1, 1], - "773-poison": [0, 1, 1], - "773-ground": [0, 1, 1], - "773-ghost": [0, 1, 1], - "773-steel": [0, 1, 1], - "773-rock": [0, 1, 1], - "773-grass": [0, 1, 1], - "773-dragon": [0, 1, 1], - "773-bug": [0, 1, 1], - "773-ice": [0, 1, 1], - "773-dark": [0, 1, 1], - "773": [0, 1, 1], - "773-fairy": [0, 1, 1], - "773-water": [0, 1, 1], - "773-electric": [0, 1, 1], - "773-flying": [0, 1, 1], - "773-fire": [0, 1, 1], - "776": [0, 2, 2], - "777": [0, 1, 1], - "778-busted": [0, 1, 1], - "778-disguised": [0, 1, 1], - "779": [0, 1, 1], - "789": [1, 1, 1], - "790": [0, 1, 1], - "791": [1, 1, 1], - "792": [0, 1, 1], - "793": [0, 1, 1], - "797": [0, 1, 1], - "798": [0, 1, 1], - "800-dawn-wings": [0, 1, 1], - "800-dusk-mane": [0, 1, 1], - "800-ultra": [0, 1, 1], - "800": [0, 1, 1], - "802": [1, 1, 1], - "803": [0, 1, 1], - "804": [0, 1, 1], - "807": [0, 1, 1], - "808": [0, 1, 1], - "809": [0, 1, 1], - "816": [0, 1, 1], - "817": [0, 1, 1], - "818": [0, 1, 1], - "821": [0, 1, 1], - "822": [0, 1, 1], - "823": [0, 1, 1], - "829": [0, 1, 1], - "830": [0, 1, 1], - "835": [0, 1, 1], - "836": [0, 1, 1], - "850": [0, 1, 1], - "851": [0, 1, 1], - "854": [0, 1, 1], - "855": [0, 1, 1], - "856": [0, 1, 1], - "857": [0, 2, 2], - "858": [0, 1, 1], - "859": [0, 1, 1], - "860": [0, 1, 1], - "861": [0, 1, 1], - "862": [0, 1, 1], - "863": [0, 1, 1], - "864": [0, 1, 1], - "867": [0, 1, 1], - "872": [1, 1, 1], - "873": [1, 1, 1], - "876-female": [0, 1, 1], - "876": [0, 1, 1], - "877-hangry": [1, 1, 1], - "877": [1, 1, 1], - "880": [0, 1, 1], - "881": [0, 1, 1], - "882": [0, 1, 1], - "883": [0, 1, 1], - "884": [0, 1, 1], - "885": [1, 1, 1], - "886": [1, 1, 1], - "887": [1, 1, 1], - "888": [0, 1, 1], - "888-crowned": [0, 1, 1], - "889": [0, 1, 1], - "889-crowned": [0, 1, 1], - "890": [0, 1, 1], - "891": [1, 1, 1], - "892-rapid-strike": [1, 1, 1], - "892": [1, 1, 1], - "894": [0, 1, 1], - "895": [0, 1, 1], - "896": [1, 1, 1], - "897": [1, 1, 1], - "898": [1, 1, 1], - "898-ice": [1, 1, 1], - "898-shadow": [1, 1, 1], - "900": [0, 1, 1], - "901": [0, 1, 1], - "903": [0, 1, 1], - "909": [0, 1, 1], - "910": [0, 2, 2], - "911": [0, 1, 1], - "912": [0, 1, 1], - "913": [0, 1, 1], - "914": [0, 2, 2], - "919": [1, 1, 1], - "920": [1, 1, 1], - "924": [1, 1, 1], - "925-four": [1, 2, 2], - "925-three": [1, 2, 2], - "932": [0, 1, 1], - "933": [0, 1, 1], - "934": [0, 1, 1], - "935": [2, 2, 2], - "936": [2, 2, 2], - "937": [2, 2, 2], - "940": [0, 1, 1], - "941": [0, 1, 1], - "944": [0, 1, 1], - "945": [0, 1, 1], - "948": [0, 1, 1], - "949": [0, 1, 1], - "951": [0, 1, 1], - "952": [0, 2, 1], - "953": [0, 1, 1], - "954": [0, 1, 1], - "957": [1, 1, 1], - "958": [1, 1, 1], - "959": [1, 1, 1], - "962": [1, 1, 1], - "967": [0, 1, 1], - "968": [0, 2, 2], - "969": [0, 1, 1], - "970": [0, 1, 1], - "973": [1, 1, 1], - "974": [0, 1, 1], - "975": [0, 1, 1], - "978-curly": [0, 2, 2], - "978-droopy": [0, 2, 2], - "978-stretchy": [0, 1, 1], - "979": [1, 1, 1], - "981": [0, 1, 1], - "982": [0, 1, 1], - "982-three-segment": [0, 1, 1], - "987": [1, 1, 1], - "988": [0, 1, 1], - "993": [0, 1, 1], - "994": [0, 1, 1], - "995": [0, 1, 1], - "996": [0, 1, 1], - "997": [0, 1, 1], - "998": [0, 1, 1], - "999": [1, 1, 1], - "1000": [1, 1, 1], - "1001": [0, 1, 1], - "1003": [0, 1, 1], - "1004": [0, 1, 1], - "1006": [0, 2, 2], - "1007-apex-build": [0, 2, 2], - "1008-ultimate-mode": [1, 1, 1], - "2026": [0, 1, 1], - "2027": [0, 1, 1], - "2028": [0, 1, 1], - "2052": [0, 1, 1], - "2053": [0, 1, 1], - "2103": [0, 1, 1], - "4052": [0, 1, 1], - "4077": [0, 1, 1], - "4078": [0, 1, 1], - "4079": [0, 1, 1], - "4080": [2, 2, 2], - "4144": [0, 1, 1], - "4145": [0, 1, 1], - "4146": [0, 1, 1], - "4199": [2, 1, 1], - "4222": [0, 1, 1], - "4263": [0, 1, 1], - "4264": [0, 1, 1], - "4562": [0, 1, 1], - "6100": [0, 1, 1], - "6101": [0, 1, 1], - "6215": [0, 1, 1], - "6503": [0, 1, 1], - "6549": [0, 1, 1], - "6570": [0, 1, 1], - "6571": [0, 1, 1], - "6705": [0, 1, 1], - "6706": [0, 1, 1], - "6713": [0, 1, 1], - "female": { - "6215": [0, 1, 1] - } - } } } \ No newline at end of file diff --git a/public/images/pokemon/variant/exp/698.json b/public/images/pokemon/variant/exp/698.json deleted file mode 100644 index daf9b8c6f84..00000000000 --- a/public/images/pokemon/variant/exp/698.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "1": { - "cbaa84": "44827c", - "b3747e": "4b7465", - "eeffbf": "cdffb5", - "dcffb2": "8eeab9", - "ffbfca": "43bf8d", - "b7ffb2": "72d8ce", - "fff2b2": "9bffa9", - "85b4cc": "cf755d", - "a6e1ff": "efab87", - "101010": "101010", - "cacaca": "cacaca", - "537180": "b04f4b", - "2eaeec": "4dc796", - "1f75a0": "29988e", - "fdfdfd": "fdfdfd", - "d197a1": "d197a1", - "ffdce6": "ffdce6", - "217aa6": "7f99e1", - "30b2f2": "b5dcff", - "f9f9f9": "e6e3b4", - "c0c0c0": "d7cca0" - }, - "2": { - "cbaa84": "cc78db", - "b3747e": "c452a6", - "eeffbf": "ed9ff2", - "dcffb2": "d7bbf4", - "ffbfca": "faccff", - "b7ffb2": "dceeff", - "fff2b2": "eb88b9", - "85b4cc": "654a8a", - "a6e1ff": "936daa", - "101010": "101010", - "cacaca": "cacaca", - "537180": "392d65", - "2eaeec": "ad4e6e", - "1f75a0": "8d2656", - "fdfdfd": "fdfdfd", - "d197a1": "d197a1", - "ffdce6": "ffdce6", - "217aa6": "efaa51", - "30b2f2": "ffd169", - "f9f9f9": "373453", - "c0c0c0": "282747" - } -} \ No newline at end of file diff --git a/public/images/pokemon/variant/exp/703.json b/public/images/pokemon/variant/exp/703.json deleted file mode 100644 index c024feb1b30..00000000000 --- a/public/images/pokemon/variant/exp/703.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "1": { - "535763": "292638", - "306090": "c35b2a", - "c3c7d3": "68638e", - "88aacc": "e67c37", - "fefefe": "fefefe", - "a3a7b3": "4d496b", - "737783": "37344e", - "101010": "101010", - "bbddff": "ffa633", - "1fbfdf": "ff9b44", - "5f6060": "e6ac60", - "fcfefe": "ffeed6", - "bfbbbb": "ffd3a1" - }, - "2": { - "535763": "976ba9", - "306090": "a03c69", - "c3c7d3": "faecff", - "88aacc": "e25493", - "fefefe": "ffe2ee", - "a3a7b3": "e4cdf9", - "737783": "cca1db", - "101010": "101010", - "bbddff": "f591bd", - "1fbfdf": "de5f8e", - "5f6060": "5a3d84", - "fcfefe": "a473bf", - "bfbbbb": "8359a7" - } -} \ No newline at end of file diff --git a/public/images/pokemon/variant/exp/708.json b/public/images/pokemon/variant/exp/708.json deleted file mode 100644 index b32bbb79cd9..00000000000 --- a/public/images/pokemon/variant/exp/708.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "1": { - "101010": "101010", - "2b2a3a": "722023", - "603d2b": "36384f", - "215738": "4d362e", - "48484a": "a14743", - "c18760": "7c808c", - "3fa76c": "907f76", - "915e45": "575a6a", - "0b0c0b": "0b0c0b", - "da585b": "5996d2", - "ff8c8f": "87d1ff" - }, - "2": { - "101010": "101010", - "2b2a3a": "6f5f80", - "603d2b": "31161d", - "215738": "a94079", - "48484a": "9c92a4", - "c18760": "7e5658", - "3fa76c": "da7ea8", - "915e45": "56323a", - "0b0c0b": "0b0c0b", - "da585b": "e18933", - "ff8c8f": "ffc875" - } -} \ No newline at end of file diff --git a/public/images/pokemon/variant/exp/714.json b/public/images/pokemon/variant/exp/714.json deleted file mode 100644 index 018366c5381..00000000000 --- a/public/images/pokemon/variant/exp/714.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "1": { - "6a3f73": "731338", - "bd70cc": "a42c54", - "101010": "101010", - "bfacbf": "7047ba", - "8e5499": "8e1d4b", - "f2daf2": "8d7be3", - "404040": "202558", - "665c66": "2f386b", - "ccb43d": "ff8a58", - "f8f8f8": "8d7be3", - "595959": "2f386b", - "ffe14c": "ffc182", - "000000": "101010" - }, - "2": { - "6a3f73": "5f151c", - "bd70cc": "c24430", - "101010": "101010", - "bfacbf": "f9e8dd", - "8e5499": "882c27", - "f2daf2": "f8f8f8", - "404040": "5b1922", - "665c66": "7c2928", - "ccb43d": "33d8d0", - "f8f8f8": "f8f8f8", - "595959": "7c2928", - "ffe14c": "49ffcd", - "000000": "101010" - } -} \ No newline at end of file diff --git a/public/images/pokemon/variant/exp/back/698.json b/public/images/pokemon/variant/exp/back/698.json deleted file mode 100644 index af193c3bc0c..00000000000 --- a/public/images/pokemon/variant/exp/back/698.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "1": { - "b3747e": "4b7465", - "ffbfca": "43bf8d", - "fff2b2": "9bffa9", - "537180": "b04f4b", - "a6e1ff": "efab87", - "101010": "101010", - "85b4cc": "cf755d", - "217aa6": "7f99e1", - "30b2f2": "b5dcff", - "fdfdfd": "fdfdfd", - "c0c0c0": "d7cca0", - "cacaca": "cacaca", - "cbaa84": "44827c", - "dcffb2": "8eeab9", - "eeffbf": "cdffb5", - "b7ffb2": "72d8ce" - }, - "2": { - "b3747e": "c452a6", - "ffbfca": "faccff", - "fff2b2": "eb88b9", - "537180": "392d65", - "a6e1ff": "936daa", - "101010": "101010", - "85b4cc": "654a8a", - "217aa6": "efaa51", - "30b2f2": "ffd169", - "fdfdfd": "fdfdfd", - "c0c0c0": "282747", - "cacaca": "cacaca", - "cbaa84": "cc78db", - "dcffb2": "d7bbf4", - "eeffbf": "ed9ff2", - "b7ffb2": "dceeff" - } -} \ No newline at end of file diff --git a/public/images/pokemon/variant/exp/back/703.json b/public/images/pokemon/variant/exp/back/703.json deleted file mode 100644 index 376abd466d2..00000000000 --- a/public/images/pokemon/variant/exp/back/703.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "1": { - "306090": "c35b2a", - "88aacc": "e67c37", - "fefefe": "fefefe", - "535763": "292638", - "a3a7b3": "4d496b", - "737783": "37344e", - "bbddff": "ffa633", - "101010": "101010", - "5f6060": "e6ac60", - "bfbbbb": "ffd3a1", - "fcfefe": "ffeed6" - }, - "2": { - "306090": "a03c69", - "88aacc": "e25493", - "fefefe": "ffe2ee", - "535763": "976ba9", - "a3a7b3": "e4cdf9", - "737783": "cca1db", - "bbddff": "f591bd", - "101010": "101010", - "5f6060": "5a3d84", - "bfbbbb": "8359a7", - "fcfefe": "a473bf" - } -} \ No newline at end of file diff --git a/public/images/pokemon/variant/exp/back/708.json b/public/images/pokemon/variant/exp/back/708.json deleted file mode 100644 index 7d41d6d24b0..00000000000 --- a/public/images/pokemon/variant/exp/back/708.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "1": { - "1a1a1c": "1a1a1c", - "686665": "646085", - "103222": "802c26", - "221b17": "221b17", - "090606": "090606", - "4ab38e": "a14743", - "38956f": "a14743", - "ab9074": "7c808c", - "4e4e4e": "494e5b", - "917860": "7c808c", - "424244": "2b303c", - "78604c": "575a6a", - "6b5442": "40435a", - "5f4939": "36384f", - "4f2a09": "292929", - "6c4513": "36384f", - "353638": "353638" - }, - "2": { - "1a1a1c": "1a1a1c", - "686665": "ccc3cf", - "103222": "a94079", - "221b17": "221b17", - "090606": "090606", - "4ab38e": "da7ea8", - "38956f": "da7ea8", - "ab9074": "7e5658", - "4e4e4e": "9c92a4", - "917860": "7e5658", - "424244": "6f5f80", - "78604c": "56323a", - "6b5442": "47232b", - "5f4939": "31161d", - "4f2a09": "250e14", - "6c4513": "31161d", - "353638": "57496b" - } -} \ No newline at end of file diff --git a/public/images/pokemon/variant/exp/back/714.json b/public/images/pokemon/variant/exp/back/714.json deleted file mode 100644 index 22933e71338..00000000000 --- a/public/images/pokemon/variant/exp/back/714.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "1": { - "101010": "101010", - "6a3f73": "500a25", - "bd70cc": "a42c54", - "8e5499": "8e1d4b", - "404040": "202558", - "595959": "2f386b", - "bfacbf": "8d7be3", - "665c66": "2f386b", - "f2daf2": "8d7be3" - }, - "2": { - "101010": "101010", - "6a3f73": "5f151c", - "bd70cc": "c24430", - "8e5499": "882c27", - "404040": "5b1922", - "595959": "7c2928", - "bfacbf": "f9e8dd", - "665c66": "7c2928", - "f2daf2": "f9e8dd" - } -} \ No newline at end of file diff --git a/scripts/find_sprite_variant_mismatches.py b/scripts/find_sprite_variant_mismatches.py index 483695fdb66..b26058c2de3 100644 --- a/scripts/find_sprite_variant_mismatches.py +++ b/scripts/find_sprite_variant_mismatches.py @@ -22,6 +22,9 @@ from typing import Literal as L MASTERLIST_PATH = os.path.join( os.path.dirname(os.path.dirname(__file__)), "public", "images", "pokemon", "variant", "_masterlist.json" ) +EXP_MASTERLIST_PATH = os.path.join( + os.path.dirname(os.path.dirname(__file__)), "public", "images", "pokemon", "variant", "_exp_masterlist.json" +) DEFAULT_OUTPUT_PATH = "sprite-mismatches.csv" @@ -93,6 +96,7 @@ if __name__ == "__main__": help=f"The path to a file to save the output file. If not specified, will write to {DEFAULT_OUTPUT_PATH}.", ) p.add_argument("--masterlist", default=MASTERLIST_PATH, help=f"The path to the masterlist file to validate. Defaults to {MASTERLIST_PATH}.") + p.add_argument("--exp-masterlist", default=EXP_MASTERLIST_PATH, help=f"The path to the exp masterlist file to validate against. Defaults to {EXP_MASTERLIST_PATH}.") args = p.parse_args() mismatches = make_mismatch_sprite_list(args.masterlist) write_mismatch_csv(args.output, mismatches) diff --git a/src/battle-scene.ts b/src/battle-scene.ts index f676ba63306..acc8dafdd35 100644 --- a/src/battle-scene.ts +++ b/src/battle-scene.ts @@ -106,8 +106,8 @@ import PokemonInfoContainer from "#app/ui/pokemon-info-container"; import { biomeDepths, getBiomeName } from "#app/data/balance/biomes"; import { SceneBase } from "#app/scene-base"; import CandyBar from "#app/ui/candy-bar"; -import type { Variant, VariantSet } from "#app/data/variant"; -import { variantColorCache, variantData } from "#app/data/variant"; +import type { Variant } from "#app/sprites/variant"; +import { variantData, clearVariantData } from "#app/sprites/variant"; import type { Localizable } from "#app/interfaces/locales"; import Overrides from "#app/overrides"; import { InputsController } from "#app/inputs-controller"; @@ -170,6 +170,8 @@ import { StatusEffect } from "#enums/status-effect"; import { initGlobalScene } from "#app/global-scene"; import { ShowAbilityPhase } from "#app/phases/show-ability-phase"; import { HideAbilityPhase } from "#app/phases/hide-ability-phase"; +import { expSpriteKeys } from "./sprites/sprite-keys"; +import { hasExpSprite } from "./sprites/sprite-utils"; import { timedEventManager } from "./global-event-manager"; export const bypassLogin = import.meta.env.VITE_BYPASS_LOGIN === "1"; @@ -182,8 +184,6 @@ const OPP_IVS_OVERRIDE_VALIDATED: number[] = ( export const startingWave = Overrides.STARTING_WAVE_OVERRIDE || 1; -const expSpriteKeys: string[] = []; - export let starterColors: StarterColors; interface StarterColors { [key: string]: [string, string]; @@ -409,7 +409,7 @@ export default class BattleScene extends SceneBase { } const variant = atlasPath.includes("variant/") || /_[0-3]$/.test(atlasPath); if (experimental) { - experimental = this.hasExpSprite(key); + experimental = hasExpSprite(key); } if (variant) { atlasPath = atlasPath.replace("variant/", ""); @@ -421,35 +421,6 @@ export default class BattleScene extends SceneBase { ); } - /** - * Load the variant assets for the given sprite and stores them in {@linkcode variantColorCache} - */ - public async loadPokemonVariantAssets(spriteKey: string, fileRoot: string, variant?: Variant): Promise { - const useExpSprite = this.experimentalSprites && this.hasExpSprite(spriteKey); - if (useExpSprite) { - fileRoot = `exp/${fileRoot}`; - } - let variantConfig = variantData; - fileRoot.split("/").map(p => (variantConfig ? (variantConfig = variantConfig[p]) : null)); - const variantSet = variantConfig as VariantSet; - - return new Promise(resolve => { - if (variantSet && variant !== undefined && variantSet[variant] === 1) { - if (variantColorCache.hasOwnProperty(spriteKey)) { - return resolve(); - } - this.cachedFetch(`./images/pokemon/variant/${fileRoot}.json`) - .then(res => res.json()) - .then(c => { - variantColorCache[spriteKey] = c; - resolve(); - }); - } else { - resolve(); - } - }); - } - async preload() { if (DEBUG_RNG) { const originalRealInRange = Phaser.Math.RND.realInRange; @@ -783,53 +754,36 @@ export default class BattleScene extends SceneBase { } async initExpSprites(): Promise { - if (expSpriteKeys.length) { + if (expSpriteKeys.size > 0) { return; } this.cachedFetch("./exp-sprites.json") .then(res => res.json()) .then(keys => { if (Array.isArray(keys)) { - expSpriteKeys.push(...keys); + for (const key of keys) { + expSpriteKeys.add(key); + } } Promise.resolve(); }); } + /** + * Initialize the variant data. + * If experimental sprites are enabled, their entries are replaced via this method. + */ async initVariantData(): Promise { - for (const key of Object.keys(variantData)) { - delete variantData[key]; + clearVariantData(); + const otherVariantData = await this.cachedFetch("./images/pokemon/variant/_masterlist.json").then(r => r.json()); + for (const k of Object.keys(otherVariantData)) { + variantData[k] = otherVariantData[k]; } - await this.cachedFetch("./images/pokemon/variant/_masterlist.json") - .then(res => res.json()) - .then(v => { - for (const k of Object.keys(v)) { - variantData[k] = v[k]; - } - if (this.experimentalSprites) { - const expVariantData = variantData["exp"]; - const traverseVariantData = (keys: string[]) => { - let variantTree = variantData; - let expTree = expVariantData; - keys.map((k: string, i: number) => { - if (i < keys.length - 1) { - variantTree = variantTree[k]; - expTree = expTree[k]; - } else if (variantTree.hasOwnProperty(k) && expTree.hasOwnProperty(k)) { - if (["back", "female"].includes(k)) { - traverseVariantData(keys.concat(k)); - } else { - variantTree[k] = expTree[k]; - } - } - }); - }; - for (const ek of Object.keys(expVariantData)) { - traverseVariantData([ek]); - } - } - Promise.resolve(); - }); + if (!this.experimentalSprites) { + return; + } + const expVariantData = await this.cachedFetch("./images/pokemon/variant/_exp_masterlist.json").then(r => r.json()); + Utils.deepMergeObjects(variantData, expVariantData); } cachedFetch(url: string, init?: RequestInit): Promise { @@ -843,48 +797,15 @@ export default class BattleScene extends SceneBase { return fetch(url, init); } - initStarterColors(): Promise { - return new Promise(resolve => { - if (starterColors) { - return resolve(); - } - - this.cachedFetch("./starter-colors.json") - .then(res => res.json()) - .then(sc => { - starterColors = {}; - for (const key of Object.keys(sc)) { - starterColors[key] = sc[key]; - } - - resolve(); - }); - }); - } - - hasExpSprite(key: string): boolean { - const keyMatch = /^pkmn__?(back__)?(shiny__)?(female__)?(\d+)(\-.*?)?(?:_[1-3])?$/g.exec(key); - if (!keyMatch) { - return false; + async initStarterColors(): Promise { + if (starterColors) { + return; } - - let k = keyMatch[4]!; - if (keyMatch[2]) { - k += "s"; + const sc = await this.cachedFetch("./starter-colors.json").then(res => res.json()); + starterColors = {}; + for (const key of Object.keys(sc)) { + starterColors[key] = sc[key]; } - if (keyMatch[1]) { - k += "b"; - } - if (keyMatch[3]) { - k += "f"; - } - if (keyMatch[5]) { - k += keyMatch[5]; - } - if (!expSpriteKeys.includes(k)) { - return false; - } - return true; } public getPlayerParty(): PlayerPokemon[] { diff --git a/src/data/mystery-encounters/utils/encounter-phase-utils.ts b/src/data/mystery-encounters/utils/encounter-phase-utils.ts index 76d07bf01ba..f3a06242a13 100644 --- a/src/data/mystery-encounters/utils/encounter-phase-utils.ts +++ b/src/data/mystery-encounters/utils/encounter-phase-utils.ts @@ -58,7 +58,7 @@ import { BattleEndPhase } from "#app/phases/battle-end-phase"; import { GameOverPhase } from "#app/phases/game-over-phase"; import { SelectModifierPhase } from "#app/phases/select-modifier-phase"; import { PartyExpPhase } from "#app/phases/party-exp-phase"; -import type { Variant } from "#app/data/variant"; +import type { Variant } from "#app/sprites/variant"; import { StatusEffect } from "#enums/status-effect"; import { globalScene } from "#app/global-scene"; import { getPokemonSpecies } from "#app/data/pokemon-species"; diff --git a/src/data/pokemon-species.ts b/src/data/pokemon-species.ts index 929d632eb0b..a8942a39880 100644 --- a/src/data/pokemon-species.ts +++ b/src/data/pokemon-species.ts @@ -26,11 +26,12 @@ import { pokemonSpeciesLevelMoves, } from "#app/data/balance/pokemon-level-moves"; import type { Stat } from "#enums/stat"; -import type { Variant, VariantSet } from "#app/data/variant"; -import { variantData } from "#app/data/variant"; +import type { Variant, VariantSet } from "#app/sprites/variant"; +import { variantData } from "#app/sprites/variant"; import { speciesStarterCosts, POKERUS_STARTER_COUNT } from "#app/data/balance/starters"; import { SpeciesFormKey } from "#enums/species-form-key"; import { starterPassiveAbilities } from "#app/data/balance/passives"; +import { loadPokemonVariantAssets } from "#app/sprites/pokemon-sprite"; export enum Region { NORMAL, @@ -387,6 +388,7 @@ export abstract class PokemonSpeciesForm { return `${/_[1-3]$/.test(spriteId) ? "variant/" : ""}${spriteId}`; } + /** Compute the sprite ID of the pokemon form. */ getSpriteId(female: boolean, formIndex?: number, shiny?: boolean, variant = 0, back?: boolean): string { if (formIndex === undefined || this instanceof PokemonForm) { formIndex = this.formIndex; @@ -394,7 +396,9 @@ export abstract class PokemonSpeciesForm { const formSpriteKey = this.getFormSpriteKey(formIndex); const showGenderDiffs = - this.genderDiffs && female && ![SpeciesFormKey.MEGA, SpeciesFormKey.GIGANTAMAX].find(k => formSpriteKey === k); + this.genderDiffs && + female && + ![SpeciesFormKey.MEGA, SpeciesFormKey.GIGANTAMAX].includes(formSpriteKey as SpeciesFormKey); const baseSpriteKey = `${showGenderDiffs ? "female__" : ""}${this.speciesId}${formSpriteKey ? `-${formSpriteKey}` : ""}`; @@ -585,18 +589,19 @@ export abstract class PokemonSpeciesForm { return true; } - loadAssets( + async loadAssets( female: boolean, formIndex?: number, - shiny?: boolean, + shiny = false, variant?: Variant, - startLoad?: boolean, - back?: boolean, + startLoad = false, + back = false, ): Promise { - return new Promise(resolve => { - const spriteKey = this.getSpriteKey(female, formIndex, shiny, variant, back); - globalScene.loadPokemonAtlas(spriteKey, this.getSpriteAtlasPath(female, formIndex, shiny, variant, back)); - globalScene.load.audio(`${this.getCryKey(formIndex)}`, `audio/${this.getCryKey(formIndex)}.m4a`); + const spriteKey = this.getSpriteKey(female, formIndex, shiny, variant, back); + globalScene.loadPokemonAtlas(spriteKey, this.getSpriteAtlasPath(female, formIndex, shiny, variant, back)); + globalScene.load.audio(this.getCryKey(formIndex), `audio/${this.getCryKey(formIndex)}.m4a`); + + return new Promise(resolve => { globalScene.load.once(Phaser.Loader.Events.COMPLETE, () => { const originalWarn = console.warn; // Ignore warnings for missing frames, because there will be a lot @@ -621,7 +626,9 @@ export abstract class PokemonSpeciesForm { const spritePath = this.getSpriteAtlasPath(female, formIndex, shiny, variant, back) .replace("variant/", "") .replace(/_[1-3]$/, ""); - globalScene.loadPokemonVariantAssets(spriteKey, spritePath, variant).then(() => resolve()); + if (!Utils.isNullOrUndefined(variant)) { + loadPokemonVariantAssets(spriteKey, spritePath, variant).then(() => resolve()); + } }); if (startLoad) { if (!globalScene.load.isLoading()) { diff --git a/src/data/trainers/trainer-config.ts b/src/data/trainers/trainer-config.ts index a5ba19290fe..5fab70971ec 100644 --- a/src/data/trainers/trainer-config.ts +++ b/src/data/trainers/trainer-config.ts @@ -2236,12 +2236,7 @@ export const trainerConfigs: TrainerConfigs = { Species.PHANTUMP, Species.PUMPKABOO, ], - [TrainerPoolTier.RARE]: [ - Species.SNEASEL, - Species.LITWICK, - Species.PAWNIARD, - Species.NOIBAT, - ], + [TrainerPoolTier.RARE]: [Species.SNEASEL, Species.LITWICK, Species.PAWNIARD, Species.NOIBAT], [TrainerPoolTier.SUPER_RARE]: [Species.SLIGGOO, Species.HISUI_SLIGGOO, Species.HISUI_AVALUGG], }), [TrainerType.BRYONY]: new TrainerConfig(++t) diff --git a/src/data/variant.ts b/src/data/variant.ts deleted file mode 100644 index 13c11b0bb40..00000000000 --- a/src/data/variant.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { VariantTier } from "#app/enums/variant-tier"; - -export type Variant = 0 | 1 | 2; - -export type VariantSet = [Variant, Variant, Variant]; - -export const variantData: any = {}; - -export const variantColorCache = {}; - -export function getVariantTint(variant: Variant): number { - switch (variant) { - case 0: - return 0xf8c020; - case 1: - return 0x20f8f0; - case 2: - return 0xe81048; - } -} - -export function getVariantIcon(variant: Variant): number { - switch (variant) { - case 0: - return VariantTier.STANDARD; - case 1: - return VariantTier.RARE; - case 2: - return VariantTier.EPIC; - } -} diff --git a/src/field/anims.ts b/src/field/anims.ts index cd6209dddff..eb895c2d8f9 100644 --- a/src/field/anims.ts +++ b/src/field/anims.ts @@ -1,6 +1,6 @@ import { globalScene } from "#app/global-scene"; import { PokeballType } from "#enums/pokeball"; -import type { Variant } from "#app/data/variant"; +import type { Variant } from "#app/sprites/variant"; import { getFrameMs, randGauss } from "#app/utils"; export function addPokeballOpenParticles(x: number, y: number, pokeballType: PokeballType): void { diff --git a/src/field/mystery-encounter-intro.ts b/src/field/mystery-encounter-intro.ts index 649a969d415..e1fb0c37074 100644 --- a/src/field/mystery-encounter-intro.ts +++ b/src/field/mystery-encounter-intro.ts @@ -4,9 +4,10 @@ import type MysteryEncounter from "#app/data/mystery-encounters/mystery-encounte import type { Species } from "#enums/species"; import { isNullOrUndefined } from "#app/utils"; import { getSpriteKeysFromSpecies } from "#app/data/mystery-encounters/utils/encounter-pokemon-utils"; -import type { Variant } from "#app/data/variant"; +import type { Variant } from "#app/sprites/variant"; import { doShinySparkleAnim } from "#app/field/anims"; import PlayAnimationConfig = Phaser.Types.Animations.PlayAnimationConfig; +import { loadPokemonVariantAssets } from "#app/sprites/pokemon-sprite"; type KnownFileRoot = | "arenas" @@ -233,8 +234,8 @@ export default class MysteryEncounterIntroVisuals extends Phaser.GameObjects.Con this.spriteConfigs.forEach(config => { if (config.isPokemon) { globalScene.loadPokemonAtlas(config.spriteKey, config.fileRoot); - if (config.isShiny) { - shinyPromises.push(globalScene.loadPokemonVariantAssets(config.spriteKey, config.fileRoot, config.variant)); + if (config.isShiny && !isNullOrUndefined(config.variant)) { + shinyPromises.push(loadPokemonVariantAssets(config.spriteKey, config.fileRoot, config.variant)); } } else if (config.isItem) { globalScene.loadAtlas("items", ""); diff --git a/src/field/pokemon.ts b/src/field/pokemon.ts index 7d856696188..72da3f1ed6f 100644 --- a/src/field/pokemon.ts +++ b/src/field/pokemon.ts @@ -2,9 +2,9 @@ import Phaser from "phaser"; import type { AnySound } from "#app/battle-scene"; import type BattleScene from "#app/battle-scene"; import { globalScene } from "#app/global-scene"; -import type { Variant, VariantSet } from "#app/data/variant"; -import { variantColorCache } from "#app/data/variant"; -import { variantData } from "#app/data/variant"; +import type { Variant, VariantSet } from "#app/sprites/variant"; +import { populateVariantColors, variantColorCache } from "#app/sprites/variant"; +import { variantData } from "#app/sprites/variant"; import BattleInfo, { PlayerBattleInfo, EnemyBattleInfo, @@ -263,7 +263,9 @@ import { Nature } from "#enums/nature"; import { StatusEffect } from "#enums/status-effect"; import { doShinySparkleAnim } from "#app/field/anims"; import { MoveFlags } from "#enums/MoveFlags"; +import { hasExpSprite } from "#app/sprites/sprite-utils"; import { timedEventManager } from "#app/global-event-manager"; +import { loadMoveAnimations } from "#app/sprites/pokemon-asset-loader"; import { ResetStatusPhase } from "#app/phases/reset-status-phase"; export enum LearnMoveSituation { @@ -696,115 +698,79 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { abstract getBattlerIndex(): BattlerIndex; - loadAssets(ignoreOverride = true): Promise { - return new Promise(resolve => { - const moveIds = this.getMoveset().map(m => m.getMove().id); - Promise.allSettled(moveIds.map(m => initMoveAnim(m))).then(() => { - loadMoveAnimAssets(moveIds); - this.getSpeciesForm().loadAssets( - this.getGender() === Gender.FEMALE, - this.formIndex, - this.shiny, - this.variant, - ); - if (this.isPlayer() || this.getFusionSpeciesForm()) { - globalScene.loadPokemonAtlas( - this.getBattleSpriteKey(true, ignoreOverride), - this.getBattleSpriteAtlasPath(true, ignoreOverride), - ); - } - if (this.getFusionSpeciesForm()) { - this.getFusionSpeciesForm().loadAssets( - this.getFusionGender() === Gender.FEMALE, - this.fusionFormIndex, - this.fusionShiny, - this.fusionVariant, - ); - globalScene.loadPokemonAtlas( - this.getFusionBattleSpriteKey(true, ignoreOverride), - this.getFusionBattleSpriteAtlasPath(true, ignoreOverride), - ); - } - globalScene.load.once(Phaser.Loader.Events.COMPLETE, () => { - if (this.isPlayer()) { - const originalWarn = console.warn; - // Ignore warnings for missing frames, because there will be a lot - console.warn = () => {}; - const battleFrameNames = globalScene.anims.generateFrameNames( - this.getBattleSpriteKey(), - { zeroPad: 4, suffix: ".png", start: 1, end: 400 }, - ); - console.warn = originalWarn; - if (!globalScene.anims.exists(this.getBattleSpriteKey())) { - globalScene.anims.create({ - key: this.getBattleSpriteKey(), - frames: battleFrameNames, - frameRate: 10, - repeat: -1, - }); - } - } - this.playAnim(); - const updateFusionPaletteAndResolve = () => { - this.updateFusionPalette(); - if (this.summonData?.speciesForm) { - this.updateFusionPalette(true); - } - resolve(); - }; - if (this.shiny) { - const populateVariantColors = ( - isBackSprite = false, - ): Promise => { - return new Promise(async resolve => { - const battleSpritePath = this.getBattleSpriteAtlasPath( - isBackSprite, - ignoreOverride, - ) - .replace("variant/", "") - .replace(/_[1-3]$/, ""); - let config = variantData; - const useExpSprite = - globalScene.experimentalSprites && - globalScene.hasExpSprite( - this.getBattleSpriteKey(isBackSprite, ignoreOverride), - ); - battleSpritePath - .split("/") - .map(p => (config ? (config = config[p]) : null)); - const variantSet: VariantSet = config as VariantSet; - if (variantSet && variantSet[this.variant] === 1) { - const cacheKey = this.getBattleSpriteKey(isBackSprite); - if (!variantColorCache.hasOwnProperty(cacheKey)) { - await this.populateVariantColorCache( - cacheKey, - useExpSprite, - battleSpritePath, - ); - } - } - resolve(); - }); - }; - if (this.isPlayer()) { - Promise.all([ - populateVariantColors(false), - populateVariantColors(true), - ]).then(() => updateFusionPaletteAndResolve()); - } else { - populateVariantColors(false).then(() => - updateFusionPaletteAndResolve(), - ); - } - } else { - updateFusionPaletteAndResolve(); - } - }); - if (!globalScene.load.isLoading()) { - globalScene.load.start(); - } + async loadAssets(ignoreOverride = true): Promise { + /** Promises that are loading assets and can be run concurrently. */ + const loadPromises: Promise[] = []; + // Assets for moves + loadPromises.push(loadMoveAnimations(this.getMoveset().map(m => m.getMove().id))); + + // Load the assets for the species form + loadPromises.push( + this.getSpeciesForm().loadAssets(this.getGender() === Gender.FEMALE, this.formIndex, this.shiny, this.variant), + ); + + if (this.isPlayer() || this.getFusionSpeciesForm()) { + globalScene.loadPokemonAtlas( + this.getBattleSpriteKey(true, ignoreOverride), + this.getBattleSpriteAtlasPath(true, ignoreOverride), + ); + } + if (this.getFusionSpeciesForm()) { + loadPromises.push(this.getFusionSpeciesForm().loadAssets( + this.getFusionGender() === Gender.FEMALE, + this.fusionFormIndex, + this.fusionShiny, + this.fusionVariant, + )); + globalScene.loadPokemonAtlas( + this.getFusionBattleSpriteKey(true, ignoreOverride), + this.getFusionBattleSpriteAtlasPath(true, ignoreOverride), + ); + } + + if (this.shiny) { + loadPromises.push(populateVariantColors(this, false, ignoreOverride)) + if (this.isPlayer()) { + loadPromises.push(populateVariantColors(this, true, ignoreOverride)); + } + } + + await Promise.allSettled(loadPromises); + + // Wait for the assets we queued to load to finish loading, then... + if (!globalScene.load.isLoading()) { + globalScene.load.start(); + } + // See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Using_promises#creating_a_promise_around_an_old_callback_api + await new Promise(resolve => globalScene.load.once(Phaser.Loader.Events.COMPLETE, resolve)); + + // With the sprites loaded, generate the animation frame information + if (this.isPlayer()) { + const originalWarn = console.warn; + // Ignore warnings for missing frames, because there will be a lot + console.warn = () => {}; + const battleFrameNames = globalScene.anims.generateFrameNames(this.getBattleSpriteKey(), { + zeroPad: 4, + suffix: ".png", + start: 1, + end: 400, }); - }); + console.warn = originalWarn; + globalScene.anims.create({ + key: this.getBattleSpriteKey(), + frames: battleFrameNames, + frameRate: 10, + repeat: -1, + }); + } + // With everything loaded, now begin playing the animation. + this.playAnim(); + + // update the fusion palette + this.updateFusionPalette(); + if (this.summonData?.speciesForm) { + this.updateFusionPalette(true); + } } /** diff --git a/src/overrides.ts b/src/overrides.ts index 3a9a54e740b..21c72cd7b98 100644 --- a/src/overrides.ts +++ b/src/overrides.ts @@ -2,7 +2,7 @@ import { type PokeballCounts } from "#app/battle-scene"; import { EvolutionItem } from "#app/data/balance/pokemon-evolutions"; import { Gender } from "#app/data/gender"; import { FormChangeItem } from "#app/data/pokemon-forms"; -import { Variant } from "#app/data/variant"; +import { Variant } from "#app/sprites/variant"; import { type ModifierOverride } from "#app/modifier/modifier-type"; import { Unlockables } from "#app/system/unlockables"; import { Abilities } from "#enums/abilities"; diff --git a/src/pipelines/field-sprite.ts b/src/pipelines/field-sprite.ts index 547281d7dee..612c9fae052 100644 --- a/src/pipelines/field-sprite.ts +++ b/src/pipelines/field-sprite.ts @@ -1,210 +1,8 @@ import { globalScene } from "#app/global-scene"; import { TerrainType, getTerrainColor } from "../data/terrain"; import * as Utils from "../utils"; - -const spriteFragShader = ` -#ifdef GL_FRAGMENT_PRECISION_HIGH -precision highp float; -#else -precision mediump float; -#endif - -uniform sampler2D uMainSampler[%count%]; - -varying vec2 outTexCoord; -varying float outTexId; -varying float outTintEffect; -varying vec4 outTint; - -uniform float time; -uniform int ignoreTimeTint; -uniform int isOutside; -uniform vec3 dayTint; -uniform vec3 duskTint; -uniform vec3 nightTint; -uniform vec3 terrainColor; -uniform float terrainColorRatio; - -float blendOverlay(float base, float blend) { - return base<0.5?(2.0*base*blend):(1.0-2.0*(1.0-base)*(1.0-blend)); -} - -vec3 blendOverlay(vec3 base, vec3 blend) { - return vec3(blendOverlay(base.r,blend.r),blendOverlay(base.g,blend.g),blendOverlay(base.b,blend.b)); -} - -vec3 blendHardLight(vec3 base, vec3 blend) { - return blendOverlay(blend, base); -} - -float hue2rgb(float f1, float f2, float hue) { - if (hue < 0.0) - hue += 1.0; - else if (hue > 1.0) - hue -= 1.0; - float res; - if ((6.0 * hue) < 1.0) - res = f1 + (f2 - f1) * 6.0 * hue; - else if ((2.0 * hue) < 1.0) - res = f2; - else if ((3.0 * hue) < 2.0) - res = f1 + (f2 - f1) * ((2.0 / 3.0) - hue) * 6.0; - else - res = f1; - return res; -} - -vec3 rgb2hsl(vec3 color) { - vec3 hsl; - - float fmin = min(min(color.r, color.g), color.b); - float fmax = max(max(color.r, color.g), color.b); - float delta = fmax - fmin; - - hsl.z = (fmax + fmin) / 2.0; - - if (delta == 0.0) { - hsl.x = 0.0; - hsl.y = 0.0; - } else { - if (hsl.z < 0.5) - hsl.y = delta / (fmax + fmin); - else - hsl.y = delta / (2.0 - fmax - fmin); - - float deltaR = (((fmax - color.r) / 6.0) + (delta / 2.0)) / delta; - float deltaG = (((fmax - color.g) / 6.0) + (delta / 2.0)) / delta; - float deltaB = (((fmax - color.b) / 6.0) + (delta / 2.0)) / delta; - - if (color.r == fmax ) - hsl.x = deltaB - deltaG; - else if (color.g == fmax) - hsl.x = (1.0 / 3.0) + deltaR - deltaB; - else if (color.b == fmax) - hsl.x = (2.0 / 3.0) + deltaG - deltaR; - - if (hsl.x < 0.0) - hsl.x += 1.0; - else if (hsl.x > 1.0) - hsl.x -= 1.0; - } - - return hsl; -} - -vec3 hsl2rgb(vec3 hsl) { - vec3 rgb; - - if (hsl.y == 0.0) - rgb = vec3(hsl.z); - else { - float f2; - - if (hsl.z < 0.5) - f2 = hsl.z * (1.0 + hsl.y); - else - f2 = (hsl.z + hsl.y) - (hsl.y * hsl.z); - - float f1 = 2.0 * hsl.z - f2; - - rgb.r = hue2rgb(f1, f2, hsl.x + (1.0/3.0)); - rgb.g = hue2rgb(f1, f2, hsl.x); - rgb.b = hue2rgb(f1, f2, hsl.x - (1.0/3.0)); - } - - return rgb; -} - -vec3 blendHue(vec3 base, vec3 blend) { - vec3 baseHSL = rgb2hsl(base); - return hsl2rgb(vec3(rgb2hsl(blend).r, baseHSL.g, baseHSL.b)); -} - -void main() { - vec4 texture; - - %forloop% - - vec4 texel = vec4(outTint.bgr * outTint.a, outTint.a); - - // Multiply texture tint - vec4 color = texture * texel; - - if (outTintEffect == 1.0) { - // Solid color + texture alpha - color.rgb = mix(texture.rgb, outTint.bgr * outTint.a, texture.a); - } else if (outTintEffect == 2.0) { - // Solid color, no texture - color = texel; - } - - /* Apply day/night tint */ - if (color.a > 0.0 && ignoreTimeTint == 0) { - vec3 dayNightTint; - - if (time < 0.25) { - dayNightTint = dayTint; - } else if (isOutside == 0 && time < 0.5) { - dayNightTint = mix(dayTint, nightTint, (time - 0.25) / 0.25); - } else if (time < 0.375) { - dayNightTint = mix(dayTint, duskTint, (time - 0.25) / 0.125); - } else if (time < 0.5) { - dayNightTint = mix(duskTint, nightTint, (time - 0.375) / 0.125); - } else if (time < 0.75) { - dayNightTint = nightTint; - } else if (isOutside == 0) { - dayNightTint = mix(nightTint, dayTint, (time - 0.75) / 0.25); - } else if (time < 0.875) { - dayNightTint = mix(nightTint, duskTint, (time - 0.75) / 0.125); - } else { - dayNightTint = mix(duskTint, dayTint, (time - 0.875) / 0.125); - } - - color = vec4(blendHardLight(color.rgb, dayNightTint), color.a); - } - - if (terrainColorRatio > 0.0 && (1.0 - terrainColorRatio) < outTexCoord.y) { - if (color.a > 0.0 && (terrainColor.r > 0.0 || terrainColor.g > 0.0 || terrainColor.b > 0.0)) { - color.rgb = mix(color.rgb, blendHue(color.rgb, terrainColor), 1.0); - } - } - - gl_FragColor = color; -} -`; - -const spriteVertShader = ` -precision mediump float; - -uniform mat4 uProjectionMatrix; -uniform int uRoundPixels; -uniform vec2 uResolution; - -attribute vec2 inPosition; -attribute vec2 inTexCoord; -attribute float inTexId; -attribute float inTintEffect; -attribute vec4 inTint; - -varying vec2 outTexCoord; -varying float outTexId; -varying vec2 outPosition; -varying float outTintEffect; -varying vec4 outTint; - -void main() { - gl_Position = uProjectionMatrix * vec4(inPosition, 1.0, 1.0); - if (uRoundPixels == 1) - { - gl_Position.xy = floor(((gl_Position.xy + 1.0) * 0.5 * uResolution) + 0.5) / uResolution * 2.0 - 1.0; - } - outTexCoord = inTexCoord; - outTexId = inTexId; - outPosition = inPosition; - outTint = inTint; - outTintEffect = inTintEffect; -} -`; +import fieldSpriteFragShader from "./glsl/fieldSpriteFragShader.frag?raw"; +import spriteVertShader from "./glsl/spriteShader.vert?raw"; export default class FieldSpritePipeline extends Phaser.Renderer.WebGL.Pipelines.MultiPipeline { constructor(game: Phaser.Game, config?: Phaser.Types.Renderer.WebGL.WebGLPipelineConfig) { @@ -212,7 +10,7 @@ export default class FieldSpritePipeline extends Phaser.Renderer.WebGL.Pipelines config || { game: game, name: "field-sprite", - fragShader: spriteFragShader, + fragShader: fieldSpriteFragShader, vertShader: spriteVertShader, }, ); diff --git a/src/pipelines/glsl/fieldSpriteFragShader.frag b/src/pipelines/glsl/fieldSpriteFragShader.frag new file mode 100644 index 00000000000..e79dea86fe9 --- /dev/null +++ b/src/pipelines/glsl/fieldSpriteFragShader.frag @@ -0,0 +1,168 @@ +#ifdef GL_FRAGMENT_PRECISION_HIGH +precision highp float; +#else +precision mediump float; +#endif + +uniform sampler2D uMainSampler[%count%]; + +varying vec2 outTexCoord; +varying float outTexId; +varying float outTintEffect; +varying vec4 outTint; + +uniform float time; +uniform int ignoreTimeTint; +uniform int isOutside; +uniform vec3 dayTint; +uniform vec3 duskTint; +uniform vec3 nightTint; +uniform vec3 terrainColor; +uniform float terrainColorRatio; + +float blendOverlay(float base, float blend) { + return base<0.5?(2.0*base*blend):(1.0-2.0*(1.0-base)*(1.0-blend)); +} + +vec3 blendOverlay(vec3 base, vec3 blend) { + return vec3(blendOverlay(base.r,blend.r),blendOverlay(base.g,blend.g),blendOverlay(base.b,blend.b)); +} + +vec3 blendHardLight(vec3 base, vec3 blend) { + return blendOverlay(blend, base); +} + +float hue2rgb(float f1, float f2, float hue) { + if (hue < 0.0) + hue += 1.0; + else if (hue > 1.0) + hue -= 1.0; + float res; + if ((6.0 * hue) < 1.0) + res = f1 + (f2 - f1) * 6.0 * hue; + else if ((2.0 * hue) < 1.0) + res = f2; + else if ((3.0 * hue) < 2.0) + res = f1 + (f2 - f1) * ((2.0 / 3.0) - hue) * 6.0; + else + res = f1; + return res; +} + +vec3 rgb2hsl(vec3 color) { + vec3 hsl; + + float fmin = min(min(color.r, color.g), color.b); + float fmax = max(max(color.r, color.g), color.b); + float delta = fmax - fmin; + + hsl.z = (fmax + fmin) / 2.0; + + if (delta == 0.0) { + hsl.x = 0.0; + hsl.y = 0.0; + } else { + if (hsl.z < 0.5) + hsl.y = delta / (fmax + fmin); + else + hsl.y = delta / (2.0 - fmax - fmin); + + float deltaR = (((fmax - color.r) / 6.0) + (delta / 2.0)) / delta; + float deltaG = (((fmax - color.g) / 6.0) + (delta / 2.0)) / delta; + float deltaB = (((fmax - color.b) / 6.0) + (delta / 2.0)) / delta; + + if (color.r == fmax ) + hsl.x = deltaB - deltaG; + else if (color.g == fmax) + hsl.x = (1.0 / 3.0) + deltaR - deltaB; + else if (color.b == fmax) + hsl.x = (2.0 / 3.0) + deltaG - deltaR; + + if (hsl.x < 0.0) + hsl.x += 1.0; + else if (hsl.x > 1.0) + hsl.x -= 1.0; + } + + return hsl; +} + +vec3 hsl2rgb(vec3 hsl) { + vec3 rgb; + + if (hsl.y == 0.0) + rgb = vec3(hsl.z); + else { + float f2; + + if (hsl.z < 0.5) + f2 = hsl.z * (1.0 + hsl.y); + else + f2 = (hsl.z + hsl.y) - (hsl.y * hsl.z); + + float f1 = 2.0 * hsl.z - f2; + + rgb.r = hue2rgb(f1, f2, hsl.x + (1.0/3.0)); + rgb.g = hue2rgb(f1, f2, hsl.x); + rgb.b = hue2rgb(f1, f2, hsl.x - (1.0/3.0)); + } + + return rgb; +} + +vec3 blendHue(vec3 base, vec3 blend) { + vec3 baseHSL = rgb2hsl(base); + return hsl2rgb(vec3(rgb2hsl(blend).r, baseHSL.g, baseHSL.b)); +} + +void main() { + vec4 texture; + + %forloop% + + vec4 texel = vec4(outTint.bgr * outTint.a, outTint.a); + + // Multiply texture tint + vec4 color = texture * texel; + + if (outTintEffect == 1.0) { + // Solid color + texture alpha + color.rgb = mix(texture.rgb, outTint.bgr * outTint.a, texture.a); + } else if (outTintEffect == 2.0) { + // Solid color, no texture + color = texel; + } + + /* Apply day/night tint */ + if (color.a > 0.0 && ignoreTimeTint == 0) { + vec3 dayNightTint; + + if (time < 0.25) { + dayNightTint = dayTint; + } else if (isOutside == 0 && time < 0.5) { + dayNightTint = mix(dayTint, nightTint, (time - 0.25) / 0.25); + } else if (time < 0.375) { + dayNightTint = mix(dayTint, duskTint, (time - 0.25) / 0.125); + } else if (time < 0.5) { + dayNightTint = mix(duskTint, nightTint, (time - 0.375) / 0.125); + } else if (time < 0.75) { + dayNightTint = nightTint; + } else if (isOutside == 0) { + dayNightTint = mix(nightTint, dayTint, (time - 0.75) / 0.25); + } else if (time < 0.875) { + dayNightTint = mix(nightTint, duskTint, (time - 0.75) / 0.125); + } else { + dayNightTint = mix(duskTint, dayTint, (time - 0.875) / 0.125); + } + + color = vec4(blendHardLight(color.rgb, dayNightTint), color.a); + } + + if (terrainColorRatio > 0.0 && (1.0 - terrainColorRatio) < outTexCoord.y) { + if (color.a > 0.0 && (terrainColor.r > 0.0 || terrainColor.g > 0.0 || terrainColor.b > 0.0)) { + color.rgb = mix(color.rgb, blendHue(color.rgb, terrainColor), 1.0); + } + } + + gl_FragColor = color; +} \ No newline at end of file diff --git a/src/pipelines/glsl/invert.frag b/src/pipelines/glsl/invert.frag new file mode 100644 index 00000000000..24d9ee83a55 --- /dev/null +++ b/src/pipelines/glsl/invert.frag @@ -0,0 +1,10 @@ +precision mediump float; + +uniform sampler2D uMainSampler; + +varying vec2 outTexCoord; + +void main() +{ + gl_FragColor = 1.0 - texture2D(uMainSampler, outTexCoord); +} \ No newline at end of file diff --git a/src/pipelines/glsl/spriteFragShader.frag b/src/pipelines/glsl/spriteFragShader.frag new file mode 100644 index 00000000000..3765e595b70 --- /dev/null +++ b/src/pipelines/glsl/spriteFragShader.frag @@ -0,0 +1,279 @@ +#ifdef GL_FRAGMENT_PRECISION_HIGH +precision highp float; +#else +precision mediump float; +#endif + +uniform sampler2D uMainSampler[%count%]; + +varying vec2 outTexCoord; +varying float outTexId; +varying vec2 outPosition; +varying float outTintEffect; +varying vec4 outTint; + +uniform float time; +uniform int ignoreTimeTint; +uniform int isOutside; +uniform vec3 dayTint; +uniform vec3 duskTint; +uniform vec3 nightTint; +uniform float teraTime; +uniform vec3 teraColor; +uniform int hasShadow; +uniform int yCenter; +uniform float fieldScale; +uniform float vCutoff; +uniform vec2 relPosition; +uniform vec2 texFrameUv; +uniform vec2 size; +uniform vec2 texSize; +uniform float yOffset; +uniform float yShadowOffset; +uniform vec4 tone; +uniform ivec4 baseVariantColors[32]; +uniform vec4 variantColors[32]; +uniform ivec4 spriteColors[32]; +uniform ivec4 fusionSpriteColors[32]; + +const vec3 lumaF = vec3(.299, .587, .114); + +float blendOverlay(float base, float blend) { + return base<0.5?(2.0*base*blend):(1.0-2.0*(1.0-base)*(1.0-blend)); +} + +vec3 blendOverlay(vec3 base, vec3 blend) { + return vec3(blendOverlay(base.r,blend.r),blendOverlay(base.g,blend.g),blendOverlay(base.b,blend.b)); +} + +vec3 blendHardLight(vec3 base, vec3 blend) { + return blendOverlay(blend, base); +} + +float hue2rgb(float f1, float f2, float hue) { + if (hue < 0.0) + hue += 1.0; + else if (hue > 1.0) + hue -= 1.0; + float res; + if ((6.0 * hue) < 1.0) + res = f1 + (f2 - f1) * 6.0 * hue; + else if ((2.0 * hue) < 1.0) + res = f2; + else if ((3.0 * hue) < 2.0) + res = f1 + (f2 - f1) * ((2.0 / 3.0) - hue) * 6.0; + else + res = f1; + return res; +} + +vec3 rgb2hsl(vec3 color) { + vec3 hsl; + + float fmin = min(min(color.r, color.g), color.b); + float fmax = max(max(color.r, color.g), color.b); + float delta = fmax - fmin; + + hsl.z = (fmax + fmin) / 2.0; + + if (delta == 0.0) { + hsl.x = 0.0; + hsl.y = 0.0; + } else { + if (hsl.z < 0.5) + hsl.y = delta / (fmax + fmin); + else + hsl.y = delta / (2.0 - fmax - fmin); + + float deltaR = (((fmax - color.r) / 6.0) + (delta / 2.0)) / delta; + float deltaG = (((fmax - color.g) / 6.0) + (delta / 2.0)) / delta; + float deltaB = (((fmax - color.b) / 6.0) + (delta / 2.0)) / delta; + + if (color.r == fmax ) + hsl.x = deltaB - deltaG; + else if (color.g == fmax) + hsl.x = (1.0 / 3.0) + deltaR - deltaB; + else if (color.b == fmax) + hsl.x = (2.0 / 3.0) + deltaG - deltaR; + + if (hsl.x < 0.0) + hsl.x += 1.0; + else if (hsl.x > 1.0) + hsl.x -= 1.0; + } + + return hsl; +} + +vec3 hsl2rgb(vec3 hsl) { + vec3 rgb; + + if (hsl.y == 0.0) + rgb = vec3(hsl.z); + else { + float f2; + + if (hsl.z < 0.5) + f2 = hsl.z * (1.0 + hsl.y); + else + f2 = (hsl.z + hsl.y) - (hsl.y * hsl.z); + + float f1 = 2.0 * hsl.z - f2; + + rgb.r = hue2rgb(f1, f2, hsl.x + (1.0/3.0)); + rgb.g = hue2rgb(f1, f2, hsl.x); + rgb.b= hue2rgb(f1, f2, hsl.x - (1.0/3.0)); + } + + return rgb; +} + +vec3 blendHue(vec3 base, vec3 blend) { + vec3 baseHSL = rgb2hsl(base); + return hsl2rgb(vec3(rgb2hsl(blend).r, baseHSL.g, baseHSL.b)); +} + +vec3 rgb2hsv(vec3 c) { + vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0); + vec4 p = mix(vec4(c.bg, K.wz), vec4(c.gb, K.xy), step(c.b, c.g)); + vec4 q = mix(vec4(p.xyw, c.r), vec4(c.r, p.yzx), step(p.x, c.r)); + + float d = q.x - min(q.w, q.y); + float e = 1.0e-10; + return vec3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x); +} + +vec3 hsv2rgb(vec3 c) { + vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0); + vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www); + return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y); +} + +void main() { + vec4 texture = texture2D(uMainSampler[0], outTexCoord); + + ivec4 colorInt = ivec4(texture*255.0); + + for (int i = 0; i < 32; i++) { + if (baseVariantColors[i][3] == 0) + break; + // abs value is broken in this version of gles with highp + ivec3 diffs = ivec3( + (colorInt.r > baseVariantColors[i].r) ? colorInt.r - baseVariantColors[i].r : baseVariantColors[i].r - colorInt.r, + (colorInt.g > baseVariantColors[i].g) ? colorInt.g - baseVariantColors[i].g : baseVariantColors[i].g - colorInt.g, + (colorInt.b > baseVariantColors[i].b) ? colorInt.b - baseVariantColors[i].b : baseVariantColors[i].b - colorInt.b + ); + // Set color threshold to be within 3 points for each channel + bvec3 threshold = lessThan(diffs, ivec3(3)); + + if (texture.a > 0.0 && all(threshold)) { + texture.rgb = variantColors[i].rgb; + break; + } + } + + for (int i = 0; i < 32; i++) { + if (spriteColors[i][3] == 0) + break; + if (texture.a > 0.0 && colorInt.r == spriteColors[i].r && colorInt.g == spriteColors[i].g && colorInt.b == spriteColors[i].b) { + vec3 fusionColor = vec3(float(fusionSpriteColors[i].r) / 255.0, float(fusionSpriteColors[i].g) / 255.0, float(fusionSpriteColors[i].b) / 255.0); + vec3 bg = vec3(spriteColors[i].rgb) / 255.0; + float gray = (bg.r + bg.g + bg.b) / 3.0; + bg = vec3(gray, gray, gray); + vec3 fg = fusionColor; + texture.rgb = mix(1.0 - 2.0 * (1.0 - bg) * (1.0 - fg), 2.0 * bg * fg, step(bg, vec3(0.5))); + break; + } + } + + vec4 texel = vec4(outTint.bgr * outTint.a, outTint.a); + + // Multiply texture tint + vec4 color = texture * texel; + + if (color.a > 0.0 && teraColor.r > 0.0 && teraColor.g > 0.0 && teraColor.b > 0.0) { + vec2 relUv = vec2((outTexCoord.x - texFrameUv.x) / (size.x / texSize.x), (outTexCoord.y - texFrameUv.y) / (size.y / texSize.y)); + vec2 teraTexCoord = vec2(relUv.x * (size.x / 200.0), relUv.y * (size.y / 120.0)); + vec4 teraCol = texture2D(uMainSampler[1], teraTexCoord); + float floorValue = 86.0 / 255.0; + vec3 teraPatternHsv = rgb2hsv(teraCol.rgb); + teraCol.rgb = hsv2rgb(vec3((teraPatternHsv.b - floorValue) * 4.0 + teraTexCoord.x * fieldScale / 2.0 + teraTexCoord.y * fieldScale / 2.0 + teraTime * 255.0, teraPatternHsv.b, teraPatternHsv.b)); + + color.rgb = mix(color.rgb, blendHue(color.rgb, teraColor), 0.625); + teraCol.rgb = mix(teraCol.rgb, teraColor, 0.5); + color.rgb = blendOverlay(color.rgb, teraCol.rgb); + + if (any(lessThan(teraCol.rgb, vec3(1.0)))) { + vec3 teraColHsv = rgb2hsv(teraColor); + color.rgb = mix(color.rgb, teraColor, (1.0 - teraColHsv.g) / 2.0); + } + } + + if (outTintEffect == 1.0) { + // Solid color + texture alpha + color.rgb = mix(texture.rgb, outTint.bgr * outTint.a, texture.a); + } else if (outTintEffect == 2.0) { + // Solid color, no texture + color = texel; + } + + /* Apply gray */ + float luma = dot(color.rgb, lumaF); + color.rgb = mix(color.rgb, vec3(luma), tone.w); + + /* Apply tone */ + color.rgb += tone.rgb * (color.a / 255.0); + + /* Apply day/night tint */ + if (color.a > 0.0 && ignoreTimeTint == 0) { + vec3 dayNightTint; + + if (time < 0.25) { + dayNightTint = dayTint; + } else if (isOutside == 0 && time < 0.5) { + dayNightTint = mix(dayTint, nightTint, (time - 0.25) / 0.25); + } else if (time < 0.375) { + dayNightTint = mix(dayTint, duskTint, (time - 0.25) / 0.125); + } else if (time < 0.5) { + dayNightTint = mix(duskTint, nightTint, (time - 0.375) / 0.125); + } else if (time < 0.75) { + dayNightTint = nightTint; + } else if (isOutside == 0) { + dayNightTint = mix(nightTint, dayTint, (time - 0.75) / 0.25); + } else if (time < 0.875) { + dayNightTint = mix(nightTint, duskTint, (time - 0.75) / 0.125); + } else { + dayNightTint = mix(duskTint, dayTint, (time - 0.875) / 0.125); + } + + color.rgb = blendHardLight(color.rgb, dayNightTint); + } + + if (hasShadow == 1) { + float width = size.x - (yOffset / 2.0); + + float spriteX = ((floor(outPosition.x / fieldScale) - relPosition.x) / width) + 0.5; + float spriteY = ((floor(outPosition.y / fieldScale) - relPosition.y - yShadowOffset) / size.y); + + if (yCenter == 1) { + spriteY += 0.5; + } else { + spriteY += 1.0; + } + + bool yOverflow = outTexCoord.y >= vCutoff; + + if ((spriteY >= 0.9 && (color.a == 0.0 || yOverflow))) { + float shadowSpriteY = (spriteY - 0.9) * (1.0 / 0.15); + if (distance(vec2(spriteX, shadowSpriteY), vec2(0.5, 0.5)) < 0.5) { + color = vec4(vec3(0.0, 0.0, 0.0), 0.5); + } else if (yOverflow) { + discard; + } + } else if (yOverflow) { + discard; + } + } + + gl_FragColor = color; +} \ No newline at end of file diff --git a/src/pipelines/glsl/spriteShader.vert b/src/pipelines/glsl/spriteShader.vert new file mode 100644 index 00000000000..33743384b47 --- /dev/null +++ b/src/pipelines/glsl/spriteShader.vert @@ -0,0 +1,32 @@ +precision mediump float; + +uniform mat4 uProjectionMatrix; +uniform int uRoundPixels; +uniform vec2 uResolution; + +attribute vec2 inPosition; +attribute vec2 inTexCoord; +attribute float inTexId; +attribute float inTintEffect; +attribute vec4 inTint; + +varying vec2 outTexCoord; +varying vec2 outtexFrameUv; +varying float outTexId; +varying vec2 outPosition; +varying float outTintEffect; +varying vec4 outTint; + +void main() +{ + gl_Position = uProjectionMatrix * vec4(inPosition, 1.0, 1.0); + if (uRoundPixels == 1) + { + gl_Position.xy = floor(((gl_Position.xy + 1.0) * 0.5 * uResolution) + 0.5) / uResolution * 2.0 - 1.0; + } + outTexCoord = inTexCoord; + outTexId = inTexId; + outPosition = inPosition; + outTint = inTint; + outTintEffect = inTintEffect; +} \ No newline at end of file diff --git a/src/pipelines/invert.ts b/src/pipelines/invert.ts index a945d0c95aa..0ebc3ad865f 100644 --- a/src/pipelines/invert.ts +++ b/src/pipelines/invert.ts @@ -1,17 +1,5 @@ import type { Game } from "phaser"; - -const fragShader = ` -precision mediump float; - -uniform sampler2D uMainSampler; - -varying vec2 outTexCoord; - -void main() -{ - gl_FragColor = 1.0 - texture2D(uMainSampler, outTexCoord); -} -`; +import fragShader from "./glsl/invert.frag?raw"; export default class InvertPostFX extends Phaser.Renderer.WebGL.Pipelines.PostFXPipeline { constructor(game: Game) { diff --git a/src/pipelines/sprite.ts b/src/pipelines/sprite.ts index 439e35f711f..acbaac50476 100644 --- a/src/pipelines/sprite.ts +++ b/src/pipelines/sprite.ts @@ -1,318 +1,12 @@ -import { variantColorCache } from "#app/data/variant"; +import { variantColorCache } from "#app/sprites/variant"; import MysteryEncounterIntroVisuals from "#app/field/mystery-encounter-intro"; import Pokemon from "#app/field/pokemon"; import Trainer from "#app/field/trainer"; import { globalScene } from "#app/global-scene"; import * as Utils from "#app/utils"; import FieldSpritePipeline from "./field-sprite"; - -const spriteFragShader = ` -#ifdef GL_FRAGMENT_PRECISION_HIGH -precision highp float; -#else -precision mediump float; -#endif - -uniform sampler2D uMainSampler[%count%]; - -varying vec2 outTexCoord; -varying float outTexId; -varying vec2 outPosition; -varying float outTintEffect; -varying vec4 outTint; - -uniform float time; -uniform int ignoreTimeTint; -uniform int isOutside; -uniform vec3 dayTint; -uniform vec3 duskTint; -uniform vec3 nightTint; -uniform float teraTime; -uniform vec3 teraColor; -uniform int hasShadow; -uniform int yCenter; -uniform float fieldScale; -uniform float vCutoff; -uniform vec2 relPosition; -uniform vec2 texFrameUv; -uniform vec2 size; -uniform vec2 texSize; -uniform float yOffset; -uniform float yShadowOffset; -uniform vec4 tone; -uniform ivec4 baseVariantColors[32]; -uniform vec4 variantColors[32]; -uniform ivec4 spriteColors[32]; -uniform ivec4 fusionSpriteColors[32]; - -const vec3 lumaF = vec3(.299, .587, .114); - -float blendOverlay(float base, float blend) { - return base<0.5?(2.0*base*blend):(1.0-2.0*(1.0-base)*(1.0-blend)); -} - -vec3 blendOverlay(vec3 base, vec3 blend) { - return vec3(blendOverlay(base.r,blend.r),blendOverlay(base.g,blend.g),blendOverlay(base.b,blend.b)); -} - -vec3 blendHardLight(vec3 base, vec3 blend) { - return blendOverlay(blend, base); -} - -float hue2rgb(float f1, float f2, float hue) { - if (hue < 0.0) - hue += 1.0; - else if (hue > 1.0) - hue -= 1.0; - float res; - if ((6.0 * hue) < 1.0) - res = f1 + (f2 - f1) * 6.0 * hue; - else if ((2.0 * hue) < 1.0) - res = f2; - else if ((3.0 * hue) < 2.0) - res = f1 + (f2 - f1) * ((2.0 / 3.0) - hue) * 6.0; - else - res = f1; - return res; -} - -vec3 rgb2hsl(vec3 color) { - vec3 hsl; - - float fmin = min(min(color.r, color.g), color.b); - float fmax = max(max(color.r, color.g), color.b); - float delta = fmax - fmin; - - hsl.z = (fmax + fmin) / 2.0; - - if (delta == 0.0) { - hsl.x = 0.0; - hsl.y = 0.0; - } else { - if (hsl.z < 0.5) - hsl.y = delta / (fmax + fmin); - else - hsl.y = delta / (2.0 - fmax - fmin); - - float deltaR = (((fmax - color.r) / 6.0) + (delta / 2.0)) / delta; - float deltaG = (((fmax - color.g) / 6.0) + (delta / 2.0)) / delta; - float deltaB = (((fmax - color.b) / 6.0) + (delta / 2.0)) / delta; - - if (color.r == fmax ) - hsl.x = deltaB - deltaG; - else if (color.g == fmax) - hsl.x = (1.0 / 3.0) + deltaR - deltaB; - else if (color.b == fmax) - hsl.x = (2.0 / 3.0) + deltaG - deltaR; - - if (hsl.x < 0.0) - hsl.x += 1.0; - else if (hsl.x > 1.0) - hsl.x -= 1.0; - } - - return hsl; -} - -vec3 hsl2rgb(vec3 hsl) { - vec3 rgb; - - if (hsl.y == 0.0) - rgb = vec3(hsl.z); - else { - float f2; - - if (hsl.z < 0.5) - f2 = hsl.z * (1.0 + hsl.y); - else - f2 = (hsl.z + hsl.y) - (hsl.y * hsl.z); - - float f1 = 2.0 * hsl.z - f2; - - rgb.r = hue2rgb(f1, f2, hsl.x + (1.0/3.0)); - rgb.g = hue2rgb(f1, f2, hsl.x); - rgb.b= hue2rgb(f1, f2, hsl.x - (1.0/3.0)); - } - - return rgb; -} - -vec3 blendHue(vec3 base, vec3 blend) { - vec3 baseHSL = rgb2hsl(base); - return hsl2rgb(vec3(rgb2hsl(blend).r, baseHSL.g, baseHSL.b)); -} - -vec3 rgb2hsv(vec3 c) { - vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0); - vec4 p = mix(vec4(c.bg, K.wz), vec4(c.gb, K.xy), step(c.b, c.g)); - vec4 q = mix(vec4(p.xyw, c.r), vec4(c.r, p.yzx), step(p.x, c.r)); - - float d = q.x - min(q.w, q.y); - float e = 1.0e-10; - return vec3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x); -} - -vec3 hsv2rgb(vec3 c) { - vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0); - vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www); - return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y); -} - -void main() { - vec4 texture = texture2D(uMainSampler[0], outTexCoord); - - ivec4 colorInt = ivec4(int(texture.r * 255.0), int(texture.g * 255.0), int(texture.b * 255.0), int(texture.a * 255.0)); - - for (int i = 0; i < 32; i++) { - if (baseVariantColors[i][3] == 0) - break; - if (texture.a > 0.0 && colorInt.r == baseVariantColors[i].r && colorInt.g == baseVariantColors[i].g && colorInt.b == baseVariantColors[i].b) { - texture.rgb = variantColors[i].rgb; - break; - } - } - - for (int i = 0; i < 32; i++) { - if (spriteColors[i][3] == 0) - break; - if (texture.a > 0.0 && colorInt.r == spriteColors[i].r && colorInt.g == spriteColors[i].g && colorInt.b == spriteColors[i].b) { - vec3 fusionColor = vec3(float(fusionSpriteColors[i].r) / 255.0, float(fusionSpriteColors[i].g) / 255.0, float(fusionSpriteColors[i].b) / 255.0); - vec3 bg = vec3(float(spriteColors[i].r) / 255.0, float(spriteColors[i].g) / 255.0, float(spriteColors[i].b) / 255.0); - float gray = (bg.r + bg.g + bg.b) / 3.0; - bg = vec3(gray, gray, gray); - vec3 fg = fusionColor; - texture.rgb = mix(1.0 - 2.0 * (1.0 - bg) * (1.0 - fg), 2.0 * bg * fg, step(bg, vec3(0.5))); - break; - } - } - - vec4 texel = vec4(outTint.bgr * outTint.a, outTint.a); - - // Multiply texture tint - vec4 color = texture * texel; - - if (color.a > 0.0 && teraColor.r > 0.0 && teraColor.g > 0.0 && teraColor.b > 0.0) { - vec2 relUv = vec2((outTexCoord.x - texFrameUv.x) / (size.x / texSize.x), (outTexCoord.y - texFrameUv.y) / (size.y / texSize.y)); - vec2 teraTexCoord = vec2(relUv.x * (size.x / 200.0), relUv.y * (size.y / 120.0)); - vec4 teraCol = texture2D(uMainSampler[1], teraTexCoord); - float floorValue = 86.0 / 255.0; - vec3 teraPatternHsv = rgb2hsv(teraCol.rgb); - teraCol.rgb = hsv2rgb(vec3((teraPatternHsv.b - floorValue) * 4.0 + teraTexCoord.x * fieldScale / 2.0 + teraTexCoord.y * fieldScale / 2.0 + teraTime * 255.0, teraPatternHsv.b, teraPatternHsv.b)); - - color.rgb = mix(color.rgb, blendHue(color.rgb, teraColor), 0.625); - teraCol.rgb = mix(teraCol.rgb, teraColor, 0.5); - color.rgb = blendOverlay(color.rgb, teraCol.rgb); - - if (teraColor.r < 1.0 || teraColor.g < 1.0 || teraColor.b < 1.0) { - vec3 teraColHsv = rgb2hsv(teraColor); - color.rgb = mix(color.rgb, teraColor, (1.0 - teraColHsv.g) / 2.0); - } - } - - if (outTintEffect == 1.0) { - // Solid color + texture alpha - color.rgb = mix(texture.rgb, outTint.bgr * outTint.a, texture.a); - } else if (outTintEffect == 2.0) { - // Solid color, no texture - color = texel; - } - - /* Apply gray */ - float luma = dot(color.rgb, lumaF); - color.rgb = mix(color.rgb, vec3(luma), tone.w); - - /* Apply tone */ - color.rgb += tone.rgb * (color.a / 255.0); - - /* Apply day/night tint */ - if (color.a > 0.0 && ignoreTimeTint == 0) { - vec3 dayNightTint; - - if (time < 0.25) { - dayNightTint = dayTint; - } else if (isOutside == 0 && time < 0.5) { - dayNightTint = mix(dayTint, nightTint, (time - 0.25) / 0.25); - } else if (time < 0.375) { - dayNightTint = mix(dayTint, duskTint, (time - 0.25) / 0.125); - } else if (time < 0.5) { - dayNightTint = mix(duskTint, nightTint, (time - 0.375) / 0.125); - } else if (time < 0.75) { - dayNightTint = nightTint; - } else if (isOutside == 0) { - dayNightTint = mix(nightTint, dayTint, (time - 0.75) / 0.25); - } else if (time < 0.875) { - dayNightTint = mix(nightTint, duskTint, (time - 0.75) / 0.125); - } else { - dayNightTint = mix(duskTint, dayTint, (time - 0.875) / 0.125); - } - - color.rgb = blendHardLight(color.rgb, dayNightTint); - } - - if (hasShadow == 1) { - float width = size.x - (yOffset / 2.0); - - float spriteX = ((floor(outPosition.x / fieldScale) - relPosition.x) / width) + 0.5; - float spriteY = ((floor(outPosition.y / fieldScale) - relPosition.y - yShadowOffset) / size.y); - - if (yCenter == 1) { - spriteY += 0.5; - } else { - spriteY += 1.0; - } - - bool yOverflow = outTexCoord.y >= vCutoff; - - if ((spriteY >= 0.9 && (color.a == 0.0 || yOverflow))) { - float shadowSpriteY = (spriteY - 0.9) * (1.0 / 0.15); - if (distance(vec2(spriteX, shadowSpriteY), vec2(0.5, 0.5)) < 0.5) { - color = vec4(vec3(0.0, 0.0, 0.0), 0.5); - } else if (yOverflow) { - discard; - } - } else if (yOverflow) { - discard; - } - } - - gl_FragColor = color; -} -`; - -const spriteVertShader = ` -precision mediump float; - -uniform mat4 uProjectionMatrix; -uniform int uRoundPixels; -uniform vec2 uResolution; - -attribute vec2 inPosition; -attribute vec2 inTexCoord; -attribute float inTexId; -attribute float inTintEffect; -attribute vec4 inTint; - -varying vec2 outTexCoord; -varying vec2 outtexFrameUv; -varying float outTexId; -varying vec2 outPosition; -varying float outTintEffect; -varying vec4 outTint; - -void main() -{ - gl_Position = uProjectionMatrix * vec4(inPosition, 1.0, 1.0); - if (uRoundPixels == 1) - { - gl_Position.xy = floor(((gl_Position.xy + 1.0) * 0.5 * uResolution) + 0.5) / uResolution * 2.0 - 1.0; - } - outTexCoord = inTexCoord; - outTexId = inTexId; - outPosition = inPosition; - outTint = inTint; - outTintEffect = inTintEffect; -} -`; +import spriteFragShader from "./glsl/spriteFragShader.frag?raw"; +import spriteVertShader from "./glsl/spriteShader.vert?raw"; export default class SpritePipeline extends FieldSpritePipeline { private _tone: number[]; diff --git a/src/sprites/pokemon-asset-loader.ts b/src/sprites/pokemon-asset-loader.ts new file mode 100644 index 00000000000..4ce88f4f1fb --- /dev/null +++ b/src/sprites/pokemon-asset-loader.ts @@ -0,0 +1,11 @@ +import type { Moves } from "#enums/moves"; +import { initMoveAnim, loadMoveAnimAssets } from "#app/data/battle-anims"; + +/** + * Asynchronously load the animations and assets for the provided moves. + * @param moveIds - An array of move IDs to load assets for. + */ +export async function loadMoveAnimations(moveIds: Moves[]): Promise { + await Promise.allSettled(moveIds.map(m => initMoveAnim(m))); + await loadMoveAnimAssets(moveIds); +} diff --git a/src/sprites/pokemon-sprite.ts b/src/sprites/pokemon-sprite.ts new file mode 100644 index 00000000000..66432f5a4ea --- /dev/null +++ b/src/sprites/pokemon-sprite.ts @@ -0,0 +1,79 @@ +import { globalScene } from "#app/global-scene"; +import { variantColorCache, variantData } from "#app/sprites/variant"; +import { Gender } from "#app/data/gender"; +import { hasExpSprite } from "./sprite-utils"; +import type { Variant, VariantSet } from "#app/sprites/variant"; +import type Pokemon from "#app/field/pokemon"; +import type BattleScene from "#app/battle-scene"; + +// Regex patterns + +/** Regex matching double underscores */ +const DUNDER_REGEX = /\_{2}/g; + +/** + * Calculate the sprite ID from a pokemon form. + */ +export function getSpriteId(pokemon: Pokemon, ignoreOverride?: boolean): string { + return pokemon + .getSpeciesForm(ignoreOverride) + .getSpriteId( + pokemon.getGender(ignoreOverride) === Gender.FEMALE, + pokemon.formIndex, + pokemon.shiny, + pokemon.variant, + ); +} + +export function getBattleSpriteId(pokemon: Pokemon, back?: boolean, ignoreOverride = false): string { + if (back === undefined) { + back = pokemon.isPlayer(); + } + return pokemon + .getSpeciesForm(ignoreOverride) + .getSpriteId( + pokemon.getGender(ignoreOverride) === Gender.FEMALE, + pokemon.formIndex, + pokemon.shiny, + pokemon.variant, + back, + ); +} + +/** Compute the path to the sprite atlas by converting double underscores to path components (/) + */ +export function getSpriteAtlasPath(pokemon: Pokemon, ignoreOverride = false): string { + const spriteId = getSpriteId(pokemon, ignoreOverride).replace(DUNDER_REGEX, "/"); + return `${/_[1-3]$/.test(spriteId) ? "variant/" : ""}${spriteId}`; +} + +/** + * Load the variant assets for the given sprite and store it in {@linkcode variantColorCache}. + * @param spriteKey - The key of the sprite to load + * @param fileRoot - The root path of the sprite file + * @param variant - The variant to load + * @param scene - The scene to load the assets in (defaults to the global scene) + */ +export async function loadPokemonVariantAssets( + spriteKey: string, + fileRoot: string, + variant: Variant, + scene: BattleScene = globalScene, +): Promise { + if (variantColorCache.hasOwnProperty(spriteKey)) { + return; + } + const useExpSprite = scene.experimentalSprites && hasExpSprite(spriteKey); + if (useExpSprite) { + fileRoot = `exp/${fileRoot}`; + } + let variantConfig = variantData; + fileRoot.split("/").map(p => (variantConfig ? (variantConfig = variantConfig[p]) : null)); + const variantSet = variantConfig as VariantSet; + if (!variantConfig || variantSet[variant] !== 1) { + return; + } + variantColorCache[spriteKey] = await scene + .cachedFetch(`./images/pokemon/variant/${fileRoot}.json`) + .then(res => res.json()); +} diff --git a/src/sprites/sprite-keys.ts b/src/sprites/sprite-keys.ts new file mode 100644 index 00000000000..f023df089f6 --- /dev/null +++ b/src/sprites/sprite-keys.ts @@ -0,0 +1 @@ +export const expSpriteKeys: Set = new Set(); diff --git a/src/sprites/sprite-utils.ts b/src/sprites/sprite-utils.ts new file mode 100644 index 00000000000..8a352de3d55 --- /dev/null +++ b/src/sprites/sprite-utils.ts @@ -0,0 +1,28 @@ +import { expSpriteKeys } from "#app/sprites/sprite-keys"; + +const expKeyRegex = /^pkmn__?(back__)?(shiny__)?(female__)?(\d+)(\-.*?)?(?:_[1-3])?$/; + +export function hasExpSprite(key: string): boolean { + const keyMatch = expKeyRegex.exec(key); + if (!keyMatch) { + return false; + } + + let k = keyMatch[4]!; + if (keyMatch[2]) { + k += "s"; + } + if (keyMatch[1]) { + k += "b"; + } + if (keyMatch[3]) { + k += "f"; + } + if (keyMatch[5]) { + k += keyMatch[5]; + } + if (!expSpriteKeys.has(k)) { + return false; + } + return true; +} diff --git a/src/sprites/variant.ts b/src/sprites/variant.ts new file mode 100644 index 00000000000..7552f63b778 --- /dev/null +++ b/src/sprites/variant.ts @@ -0,0 +1,145 @@ +import { VariantTier } from "#app/enums/variant-tier"; +import { hasExpSprite } from "#app/sprites/sprite-utils"; +import { globalScene } from "#app/global-scene"; +import type Pokemon from "#app/field/pokemon"; +import { isNullOrUndefined } from "#app/utils"; + +export type Variant = 0 | 1 | 2; + +export type VariantSet = [Variant, Variant, Variant]; + +export const variantData: any = {}; + +/** Caches variant colors that have been generated */ +export const variantColorCache = {}; + +export function getVariantTint(variant: Variant): number { + switch (variant) { + case 0: + return 0xf8c020; + case 1: + return 0x20f8f0; + case 2: + return 0xe81048; + } +} + +export function getVariantIcon(variant: Variant): number { + switch (variant) { + case 0: + return VariantTier.STANDARD; + case 1: + return VariantTier.RARE; + case 2: + return VariantTier.EPIC; + } +} + +/** Delete all of the keys in variantData */ +export function clearVariantData(): void { + for (const key in variantData) { + delete variantData[key]; + } +} + +/** Update the variant data to use experiment sprite files for variants that have experimental sprites. */ +export async function mergeExperimentalData(mainData: any, expData: any): Promise { + if (!expData) { + return; + } + + for (const key of Object.keys(expData)) { + if (typeof expData[key] === "object" && !Array.isArray(expData[key])) { + // If the value is an object, recursively merge. + if (!mainData[key]) { + mainData[key] = {}; + } + mergeExperimentalData(mainData[key], expData[key]); + } else { + // Otherwise, replace the value + mainData[key] = expData[key]; + } + } +} + +/** + * Populate the variant color cache with the variant colors for this pokemon. + * The global scene must be initialized before this function is called. + */ +export async function populateVariantColors( + pokemon: Pokemon, + isBackSprite = false, + ignoreOverride = true, +): Promise { + const battleSpritePath = pokemon + .getBattleSpriteAtlasPath(isBackSprite, ignoreOverride) + .replace("variant/", "") + .replace(/_[1-3]$/, ""); + let config = variantData; + const useExpSprite = + globalScene.experimentalSprites && hasExpSprite(pokemon.getBattleSpriteKey(isBackSprite, ignoreOverride)); + battleSpritePath.split("/").map(p => (config ? (config = config[p]) : null)); + const variantSet: VariantSet = config as VariantSet; + if (!variantSet || variantSet[pokemon.variant] !== 1) { + return; + } + const cacheKey = pokemon.getBattleSpriteKey(isBackSprite); + if (!variantColorCache.hasOwnProperty(cacheKey)) { + await populateVariantColorCache(cacheKey, useExpSprite, battleSpritePath); + } +} + +/** + * Gracefully handle errors loading a variant sprite. Log if it fails and attempt to fall back on + * non-experimental sprites before giving up. + * + * @param cacheKey - The cache key for the variant color sprite + * @param attemptedSpritePath - The sprite path that failed to load + * @param useExpSprite - Was the attempted sprite experimental + * @param battleSpritePath - The filename of the sprite + * @param optionalParams - Any additional params to log + */ +async function fallbackVariantColor( + cacheKey: string, + attemptedSpritePath: string, + useExpSprite: boolean, + battleSpritePath: string, + ...optionalParams: any[] +): Promise { + console.warn(`Could not load ${attemptedSpritePath}!`, ...optionalParams); + if (useExpSprite) { + await populateVariantColorCache(cacheKey, false, battleSpritePath); + } +} + +/** + * Fetch a variant color sprite from the key and store it in the variant color cache. + * + * @param cacheKey - The cache key for the variant color sprite + * @param useExpSprite - Should the experimental sprite be used + * @param battleSpritePath - The filename of the sprite + */ +export async function populateVariantColorCache( + cacheKey: string, + useExpSprite: boolean, + battleSpritePath: string, +): Promise { + const spritePath = `./images/pokemon/variant/${useExpSprite ? "exp/" : ""}${battleSpritePath}.json`; + return globalScene + .cachedFetch(spritePath) + .then(res => { + // Prevent the JSON from processing if it failed to load + if (!res.ok) { + return fallbackVariantColor(cacheKey, res.url, useExpSprite, battleSpritePath, res.status, res.statusText); + } + return res.json(); + }) + .catch(error => { + return fallbackVariantColor(cacheKey, spritePath, useExpSprite, battleSpritePath, error); + }) + .then(c => { + if (!isNullOrUndefined(c)) { + variantColorCache[cacheKey] = c; + } + }); +} diff --git a/src/system/game-data.ts b/src/system/game-data.ts index 391ceec503d..061a6d3a194 100644 --- a/src/system/game-data.ts +++ b/src/system/game-data.ts @@ -32,7 +32,7 @@ import { Tutorial } from "#app/tutorial"; import { speciesEggMoves } from "#app/data/balance/egg-moves"; import { allMoves } from "#app/data/moves/move"; import { TrainerVariant } from "#app/field/trainer"; -import type { Variant } from "#app/data/variant"; +import type { Variant } from "#app/sprites/variant"; import { setSettingGamepad, SettingGamepad, settingGamepadDefaults } from "#app/system/settings/settings-gamepad"; import type { SettingKeyboard } from "#app/system/settings/settings-keyboard"; import { setSettingKeyboard } from "#app/system/settings/settings-keyboard"; diff --git a/src/system/pokemon-data.ts b/src/system/pokemon-data.ts index 957d43797a1..7cdcb0c72c3 100644 --- a/src/system/pokemon-data.ts +++ b/src/system/pokemon-data.ts @@ -7,7 +7,7 @@ import { getPokemonSpecies, getPokemonSpeciesForm } from "../data/pokemon-specie import { Status } from "../data/status-effect"; import Pokemon, { EnemyPokemon, PokemonMove, PokemonSummonData } from "../field/pokemon"; import { TrainerSlot } from "#enums/trainer-slot"; -import type { Variant } from "#app/data/variant"; +import type { Variant } from "#app/sprites/variant"; import { loadBattlerTag } from "../data/battler-tags"; import type { Biome } from "#enums/biome"; import { Moves } from "#enums/moves"; diff --git a/src/ui/battle-info.ts b/src/ui/battle-info.ts index 355ab9167a1..ab006269d4e 100644 --- a/src/ui/battle-info.ts +++ b/src/ui/battle-info.ts @@ -7,7 +7,7 @@ import { StatusEffect } from "#enums/status-effect"; import { globalScene } from "#app/global-scene"; import { getTypeRgb } from "#app/data/type"; import { PokemonType } from "#enums/pokemon-type"; -import { getVariantTint } from "#app/data/variant"; +import { getVariantTint } from "#app/sprites/variant"; import { Stat } from "#enums/stat"; import BattleFlyout from "./battle-flyout"; import { WindowVariant, addWindow } from "./ui-theme"; diff --git a/src/ui/hatched-pokemon-container.ts b/src/ui/hatched-pokemon-container.ts index 0b283c2e063..9d1c13e19d5 100644 --- a/src/ui/hatched-pokemon-container.ts +++ b/src/ui/hatched-pokemon-container.ts @@ -1,6 +1,6 @@ import type { EggHatchData } from "#app/data/egg-hatch-data"; import { Gender } from "#app/data/gender"; -import { getVariantTint } from "#app/data/variant"; +import { getVariantTint } from "#app/sprites/variant"; import { DexAttr } from "#app/system/game-data"; import { globalScene } from "#app/global-scene"; import type PokemonSpecies from "#app/data/pokemon-species"; diff --git a/src/ui/party-ui-handler.ts b/src/ui/party-ui-handler.ts index caddd64cd28..ebaccc515c1 100644 --- a/src/ui/party-ui-handler.ts +++ b/src/ui/party-ui-handler.ts @@ -18,7 +18,7 @@ import PokemonIconAnimHandler, { PokemonIconAnimMode } from "#app/ui/pokemon-ico import { pokemonEvolutions } from "#app/data/balance/pokemon-evolutions"; import { addWindow } from "#app/ui/ui-theme"; import { SpeciesFormChangeItemTrigger, FormChangeItem } from "#app/data/pokemon-forms"; -import { getVariantTint } from "#app/data/variant"; +import { getVariantTint } from "#app/sprites/variant"; import { Button } from "#enums/buttons"; import { applyChallenges, ChallengeType } from "#app/data/challenge"; import MoveInfoOverlay from "#app/ui/move-info-overlay"; diff --git a/src/ui/pokedex-mon-container.ts b/src/ui/pokedex-mon-container.ts index e61da86e95e..410effda40d 100644 --- a/src/ui/pokedex-mon-container.ts +++ b/src/ui/pokedex-mon-container.ts @@ -1,4 +1,4 @@ -import type { Variant } from "#app/data/variant"; +import type { Variant } from "#app/sprites/variant"; import { globalScene } from "#app/global-scene"; import { isNullOrUndefined } from "#app/utils"; import type PokemonSpecies from "../data/pokemon-species"; diff --git a/src/ui/pokedex-page-ui-handler.ts b/src/ui/pokedex-page-ui-handler.ts index 062b4c3797c..eede346f052 100644 --- a/src/ui/pokedex-page-ui-handler.ts +++ b/src/ui/pokedex-page-ui-handler.ts @@ -1,7 +1,7 @@ import type { SpeciesFormEvolution } from "#app/data/balance/pokemon-evolutions"; import { pokemonEvolutions, pokemonPrevolutions, pokemonStarters } from "#app/data/balance/pokemon-evolutions"; -import type { Variant } from "#app/data/variant"; -import { getVariantTint, getVariantIcon } from "#app/data/variant"; +import type { Variant } from "#app/sprites/variant"; +import { getVariantTint, getVariantIcon } from "#app/sprites/variant"; import { argbFromRgba } from "@material/material-color-utilities"; import i18next from "i18next"; import { starterColors } from "#app/battle-scene"; diff --git a/src/ui/pokedex-ui-handler.ts b/src/ui/pokedex-ui-handler.ts index 230b1bcb42b..59b06d476a2 100644 --- a/src/ui/pokedex-ui-handler.ts +++ b/src/ui/pokedex-ui-handler.ts @@ -1,5 +1,5 @@ -import type { Variant } from "#app/data/variant"; -import { getVariantTint, getVariantIcon } from "#app/data/variant"; +import type { Variant } from "#app/sprites/variant"; +import { getVariantTint, getVariantIcon } from "#app/sprites/variant"; import { argbFromRgba } from "@material/material-color-utilities"; import i18next from "i18next"; import { starterColors } from "#app/battle-scene"; diff --git a/src/ui/pokemon-info-container.ts b/src/ui/pokemon-info-container.ts index 56201f38748..1c880f6aec9 100644 --- a/src/ui/pokemon-info-container.ts +++ b/src/ui/pokemon-info-container.ts @@ -1,4 +1,4 @@ -import { getVariantTint } from "#app/data/variant"; +import { getVariantTint } from "#app/sprites/variant"; import type BBCodeText from "phaser3-rex-plugins/plugins/bbcodetext"; import { globalScene } from "#app/global-scene"; import { Gender, getGenderColor, getGenderSymbol } from "../data/gender"; diff --git a/src/ui/run-info-ui-handler.ts b/src/ui/run-info-ui-handler.ts index 364cb8e4003..8719950381a 100644 --- a/src/ui/run-info-ui-handler.ts +++ b/src/ui/run-info-ui-handler.ts @@ -18,7 +18,7 @@ import { getTypeRgb } from "#app/data/type"; import { PokemonType } from "#enums/pokemon-type"; import { TypeColor, TypeShadow } from "#app/enums/color"; import { getNatureStatMultiplier, getNatureName } from "../data/nature"; -import { getVariantTint } from "#app/data/variant"; +import { getVariantTint } from "#app/sprites/variant"; import * as Modifier from "../modifier/modifier"; import type { Species } from "#enums/species"; import { PlayerGender } from "#enums/player-gender"; diff --git a/src/ui/starter-select-ui-handler.ts b/src/ui/starter-select-ui-handler.ts index 1e84b367791..3876f2585db 100644 --- a/src/ui/starter-select-ui-handler.ts +++ b/src/ui/starter-select-ui-handler.ts @@ -1,8 +1,8 @@ import type { CandyUpgradeNotificationChangedEvent } from "#app/events/battle-scene"; import { BattleSceneEventType } from "#app/events/battle-scene"; import { pokemonPrevolutions } from "#app/data/balance/pokemon-evolutions"; -import type { Variant } from "#app/data/variant"; -import { getVariantTint, getVariantIcon } from "#app/data/variant"; +import type { Variant } from "#app/sprites/variant"; +import { getVariantTint, getVariantIcon } from "#app/sprites/variant"; import { argbFromRgba } from "@material/material-color-utilities"; import i18next from "i18next"; import type BBCodeText from "phaser3-rex-plugins/plugins/bbcodetext"; diff --git a/src/ui/summary-ui-handler.ts b/src/ui/summary-ui-handler.ts index 9b209ded57a..aa3d014bd95 100644 --- a/src/ui/summary-ui-handler.ts +++ b/src/ui/summary-ui-handler.ts @@ -19,8 +19,8 @@ import { StatusEffect } from "#enums/status-effect"; import { getBiomeName } from "#app/data/balance/biomes"; import { getNatureName, getNatureStatMultiplier } from "#app/data/nature"; import { loggedInUser } from "#app/account"; -import type { Variant } from "#app/data/variant"; -import { getVariantTint } from "#app/data/variant"; +import type { Variant } from "#app/sprites/variant"; +import { getVariantTint } from "#app/sprites/variant"; import { Button } from "#enums/buttons"; import type { Ability } from "#app/data/ability"; import i18next from "i18next"; diff --git a/src/utils.ts b/src/utils.ts index 4092b68b405..2f05e2724ff 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -613,3 +613,25 @@ export function animationFileName(move: Moves): string { export function camelCaseToKebabCase(str: string): string { return str.replace(/[A-Z]+(?![a-z])|[A-Z]/g, (s, o) => (o ? "-" : "") + s.toLowerCase()); } + +/** + * Merges the two objects, such that for each property in `b` that matches a property in `a`, + * the value in `a` is replaced by the value in `b`. This is done recursively if the property is a non-array object + * + * If the property does not exist in `a` or its `typeof` evaluates differently, the property is skipped. + * If the value of the property is an array, the array is replaced. If it is any other object, the object is merged recursively. + */ +// biome-ignore lint/complexity/noBannedTypes: This function is designed to merge json objects +export function deepMergeObjects(a: Object, b: Object) { + for (const key in b) { + // !(key in a) is redundant here, yet makes it clear that we're explicitly interested in properties that exist in `a` + if (!(key in a) || typeof a[key] !== typeof b[key]) { + continue; + } + if (typeof b[key] === "object" && !Array.isArray(b[key])) { + deepMergeObjects(a[key], b[key]); + } else { + a[key] = b[key]; + } + } +} diff --git a/test/sprites/pokemonSprite.test.ts b/test/sprites/pokemonSprite.test.ts index 5bd08a58cda..a008b75b42e 100644 --- a/test/sprites/pokemonSprite.test.ts +++ b/test/sprites/pokemonSprite.test.ts @@ -3,8 +3,10 @@ import fs from "fs"; import path from "path"; import { beforeAll, describe, expect, it } from "vitest"; import _masterlist from "../../public/images/pokemon/variant/_masterlist.json"; +import _exp_masterlist from "../../public/images/pokemon/variant/_exp_masterlist.json"; type PokemonVariantMasterlist = typeof _masterlist; +type PokemonExpVariantMasterlist = typeof _exp_masterlist; const deepCopy = (data: any) => { return JSON.parse(JSON.stringify(data)); @@ -12,7 +14,7 @@ const deepCopy = (data: any) => { describe("check if every variant's sprite are correctly set", () => { let masterlist: PokemonVariantMasterlist; - let expVariant: PokemonVariantMasterlist["exp"]; + let expVariant: PokemonExpVariantMasterlist; let femaleVariant: PokemonVariantMasterlist["female"]; let backVariant: PokemonVariantMasterlist["back"]; let rootDir: string; @@ -20,13 +22,12 @@ describe("check if every variant's sprite are correctly set", () => { beforeAll(() => { rootDir = `${getAppRootDir()}${path.sep}public${path.sep}images${path.sep}pokemon${path.sep}variant${path.sep}`; masterlist = deepCopy(_masterlist); - expVariant = masterlist.exp; + expVariant = deepCopy(_exp_masterlist); femaleVariant = masterlist.female; backVariant = masterlist.back; - //@ts-ignore - delete masterlist.exp; //TODO: resolve ts-ignore - //@ts-ignore - delete masterlist.female; //TODO: resolve ts-ignore + + // @ts-ignore + delete masterlist.female; // TODO: resolve ts-ignore //@ts-ignore delete masterlist.back; //TODO: resolve ts-ignore }); diff --git a/test/testUtils/helpers/overridesHelper.ts b/test/testUtils/helpers/overridesHelper.ts index 9bb0369a31a..0ed1511255b 100644 --- a/test/testUtils/helpers/overridesHelper.ts +++ b/test/testUtils/helpers/overridesHelper.ts @@ -1,4 +1,4 @@ -import type { Variant } from "#app/data/variant"; +import type { Variant } from "#app/sprites/variant"; import { Weather } from "#app/data/weather"; import { Abilities } from "#app/enums/abilities"; import type { ModifierOverride } from "#app/modifier/modifier-type";