Merge branch 'beta' into pokedex-tests

This commit is contained in:
Wlowscha 2025-04-13 13:56:29 +02:00 committed by GitHub
commit 928ad1800d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
127 changed files with 3516 additions and 3063 deletions

View File

@ -65,7 +65,8 @@
"useDefaultParameterLast": "off", // TODO: Fix spots in the codebase where this flag would be triggered, and then enable
"useSingleVarDeclarator": "off",
"useNodejsImportProtocol": "off",
"useTemplate": "off" // string concatenation is faster: https://stackoverflow.com/questions/29055518/are-es6-template-literals-faster-than-string-concatenation
"useTemplate": "off", // string concatenation is faster: https://stackoverflow.com/questions/29055518/are-es6-template-literals-faster-than-string-concatenation
"noNamespaceImport": "error"
},
"suspicious": {
"noDoubleEquals": "error",
@ -99,6 +100,9 @@
"rules": {
"performance": {
"noDelete": "off"
},
"style": {
"noNamespaceImport": "off"
}
}
}

View File

@ -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]
}
}
}

View File

@ -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]
}
}
}
}

View File

@ -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"
}
}

View File

@ -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"
}
}

View File

@ -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"
}
}

View File

@ -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"
}
}

View File

@ -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"
}
}

View File

@ -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"
}
}

View File

@ -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"
}
}

View File

@ -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"
}
}

View File

@ -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)

View File

@ -1,11 +1,11 @@
import { pokerogueApi } from "#app/plugins/api/pokerogue-api";
import type { UserInfo } from "#app/@types/UserInfo";
import { bypassLogin } from "./battle-scene";
import * as Utils from "./utils";
import { bypassLogin } from "#app/battle-scene";
import { randomString } from "#app/utils";
export let loggedInUser: UserInfo | null = null;
// This is a random string that is used to identify the client session - unique per session (tab or window) so that the game will only save on the one that the server is expecting
export const clientSessionId = Utils.randomString(32);
export const clientSessionId = randomString(32);
export function initLoggedInUser(): void {
loggedInUser = {

View File

@ -5,9 +5,20 @@ import { EnemyPokemon, PlayerPokemon } from "#app/field/pokemon";
import type { PokemonSpeciesFilter } from "#app/data/pokemon-species";
import type PokemonSpecies from "#app/data/pokemon-species";
import { allSpecies, getPokemonSpecies } from "#app/data/pokemon-species";
import type { Constructor } from "#app/utils";
import { isNullOrUndefined, randSeedInt } from "#app/utils";
import * as Utils from "#app/utils";
import {
fixedInt,
deepMergeObjects,
getIvsFromId,
randSeedInt,
getEnumValues,
randomString,
NumberHolder,
shiftCharCodes,
formatMoney,
isNullOrUndefined,
BooleanHolder,
type Constructor,
} from "#app/utils";
import type { Modifier, ModifierPredicate, TurnHeldItemTransferModifier } from "./modifier/modifier";
import {
ConsumableModifier,
@ -106,8 +117,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 +181,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 +195,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 +420,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 +432,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<void> {
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<void>(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;
@ -762,7 +744,7 @@ export default class BattleScene extends SceneBase {
}
this.playTimeTimer = this.time.addEvent({
delay: Utils.fixedInt(1000),
delay: fixedInt(1000),
repeat: -1,
callback: () => {
if (this.gameData) {
@ -783,53 +765,36 @@ export default class BattleScene extends SceneBase {
}
async initExpSprites(): Promise<void> {
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<void> {
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());
deepMergeObjects(variantData, expVariantData);
}
cachedFetch(url: string, init?: RequestInit): Promise<Response> {
@ -843,48 +808,15 @@ export default class BattleScene extends SceneBase {
return fetch(url, init);
}
initStarterColors(): Promise<void> {
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<void> {
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[] {
@ -1067,7 +999,7 @@ export default class BattleScene extends SceneBase {
}
if (boss && !dataSource) {
const secondaryIvs = Utils.getIvsFromId(Utils.randSeedInt(4294967296));
const secondaryIvs = getIvsFromId(randSeedInt(4294967296));
for (let s = 0; s < pokemon.ivs.length; s++) {
pokemon.ivs[s] = Math.round(
@ -1140,7 +1072,7 @@ export default class BattleScene extends SceneBase {
container.add(icon);
if (pokemon.isFusion()) {
if (pokemon.isFusion(true)) {
const fusionIcon = this.add.sprite(0, 0, pokemon.getFusionIconAtlasKey(ignoreOverride));
fusionIcon.setName("sprite-fusion-icon");
fusionIcon.setOrigin(0.5, 0);
@ -1226,7 +1158,7 @@ export default class BattleScene extends SceneBase {
* Generates a random number using the current battle's seed
*
* This calls {@linkcode Battle.randSeedInt}({@linkcode range}, {@linkcode min}) in `src/battle.ts`
* which calls {@linkcode Utils.randSeedInt randSeedInt}({@linkcode range}, {@linkcode min}) in `src/utils.ts`
* which calls {@linkcode randSeedInt randSeedInt}({@linkcode range}, {@linkcode min}) in `src/utils.ts`
*
* @param range How large of a range of random numbers to choose from. If {@linkcode range} <= 1, returns {@linkcode min}
* @param min The minimum integer to pick, default `0`
@ -1251,7 +1183,7 @@ export default class BattleScene extends SceneBase {
this.lockModifierTiers = false;
this.pokeballCounts = Object.fromEntries(
Utils.getEnumValues(PokeballType)
getEnumValues(PokeballType)
.filter(p => p <= PokeballType.MASTER_BALL)
.map(t => [t, 0]),
);
@ -1283,7 +1215,7 @@ export default class BattleScene extends SceneBase {
// Reset RNG after end of game or save & quit.
// This needs to happen after clearing this.currentBattle or the seed will be affected by the last wave played
this.setSeed(Overrides.SEED_OVERRIDE || Utils.randomString(24));
this.setSeed(Overrides.SEED_OVERRIDE || randomString(24));
console.log("Seed:", this.seed);
this.resetSeed();
@ -1324,7 +1256,7 @@ export default class BattleScene extends SceneBase {
...allSpecies,
...allMoves,
...allAbilities,
...Utils.getEnumValues(ModifierPoolType)
...getEnumValues(ModifierPoolType)
.map(mpt => getModifierPoolForType(mpt))
.flatMap(mp =>
Object.values(mp)
@ -1364,7 +1296,7 @@ export default class BattleScene extends SceneBase {
}
getDoubleBattleChance(newWaveIndex: number, playerField: PlayerPokemon[]) {
const doubleChance = new Utils.NumberHolder(newWaveIndex % 10 === 0 ? 32 : 8);
const doubleChance = new NumberHolder(newWaveIndex % 10 === 0 ? 32 : 8);
this.applyModifiers(DoubleBattleChanceBoosterModifier, true, doubleChance);
for (const p of playerField) {
applyAbAttrs(DoubleBattleChanceAbAttr, p, null, false, doubleChance);
@ -1421,7 +1353,7 @@ export default class BattleScene extends SceneBase {
if (trainerConfigs[trainerType].doubleOnly) {
doubleTrainer = true;
} else if (trainerConfigs[trainerType].hasDouble) {
doubleTrainer = !Utils.randSeedInt(this.getDoubleBattleChance(newWaveIndex, playerField));
doubleTrainer = !randSeedInt(this.getDoubleBattleChance(newWaveIndex, playerField));
// Add a check that special trainers can't be double except for tate and liza - they should use the normal double chance
if (
trainerConfigs[trainerType].trainerTypeDouble &&
@ -1432,7 +1364,7 @@ export default class BattleScene extends SceneBase {
}
const variant = doubleTrainer
? TrainerVariant.DOUBLE
: Utils.randSeedInt(2)
: randSeedInt(2)
? TrainerVariant.FEMALE
: TrainerVariant.DEFAULT;
newTrainer = trainerData !== undefined ? trainerData.toTrainer() : new Trainer(trainerType, variant);
@ -1450,7 +1382,7 @@ export default class BattleScene extends SceneBase {
if (double === undefined && newWaveIndex > 1) {
if (newBattleType === BattleType.WILD && !this.gameMode.isWaveFinal(newWaveIndex)) {
newDouble = !Utils.randSeedInt(this.getDoubleBattleChance(newWaveIndex, playerField));
newDouble = !randSeedInt(this.getDoubleBattleChance(newWaveIndex, playerField));
} else if (newBattleType === BattleType.TRAINER) {
newDouble = newTrainer?.variant === TrainerVariant.DOUBLE;
}
@ -1638,7 +1570,7 @@ export default class BattleScene extends SceneBase {
scale: scale,
x: (defaultWidth - scaledWidth) / 2,
y: defaultHeight - scaledHeight,
duration: !instant ? Utils.fixedInt(Math.abs(this.field.scale - scale) * 200) : 0,
duration: !instant ? fixedInt(Math.abs(this.field.scale - scale) * 200) : 0,
ease: "Sine.easeInOut",
onComplete: () => resolve(),
});
@ -1735,12 +1667,12 @@ export default class BattleScene extends SceneBase {
case Species.SQUAWKABILLY:
case Species.TATSUGIRI:
case Species.PALDEA_TAUROS:
return Utils.randSeedInt(species.forms.length);
return randSeedInt(species.forms.length);
case Species.PIKACHU:
if (this.currentBattle?.battleType === BattleType.TRAINER && this.currentBattle?.waveIndex < 30) {
return 0; // Ban Cosplay and Partner Pika from Trainers before wave 30
}
return Utils.randSeedInt(8);
return randSeedInt(8);
case Species.EEVEE:
if (
this.currentBattle?.battleType === BattleType.TRAINER &&
@ -1749,22 +1681,22 @@ export default class BattleScene extends SceneBase {
) {
return 0; // No Partner Eevee for Wave 12 Preschoolers
}
return Utils.randSeedInt(2);
return randSeedInt(2);
case Species.FROAKIE:
case Species.FROGADIER:
case Species.GRENINJA:
if (this.currentBattle?.battleType === BattleType.TRAINER && !isEggPhase) {
return 0; // Don't give trainers Battle Bond Greninja, Froakie or Frogadier
}
return Utils.randSeedInt(2);
return randSeedInt(2);
case Species.URSHIFU:
return Utils.randSeedInt(2);
return randSeedInt(2);
case Species.ZYGARDE:
return Utils.randSeedInt(4);
return randSeedInt(4);
case Species.MINIOR:
return Utils.randSeedInt(7);
return randSeedInt(7);
case Species.ALCREMIE:
return Utils.randSeedInt(9);
return randSeedInt(9);
case Species.MEOWSTIC:
case Species.INDEEDEE:
case Species.BASCULEGION:
@ -1795,7 +1727,7 @@ export default class BattleScene extends SceneBase {
if (this.gameMode.hasMysteryEncounters && !isEggPhase) {
return 1; // Wandering form
}
return Utils.randSeedInt(species.forms.length);
return randSeedInt(species.forms.length);
}
if (ignoreArena) {
@ -1804,7 +1736,7 @@ export default class BattleScene extends SceneBase {
case Species.WORMADAM:
case Species.ROTOM:
case Species.LYCANROC:
return Utils.randSeedInt(species.forms.length);
return randSeedInt(species.forms.length);
}
return 0;
}
@ -1816,7 +1748,7 @@ export default class BattleScene extends SceneBase {
let ret = false;
this.executeWithSeedOffset(
() => {
ret = !Utils.randSeedInt(2);
ret = !randSeedInt(2);
},
0,
this.seed.toString(),
@ -1828,7 +1760,7 @@ export default class BattleScene extends SceneBase {
let ret = 0;
this.executeWithSeedOffset(
() => {
ret = Utils.randSeedInt(8) * 5;
ret = randSeedInt(8) * 5;
},
0,
this.seed.toString(),
@ -1857,7 +1789,7 @@ export default class BattleScene extends SceneBase {
isBoss =
waveIndex % 10 === 0 ||
(this.gameMode.hasRandomBosses &&
Utils.randSeedInt(100) < Math.min(Math.max(Math.ceil((waveIndex - 250) / 50), 0) * 2, 30));
randSeedInt(100) < Math.min(Math.max(Math.ceil((waveIndex - 250) / 50), 0) * 2, 30));
}, waveIndex << 2);
}
if (!isBoss) {
@ -1884,7 +1816,7 @@ export default class BattleScene extends SceneBase {
const infectedIndexes: number[] = [];
const spread = (index: number, spreadTo: number) => {
const partyMember = party[index + spreadTo];
if (!partyMember.pokerus && !Utils.randSeedInt(10)) {
if (!partyMember.pokerus && !randSeedInt(10)) {
partyMember.pokerus = true;
infectedIndexes.push(index + spreadTo);
}
@ -1910,7 +1842,7 @@ export default class BattleScene extends SceneBase {
resetSeed(waveIndex?: number): void {
const wave = waveIndex || this.currentBattle?.waveIndex || 0;
this.waveSeed = Utils.shiftCharCodes(this.seed, wave);
this.waveSeed = shiftCharCodes(this.seed, wave);
Phaser.Math.RND.sow([this.waveSeed]);
console.log("Wave Seed:", this.waveSeed, wave);
this.rngCounter = 0;
@ -1929,7 +1861,7 @@ export default class BattleScene extends SceneBase {
const tempRngOffset = this.rngOffset;
const tempRngSeedOverride = this.rngSeedOverride;
const state = Phaser.Math.RND.state();
Phaser.Math.RND.sow([Utils.shiftCharCodes(seedOverride || this.seed, offset)]);
Phaser.Math.RND.sow([shiftCharCodes(seedOverride || this.seed, offset)]);
this.rngCounter = 0;
this.rngOffset = offset;
this.rngSeedOverride = seedOverride || "";
@ -2074,7 +2006,7 @@ export default class BattleScene extends SceneBase {
if (this.money === undefined) {
return;
}
const formattedMoney = Utils.formatMoney(this.moneyFormat, this.money);
const formattedMoney = formatMoney(this.moneyFormat, this.money);
this.moneyText.setText(i18next.t("battleScene:moneyOwned", { formattedMoney }));
this.fieldUI.moveAbove(this.moneyText, this.luckText);
if (forceVisible) {
@ -2231,12 +2163,12 @@ export default class BattleScene extends SceneBase {
),
]
: allSpecies.filter(s => s.isCatchable());
return filteredSpecies[Utils.randSeedInt(filteredSpecies.length)];
return filteredSpecies[randSeedInt(filteredSpecies.length)];
}
generateRandomBiome(waveIndex: number): Biome {
const relWave = waveIndex % 250;
const biomes = Utils.getEnumValues(Biome).filter(b => b !== Biome.TOWN && b !== Biome.END);
const biomes = getEnumValues(Biome).filter(b => b !== Biome.TOWN && b !== Biome.END);
const maxDepth = biomeDepths[Biome.END][0] - 2;
const depthWeights = new Array(maxDepth + 1)
.fill(null)
@ -2248,7 +2180,7 @@ export default class BattleScene extends SceneBase {
biomeThresholds.push(totalWeight);
}
const randInt = Utils.randSeedInt(totalWeight);
const randInt = randSeedInt(totalWeight);
for (let i = 0; i < biomes.length; i++) {
if (randInt < biomeThresholds[i]) {
@ -2256,7 +2188,7 @@ export default class BattleScene extends SceneBase {
}
}
return biomes[Utils.randSeedInt(biomes.length)];
return biomes[randSeedInt(biomes.length)];
}
isBgmPlaying(): boolean {
@ -2441,7 +2373,7 @@ export default class BattleScene extends SceneBase {
this.bgmResumeTimer.destroy();
}
if (resumeBgm) {
this.bgmResumeTimer = this.time.delayedCall(pauseDuration || Utils.fixedInt(sound.totalDuration * 1000), () => {
this.bgmResumeTimer = this.time.delayedCall(pauseDuration || fixedInt(sound.totalDuration * 1000), () => {
this.resumeBgm();
this.bgmResumeTimer = null;
});
@ -3034,7 +2966,7 @@ export default class BattleScene extends SceneBase {
const args: unknown[] = [];
if (modifier instanceof PokemonHpRestoreModifier) {
if (!(modifier as PokemonHpRestoreModifier).fainted) {
const hpRestoreMultiplier = new Utils.NumberHolder(1);
const hpRestoreMultiplier = new NumberHolder(1);
this.applyModifiers(HealingBoosterModifier, true, hpRestoreMultiplier);
args.push(hpRestoreMultiplier.value);
} else {
@ -3042,7 +2974,7 @@ export default class BattleScene extends SceneBase {
}
} else if (modifier instanceof FusePokemonModifier) {
args.push(this.getPokemonById(modifier.fusePokemonId) as PlayerPokemon);
} else if (modifier instanceof RememberMoveModifier && !Utils.isNullOrUndefined(cost)) {
} else if (modifier instanceof RememberMoveModifier && !isNullOrUndefined(cost)) {
args.push(cost);
}
@ -3111,7 +3043,7 @@ export default class BattleScene extends SceneBase {
itemLost = true,
): boolean {
const source = itemModifier.pokemonId ? itemModifier.getPokemon() : null;
const cancelled = new Utils.BooleanHolder(false);
const cancelled = new BooleanHolder(false);
if (source && source.isPlayer() !== target.isPlayer()) {
applyAbAttrs(BlockItemTheftAbAttr, source, cancelled);
@ -3180,7 +3112,7 @@ export default class BattleScene extends SceneBase {
canTransferHeldItemModifier(itemModifier: PokemonHeldItemModifier, target: Pokemon, transferQuantity = 1): boolean {
const mod = itemModifier.clone() as PokemonHeldItemModifier;
const source = mod.pokemonId ? mod.getPokemon() : null;
const cancelled = new Utils.BooleanHolder(false);
const cancelled = new BooleanHolder(false);
if (source && source.isPlayer() !== target.isPlayer()) {
applyAbAttrs(BlockItemTheftAbAttr, source, cancelled);
@ -3274,7 +3206,7 @@ export default class BattleScene extends SceneBase {
}
let count = 0;
for (let c = 0; c < chances; c++) {
if (!Utils.randSeedInt(this.gameMode.getEnemyModifierChance(isBoss))) {
if (!randSeedInt(this.gameMode.getEnemyModifierChance(isBoss))) {
count++;
}
}
@ -3450,7 +3382,7 @@ export default class BattleScene extends SceneBase {
if (mods.length < 1) {
return mods;
}
const rand = Utils.randSeedInt(mods.length);
const rand = randSeedInt(mods.length);
return [mods[rand], ...shuffleModifiers(mods.filter((_, i) => i !== rand))];
};
modifiers = shuffleModifiers(modifiers);
@ -3676,7 +3608,7 @@ export default class BattleScene extends SceneBase {
*/
initFinalBossPhaseTwo(pokemon: Pokemon): void {
if (pokemon instanceof EnemyPokemon && pokemon.isBoss() && !pokemon.formIndex && pokemon.bossSegmentIndex < 1) {
this.fadeOutBgm(Utils.fixedInt(2000), false);
this.fadeOutBgm(fixedInt(2000), false);
this.ui.showDialogue(
battleSpecDialogue[BattleSpec.FINAL_BOSS].firstStageWin,
pokemon.species.name,
@ -3779,7 +3711,7 @@ export default class BattleScene extends SceneBase {
if (Overrides.XP_MULTIPLIER_OVERRIDE !== null) {
expMultiplier = Overrides.XP_MULTIPLIER_OVERRIDE;
}
const pokemonExp = new Utils.NumberHolder(expValue * expMultiplier);
const pokemonExp = new NumberHolder(expValue * expMultiplier);
this.applyModifiers(PokemonExpBoosterModifier, true, partyMember, pokemonExp);
partyMemberExp.push(Math.floor(pokemonExp.value));
}
@ -3928,7 +3860,7 @@ export default class BattleScene extends SceneBase {
while (i < this.mysteryEncounterSaveData.queuedEncounters.length && !!encounter) {
const candidate = this.mysteryEncounterSaveData.queuedEncounters[i];
const forcedChance = candidate.spawnPercent;
if (Utils.randSeedInt(100) < forcedChance) {
if (randSeedInt(100) < forcedChance) {
encounter = allMysteryEncounters[candidate.type];
}
@ -3961,7 +3893,7 @@ export default class BattleScene extends SceneBase {
}
const totalWeight = tierWeights.reduce((a, b) => a + b);
const tierValue = Utils.randSeedInt(totalWeight);
const tierValue = randSeedInt(totalWeight);
const commonThreshold = totalWeight - tierWeights[0];
const greatThreshold = totalWeight - tierWeights[0] - tierWeights[1];
const ultraThreshold = totalWeight - tierWeights[0] - tierWeights[1] - tierWeights[2];
@ -4053,7 +3985,7 @@ export default class BattleScene extends SceneBase {
console.log("No Mystery Encounters found, falling back to Mysterious Challengers.");
return allMysteryEncounters[MysteryEncounterType.MYSTERIOUS_CHALLENGERS];
}
encounter = availableEncounters[Utils.randSeedInt(availableEncounters.length)];
encounter = availableEncounters[randSeedInt(availableEncounters.length)];
// New encounter object to not dirty flags
encounter = new MysteryEncounter(encounter);
encounter.populateDialogueTokensFromRequirements();

View File

@ -1,6 +1,14 @@
import { globalScene } from "#app/global-scene";
import type { Command } from "./ui/command-ui-handler";
import * as Utils from "./utils";
import {
randomString,
getEnumValues,
NumberHolder,
randSeedInt,
shiftCharCodes,
randSeedItem,
randInt,
} from "#app/utils";
import Trainer, { TrainerVariant } from "./field/trainer";
import type { GameMode } from "./game-mode";
import { MoneyMultiplierModifier, PokemonHeldItemModifier } from "./modifier/modifier";
@ -99,7 +107,7 @@ export default class Battle {
public postBattleLoot: PokemonHeldItemModifier[] = [];
public escapeAttempts = 0;
public lastMove: Moves;
public battleSeed: string = Utils.randomString(16, true);
public battleSeed: string = randomString(16, true);
private battleSeedState: string | null = null;
public moneyScattered = 0;
/** Primarily for double battles, keeps track of last enemy and player pokemon that triggered its ability or used a move */
@ -181,8 +189,8 @@ export default class Battle {
incrementTurn(): void {
this.turn++;
this.turnCommands = Object.fromEntries(Utils.getEnumValues(BattlerIndex).map(bt => [bt, null]));
this.preTurnCommands = Object.fromEntries(Utils.getEnumValues(BattlerIndex).map(bt => [bt, null]));
this.turnCommands = Object.fromEntries(getEnumValues(BattlerIndex).map(bt => [bt, null]));
this.preTurnCommands = Object.fromEntries(getEnumValues(BattlerIndex).map(bt => [bt, null]));
this.battleSeedState = null;
}
@ -211,7 +219,7 @@ export default class Battle {
}
pickUpScatteredMoney(): void {
const moneyAmount = new Utils.NumberHolder(globalScene.currentBattle.moneyScattered);
const moneyAmount = new NumberHolder(globalScene.currentBattle.moneyScattered);
globalScene.applyModifiers(MoneyMultiplierModifier, true, moneyAmount);
if (globalScene.arena.getTag(ArenaTagType.HAPPY_HOUR)) {
@ -448,7 +456,7 @@ export default class Battle {
}
/**
* Generates a random number using the current battle's seed. Calls {@linkcode Utils.randSeedInt}
* Generates a random number using the current battle's seed. Calls {@linkcode randSeedInt}
* @param range How large of a range of random numbers to choose from. If {@linkcode range} <= 1, returns {@linkcode min}
* @param min The minimum integer to pick, default `0`
* @returns A random integer between {@linkcode min} and ({@linkcode min} + {@linkcode range} - 1)
@ -463,12 +471,12 @@ export default class Battle {
if (this.battleSeedState) {
Phaser.Math.RND.state(this.battleSeedState);
} else {
Phaser.Math.RND.sow([Utils.shiftCharCodes(this.battleSeed, this.turn << 6)]);
Phaser.Math.RND.sow([shiftCharCodes(this.battleSeed, this.turn << 6)]);
console.log("Battle Seed:", this.battleSeed);
}
globalScene.rngCounter = this.rngCounter++;
globalScene.rngSeedOverride = this.battleSeed;
const ret = Utils.randSeedInt(range, min);
const ret = randSeedInt(range, min);
this.battleSeedState = Phaser.Math.RND.state();
Phaser.Math.RND.state(state);
globalScene.rngCounter = tempRngCounter;
@ -554,19 +562,19 @@ export function getRandomTrainerFunc(
seedOffset = 0,
): GetTrainerFunc {
return () => {
const rand = Utils.randSeedInt(trainerPool.length);
const rand = randSeedInt(trainerPool.length);
const trainerTypes: TrainerType[] = [];
globalScene.executeWithSeedOffset(() => {
for (const trainerPoolEntry of trainerPool) {
const trainerType = Array.isArray(trainerPoolEntry) ? Utils.randSeedItem(trainerPoolEntry) : trainerPoolEntry;
const trainerType = Array.isArray(trainerPoolEntry) ? randSeedItem(trainerPoolEntry) : trainerPoolEntry;
trainerTypes.push(trainerType);
}
}, seedOffset);
let trainerGender = TrainerVariant.DEFAULT;
if (randomGender) {
trainerGender = Utils.randInt(2) === 0 ? TrainerVariant.FEMALE : TrainerVariant.DEFAULT;
trainerGender = randInt(2) === 0 ? TrainerVariant.FEMALE : TrainerVariant.DEFAULT;
}
/* 1/3 chance for evil team grunts to be double battles */
@ -585,7 +593,7 @@ export function getRandomTrainerFunc(
const isEvilTeamGrunt = evilTeamGrunts.includes(trainerTypes[rand]);
if (trainerConfigs[trainerTypes[rand]].hasDouble && isEvilTeamGrunt) {
return new Trainer(trainerTypes[rand], Utils.randInt(3) === 0 ? TrainerVariant.DOUBLE : trainerGender);
return new Trainer(trainerTypes[rand], randInt(3) === 0 ? TrainerVariant.DOUBLE : trainerGender);
}
return new Trainer(trainerTypes[rand], trainerGender);
@ -608,7 +616,7 @@ export const classicFixedBattles: FixedBattleConfigs = {
[ClassicFixedBossWaves.TOWN_YOUNGSTER]: new FixedBattleConfig()
.setBattleType(BattleType.TRAINER)
.setGetTrainerFunc(
() => new Trainer(TrainerType.YOUNGSTER, Utils.randSeedInt(2) ? TrainerVariant.FEMALE : TrainerVariant.DEFAULT),
() => new Trainer(TrainerType.YOUNGSTER, randSeedInt(2) ? TrainerVariant.FEMALE : TrainerVariant.DEFAULT),
),
[ClassicFixedBossWaves.RIVAL_1]: new FixedBattleConfig()
.setBattleType(BattleType.TRAINER)

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
import { PokemonType } from "#enums/pokemon-type";
import * as Utils from "#app/utils";
import { randSeedInt, getEnumValues } from "#app/utils";
import type { SpeciesFormEvolution } from "#app/data/balance/pokemon-evolutions";
import { pokemonEvolutions } from "#app/data/balance/pokemon-evolutions";
import i18next from "i18next";
@ -7710,7 +7710,7 @@ export function initBiomes() {
if (biome === Biome.END) {
const biomeList = Object.keys(Biome).filter(key => !Number.isNaN(Number(key)));
biomeList.pop(); // Removes Biome.END from the list
const randIndex = Utils.randSeedInt(biomeList.length, 1); // Will never be Biome.TOWN
const randIndex = randSeedInt(biomeList.length, 1); // Will never be Biome.TOWN
biome = Biome[biomeList[randIndex]];
}
const linkedBiomes: (Biome | [ Biome, number ])[] = Array.isArray(biomeLinks[biome])
@ -7733,15 +7733,15 @@ export function initBiomes() {
traverseBiome(Biome.TOWN, 0);
biomeDepths[Biome.END] = [ Object.values(biomeDepths).map(d => d[0]).reduce((max: number, value: number) => Math.max(max, value), 0) + 1, 1 ];
for (const biome of Utils.getEnumValues(Biome)) {
for (const biome of getEnumValues(Biome)) {
biomePokemonPools[biome] = {};
biomeTrainerPools[biome] = {};
for (const tier of Utils.getEnumValues(BiomePoolTier)) {
for (const tier of getEnumValues(BiomePoolTier)) {
biomePokemonPools[biome][tier] = {};
biomeTrainerPools[biome][tier] = [];
for (const tod of Utils.getEnumValues(TimeOfDay)) {
for (const tod of getEnumValues(TimeOfDay)) {
biomePokemonPools[biome][tier][tod] = [];
}
}

View File

@ -1,5 +1,5 @@
import { allMoves } from "#app/data/moves/move";
import * as Utils from "#app/utils";
import { getEnumKeys, getEnumValues } from "#app/utils";
import { Moves } from "#enums/moves";
import { Species } from "#enums/species";
@ -587,8 +587,8 @@ export const speciesEggMoves = {
function parseEggMoves(content: string): void {
let output = "";
const speciesNames = Utils.getEnumKeys(Species);
const speciesValues = Utils.getEnumValues(Species);
const speciesNames = getEnumKeys(Species);
const speciesValues = getEnumValues(Species);
const lines = content.split(/\n/g);
for (const line of lines) {

View File

@ -3,7 +3,7 @@ import { Gender } from "#app/data/gender";
import { PokeballType } from "#enums/pokeball";
import type Pokemon from "#app/field/pokemon";
import { PokemonType } from "#enums/pokemon-type";
import * as Utils from "#app/utils";
import { randSeedInt } from "#app/utils";
import { WeatherType } from "#enums/weather-type";
import { Nature } from "#enums/nature";
import { Biome } from "#enums/biome";
@ -333,7 +333,7 @@ class DunsparceEvolutionCondition extends SpeciesEvolutionCondition {
super(p => {
let ret = false;
if (p.moveset.filter(m => m.moveId === Moves.HYPER_DRILL).length > 0) {
globalScene.executeWithSeedOffset(() => ret = !Utils.randSeedInt(4), p.id);
globalScene.executeWithSeedOffset(() => ret = !randSeedInt(4), p.id);
}
return ret;
});
@ -346,7 +346,7 @@ class TandemausEvolutionCondition extends SpeciesEvolutionCondition {
constructor() {
super(p => {
let ret = false;
globalScene.executeWithSeedOffset(() => ret = !Utils.randSeedInt(4), p.id);
globalScene.executeWithSeedOffset(() => ret = !randSeedInt(4), p.id);
return ret;
});
}

View File

@ -19126,6 +19126,8 @@ export const tmSpecies: TmSpecies = {
Species.KROOKODILE,
Species.SCRAGGY,
Species.SCRAFTY,
Species.YAMASK,
Species.COFAGRIGUS,
Species.SAWSBUCK,
Species.LITWICK,
Species.LAMPENT,
@ -19163,6 +19165,7 @@ export const tmSpecies: TmSpecies = {
Species.SINISTEA,
Species.POLTEAGEIST,
Species.PERRSERKER,
Species.RUNERIGUS,
Species.PINCURCHIN,
Species.STONJOURNER,
Species.CUFANT,
@ -19228,6 +19231,7 @@ export const tmSpecies: TmSpecies = {
Species.GALAR_SLOWBRO,
Species.GALAR_WEEZING,
Species.GALAR_SLOWKING,
Species.GALAR_YAMASK,
Species.HISUI_ELECTRODE,
Species.HISUI_TYPHLOSION,
Species.HISUI_QWILFISH,
@ -30922,6 +30926,7 @@ export const tmSpecies: TmSpecies = {
Species.MURKROW,
Species.SLOWKING,
Species.MISDREAVUS,
Species.UNOWN,
Species.GIRAFARIG,
Species.PINECO,
Species.FORRETRESS,
@ -40134,6 +40139,8 @@ export const tmSpecies: TmSpecies = {
Species.MEOWSTIC,
Species.SPRITZEE,
Species.AROMATISSE,
Species.INKAY,
Species.MALAMAR,
Species.SYLVEON,
Species.CARBINK,
Species.PHANTUMP,
@ -49173,6 +49180,7 @@ export const tmSpecies: TmSpecies = {
Species.KANGASKHAN,
Species.GOLDEEN,
Species.SEAKING,
Species.GYARADOS,
Species.LAPRAS,
Species.VAPOREON,
Species.KABUTOPS,
@ -52587,6 +52595,7 @@ export const tmSpecies: TmSpecies = {
Species.SNORLAX,
Species.MEWTWO,
Species.MEW,
Species.MEGANIUM,
Species.CYNDAQUIL,
Species.QUILAVA,
Species.TYPHLOSION,
@ -66205,7 +66214,11 @@ export const tmSpecies: TmSpecies = {
Species.SQUIRTLE,
Species.WARTORTLE,
Species.BLASTOISE,
Species.CATERPIE,
Species.METAPOD,
Species.BUTTERFREE,
Species.WEEDLE,
Species.KAKUNA,
Species.BEEDRILL,
Species.PIDGEY,
Species.PIDGEOTTO,
@ -66451,7 +66464,10 @@ export const tmSpecies: TmSpecies = {
Species.MIGHTYENA,
Species.ZIGZAGOON,
Species.LINOONE,
Species.WURMPLE,
Species.SILCOON,
Species.BEAUTIFLY,
Species.CASCOON,
Species.DUSTOX,
Species.LOTAD,
Species.LOMBRE,
@ -66987,6 +67003,8 @@ export const tmSpecies: TmSpecies = {
Species.STAKATAKA,
Species.BLACEPHALON,
Species.ZERAORA,
Species.MELTAN,
Species.MELMETAL,
Species.ALOLA_RATTATA,
Species.ALOLA_RATICATE,
Species.ALOLA_RAICHU,
@ -67020,8 +67038,19 @@ export const tmSpecies: TmSpecies = {
Species.ROOKIDEE,
Species.CORVISQUIRE,
Species.CORVIKNIGHT,
Species.BLIPBUG,
Species.DOTTLER,
Species.ORBEETLE,
Species.NICKIT,
Species.THIEVUL,
Species.GOSSIFLEUR,
Species.ELDEGOSS,
Species.WOOLOO,
Species.DUBWOOL,
Species.CHEWTLE,
Species.DREDNAW,
Species.YAMPER,
Species.BOLTUND,
Species.ROLYCOLY,
Species.CARKOL,
Species.COALOSSAL,
@ -67035,6 +67064,10 @@ export const tmSpecies: TmSpecies = {
Species.BARRASKEWDA,
Species.TOXEL,
Species.TOXTRICITY,
Species.SIZZLIPEDE,
Species.CENTISKORCH,
Species.CLOBBOPUS,
Species.GRAPPLOCT,
Species.SINISTEA,
Species.POLTEAGEIST,
Species.HATENNA,
@ -67043,7 +67076,14 @@ export const tmSpecies: TmSpecies = {
Species.IMPIDIMP,
Species.MORGREM,
Species.GRIMMSNARL,
Species.OBSTAGOON,
Species.PERRSERKER,
Species.CURSOLA,
Species.SIRFETCHD,
Species.MR_RIME,
Species.RUNERIGUS,
Species.MILCERY,
Species.ALCREMIE,
Species.FALINKS,
Species.PINCURCHIN,
Species.SNOM,
@ -67054,6 +67094,11 @@ export const tmSpecies: TmSpecies = {
Species.MORPEKO,
Species.CUFANT,
Species.COPPERAJAH,
Species.DRACOZOLT,
Species.ARCTOZOLT,
Species.DRACOVISH,
Species.ARCTOVISH,
Species.DURALUDON,
Species.DREEPY,
Species.DRAKLOAK,
Species.DRAGAPULT,
@ -67195,13 +67240,24 @@ export const tmSpecies: TmSpecies = {
Species.IRON_CROWN,
Species.PECHARUNT,
Species.GALAR_MEOWTH,
Species.GALAR_PONYTA,
Species.GALAR_RAPIDASH,
Species.GALAR_SLOWPOKE,
Species.GALAR_SLOWBRO,
Species.GALAR_FARFETCHD,
Species.GALAR_WEEZING,
Species.GALAR_MR_MIME,
Species.GALAR_ARTICUNO,
Species.GALAR_ZAPDOS,
Species.GALAR_MOLTRES,
Species.GALAR_SLOWKING,
Species.GALAR_CORSOLA,
Species.GALAR_ZIGZAGOON,
Species.GALAR_LINOONE,
Species.GALAR_DARUMAKA,
Species.GALAR_DARMANITAN,
Species.GALAR_YAMASK,
Species.GALAR_STUNFISK,
Species.HISUI_GROWLITHE,
Species.HISUI_ARCANINE,
Species.HISUI_VOLTORB,

View File

@ -42,7 +42,7 @@ import { Species } from "#enums/species";
import { EFFECTIVE_STATS, getStatKey, Stat, type BattleStat, type EffectiveStat } from "#enums/stat";
import { StatusEffect } from "#enums/status-effect";
import { WeatherType } from "#enums/weather-type";
import * as Utils from "../utils";
import { isNullOrUndefined } from "#app/utils";
export enum BattlerTagLapseType {
FAINT,
@ -302,7 +302,7 @@ export class DisabledTag extends MoveRestrictionBattlerTag {
super.onAdd(pokemon);
const move = pokemon.getLastXMoves(-1).find(m => !m.virtual);
if (Utils.isNullOrUndefined(move) || move.move === Moves.STRUGGLE || move.move === Moves.NONE) {
if (isNullOrUndefined(move) || move.move === Moves.STRUGGLE || move.move === Moves.NONE) {
return;
}

View File

@ -2,7 +2,7 @@ import { getPokemonNameWithAffix } from "../messages";
import type Pokemon from "../field/pokemon";
import { HitResult } from "../field/pokemon";
import { getStatusEffectHealText } from "./status-effect";
import * as Utils from "../utils";
import { NumberHolder, toDmgValue, randSeedInt } from "#app/utils";
import {
DoubleBerryEffectAbAttr,
PostItemLostAbAttr,
@ -43,7 +43,7 @@ export function getBerryPredicate(berryType: BerryType): BerryPredicate {
case BerryType.APICOT:
case BerryType.SALAC:
return (pokemon: Pokemon) => {
const threshold = new Utils.NumberHolder(0.25);
const threshold = new NumberHolder(0.25);
// Offset BerryType such that LIECHI -> Stat.ATK = 1, GANLON -> Stat.DEF = 2, so on and so forth
const stat: BattleStat = berryType - BerryType.ENIGMA;
applyAbAttrs(ReduceBerryUseThresholdAbAttr, pokemon, null, false, threshold);
@ -51,19 +51,19 @@ export function getBerryPredicate(berryType: BerryType): BerryPredicate {
};
case BerryType.LANSAT:
return (pokemon: Pokemon) => {
const threshold = new Utils.NumberHolder(0.25);
const threshold = new NumberHolder(0.25);
applyAbAttrs(ReduceBerryUseThresholdAbAttr, pokemon, null, false, threshold);
return pokemon.getHpRatio() < 0.25 && !pokemon.getTag(BattlerTagType.CRIT_BOOST);
};
case BerryType.STARF:
return (pokemon: Pokemon) => {
const threshold = new Utils.NumberHolder(0.25);
const threshold = new NumberHolder(0.25);
applyAbAttrs(ReduceBerryUseThresholdAbAttr, pokemon, null, false, threshold);
return pokemon.getHpRatio() < 0.25;
};
case BerryType.LEPPA:
return (pokemon: Pokemon) => {
const threshold = new Utils.NumberHolder(0.25);
const threshold = new NumberHolder(0.25);
applyAbAttrs(ReduceBerryUseThresholdAbAttr, pokemon, null, false, threshold);
return !!pokemon.getMoveset().find(m => !m.getPpRatio());
};
@ -80,7 +80,7 @@ export function getBerryEffectFunc(berryType: BerryType): BerryEffectFunc {
if (pokemon.battleData) {
pokemon.battleData.berriesEaten.push(berryType);
}
const hpHealed = new Utils.NumberHolder(Utils.toDmgValue(pokemon.getMaxHp() / 4));
const hpHealed = new NumberHolder(toDmgValue(pokemon.getMaxHp() / 4));
applyAbAttrs(DoubleBerryEffectAbAttr, pokemon, null, false, hpHealed);
globalScene.unshiftPhase(
new PokemonHealPhase(
@ -118,7 +118,7 @@ export function getBerryEffectFunc(berryType: BerryType): BerryEffectFunc {
}
// Offset BerryType such that LIECHI -> Stat.ATK = 1, GANLON -> Stat.DEF = 2, so on and so forth
const stat: BattleStat = berryType - BerryType.ENIGMA;
const statStages = new Utils.NumberHolder(1);
const statStages = new NumberHolder(1);
applyAbAttrs(DoubleBerryEffectAbAttr, pokemon, null, false, statStages);
globalScene.unshiftPhase(new StatStageChangePhase(pokemon.getBattlerIndex(), true, [stat], statStages.value));
applyPostItemLostAbAttrs(PostItemLostAbAttr, berryOwner ?? pokemon, false);
@ -136,8 +136,8 @@ export function getBerryEffectFunc(berryType: BerryType): BerryEffectFunc {
if (pokemon.battleData) {
pokemon.battleData.berriesEaten.push(berryType);
}
const randStat = Utils.randSeedInt(Stat.SPD, Stat.ATK);
const stages = new Utils.NumberHolder(2);
const randStat = randSeedInt(Stat.SPD, Stat.ATK);
const stages = new NumberHolder(2);
applyAbAttrs(DoubleBerryEffectAbAttr, pokemon, null, false, stages);
globalScene.unshiftPhase(new StatStageChangePhase(pokemon.getBattlerIndex(), true, [randStat], stages.value));
applyPostItemLostAbAttrs(PostItemLostAbAttr, berryOwner ?? pokemon, false);

View File

@ -1,4 +1,4 @@
import * as Utils from "#app/utils";
import { BooleanHolder, type NumberHolder, randSeedItem, deepCopy } from "#app/utils";
import i18next from "i18next";
import type { DexAttrProps, GameData } from "#app/system/game-data";
import { defaultStarterSpecies } from "#app/system/game-data";
@ -283,30 +283,30 @@ export abstract class Challenge {
/**
* An apply function for STARTER_CHOICE challenges. Derived classes should alter this.
* @param _pokemon {@link PokemonSpecies} The pokemon to check the validity of.
* @param _valid {@link Utils.BooleanHolder} A BooleanHolder, the value gets set to false if the pokemon isn't allowed.
* @param _valid {@link BooleanHolder} A BooleanHolder, the value gets set to false if the pokemon isn't allowed.
* @param _dexAttr {@link DexAttrProps} The dex attributes of the pokemon.
* @returns {@link boolean} Whether this function did anything.
*/
applyStarterChoice(_pokemon: PokemonSpecies, _valid: Utils.BooleanHolder, _dexAttr: DexAttrProps): boolean {
applyStarterChoice(_pokemon: PokemonSpecies, _valid: BooleanHolder, _dexAttr: DexAttrProps): boolean {
return false;
}
/**
* An apply function for STARTER_POINTS challenges. Derived classes should alter this.
* @param _points {@link Utils.NumberHolder} The amount of points you have available.
* @param _points {@link NumberHolder} The amount of points you have available.
* @returns {@link boolean} Whether this function did anything.
*/
applyStarterPoints(_points: Utils.NumberHolder): boolean {
applyStarterPoints(_points: NumberHolder): boolean {
return false;
}
/**
* An apply function for STARTER_COST challenges. Derived classes should alter this.
* @param _species {@link Species} The pokemon to change the cost of.
* @param _cost {@link Utils.NumberHolder} The cost of the starter.
* @param _cost {@link NumberHolder} The cost of the starter.
* @returns {@link boolean} Whether this function did anything.
*/
applyStarterCost(_species: Species, _cost: Utils.NumberHolder): boolean {
applyStarterCost(_species: Species, _cost: NumberHolder): boolean {
return false;
}
@ -322,10 +322,10 @@ export abstract class Challenge {
/**
* An apply function for POKEMON_IN_BATTLE challenges. Derived classes should alter this.
* @param _pokemon {@link Pokemon} The pokemon to check the validity of.
* @param _valid {@link Utils.BooleanHolder} A BooleanHolder, the value gets set to false if the pokemon isn't allowed.
* @param _valid {@link BooleanHolder} A BooleanHolder, the value gets set to false if the pokemon isn't allowed.
* @returns {@link boolean} Whether this function did anything.
*/
applyPokemonInBattle(_pokemon: Pokemon, _valid: Utils.BooleanHolder): boolean {
applyPokemonInBattle(_pokemon: Pokemon, _valid: BooleanHolder): boolean {
return false;
}
@ -341,42 +341,42 @@ export abstract class Challenge {
/**
* An apply function for TYPE_EFFECTIVENESS challenges. Derived classes should alter this.
* @param _effectiveness {@linkcode Utils.NumberHolder} The current effectiveness of the move.
* @param _effectiveness {@linkcode NumberHolder} The current effectiveness of the move.
* @returns Whether this function did anything.
*/
applyTypeEffectiveness(_effectiveness: Utils.NumberHolder): boolean {
applyTypeEffectiveness(_effectiveness: NumberHolder): boolean {
return false;
}
/**
* An apply function for AI_LEVEL challenges. Derived classes should alter this.
* @param _level {@link Utils.NumberHolder} The generated level.
* @param _level {@link NumberHolder} The generated level.
* @param _levelCap {@link Number} The current level cap.
* @param _isTrainer {@link Boolean} Whether this is a trainer pokemon.
* @param _isBoss {@link Boolean} Whether this is a non-trainer boss pokemon.
* @returns {@link boolean} Whether this function did anything.
*/
applyLevelChange(_level: Utils.NumberHolder, _levelCap: number, _isTrainer: boolean, _isBoss: boolean): boolean {
applyLevelChange(_level: NumberHolder, _levelCap: number, _isTrainer: boolean, _isBoss: boolean): boolean {
return false;
}
/**
* An apply function for AI_MOVE_SLOTS challenges. Derived classes should alter this.
* @param pokemon {@link Pokemon} The pokemon that is being considered.
* @param moveSlots {@link Utils.NumberHolder} The amount of move slots.
* @param moveSlots {@link NumberHolder} The amount of move slots.
* @returns {@link boolean} Whether this function did anything.
*/
applyMoveSlot(_pokemon: Pokemon, _moveSlots: Utils.NumberHolder): boolean {
applyMoveSlot(_pokemon: Pokemon, _moveSlots: NumberHolder): boolean {
return false;
}
/**
* An apply function for PASSIVE_ACCESS challenges. Derived classes should alter this.
* @param pokemon {@link Pokemon} The pokemon to change.
* @param hasPassive {@link Utils.BooleanHolder} Whether it should have its passive.
* @param hasPassive {@link BooleanHolder} Whether it should have its passive.
* @returns {@link boolean} Whether this function did anything.
*/
applyPassiveAccess(_pokemon: Pokemon, _hasPassive: Utils.BooleanHolder): boolean {
applyPassiveAccess(_pokemon: Pokemon, _hasPassive: BooleanHolder): boolean {
return false;
}
@ -393,15 +393,10 @@ export abstract class Challenge {
* @param _pokemon {@link Pokemon} What pokemon would learn the move.
* @param _moveSource {@link MoveSourceType} What source the pokemon would get the move from.
* @param _move {@link Moves} The move in question.
* @param _level {@link Utils.NumberHolder} The level threshold for access.
* @param _level {@link NumberHolder} The level threshold for access.
* @returns {@link boolean} Whether this function did anything.
*/
applyMoveAccessLevel(
_pokemon: Pokemon,
_moveSource: MoveSourceType,
_move: Moves,
_level: Utils.NumberHolder,
): boolean {
applyMoveAccessLevel(_pokemon: Pokemon, _moveSource: MoveSourceType, _move: Moves, _level: NumberHolder): boolean {
return false;
}
@ -410,10 +405,10 @@ export abstract class Challenge {
* @param _pokemon {@link Pokemon} What pokemon would learn the move.
* @param _moveSource {@link MoveSourceType} What source the pokemon would get the move from.
* @param _move {@link Moves} The move in question.
* @param _weight {@link Utils.NumberHolder} The base weight of the move
* @param _weight {@link NumberHolder} The base weight of the move
* @returns {@link boolean} Whether this function did anything.
*/
applyMoveWeight(_pokemon: Pokemon, _moveSource: MoveSourceType, _move: Moves, _level: Utils.NumberHolder): boolean {
applyMoveWeight(_pokemon: Pokemon, _moveSource: MoveSourceType, _move: Moves, _level: NumberHolder): boolean {
return false;
}
@ -438,7 +433,7 @@ export class SingleGenerationChallenge extends Challenge {
super(Challenges.SINGLE_GENERATION, 9);
}
applyStarterChoice(pokemon: PokemonSpecies, valid: Utils.BooleanHolder): boolean {
applyStarterChoice(pokemon: PokemonSpecies, valid: BooleanHolder): boolean {
if (pokemon.generation !== this.value) {
valid.value = false;
return true;
@ -446,7 +441,7 @@ export class SingleGenerationChallenge extends Challenge {
return false;
}
applyPokemonInBattle(pokemon: Pokemon, valid: Utils.BooleanHolder): boolean {
applyPokemonInBattle(pokemon: Pokemon, valid: BooleanHolder): boolean {
const baseGeneration = getPokemonSpecies(pokemon.species.speciesId).generation;
const fusionGeneration = pokemon.isFusion() ? getPokemonSpecies(pokemon.fusionSpecies!.speciesId).generation : 0;
if (
@ -575,7 +570,7 @@ export class SingleGenerationChallenge extends Challenge {
TrainerType.AARON,
TrainerType.SHAUNTAL,
TrainerType.MALVA,
Utils.randSeedItem([TrainerType.HALA, TrainerType.MOLAYNE]),
randSeedItem([TrainerType.HALA, TrainerType.MOLAYNE]),
TrainerType.MARNIE_ELITE,
TrainerType.RIKA,
];
@ -602,7 +597,7 @@ export class SingleGenerationChallenge extends Challenge {
TrainerType.GRIMSLEY,
TrainerType.WIKSTROM,
TrainerType.ACEROLA,
Utils.randSeedItem([TrainerType.BEA_ELITE, TrainerType.ALLISTER_ELITE]),
randSeedItem([TrainerType.BEA_ELITE, TrainerType.ALLISTER_ELITE]),
TrainerType.LARRY_ELITE,
];
break;
@ -622,14 +617,14 @@ export class SingleGenerationChallenge extends Challenge {
case ClassicFixedBossWaves.CHAMPION:
trainerTypes = [
TrainerType.BLUE,
Utils.randSeedItem([TrainerType.RED, TrainerType.LANCE_CHAMPION]),
Utils.randSeedItem([TrainerType.STEVEN, TrainerType.WALLACE]),
randSeedItem([TrainerType.RED, TrainerType.LANCE_CHAMPION]),
randSeedItem([TrainerType.STEVEN, TrainerType.WALLACE]),
TrainerType.CYNTHIA,
Utils.randSeedItem([TrainerType.ALDER, TrainerType.IRIS]),
randSeedItem([TrainerType.ALDER, TrainerType.IRIS]),
TrainerType.DIANTHA,
Utils.randSeedItem([TrainerType.KUKUI, TrainerType.HAU]),
Utils.randSeedItem([TrainerType.LEON, TrainerType.MUSTARD]),
Utils.randSeedItem([TrainerType.GEETA, TrainerType.NEMONA]),
randSeedItem([TrainerType.KUKUI, TrainerType.HAU]),
randSeedItem([TrainerType.LEON, TrainerType.MUSTARD]),
randSeedItem([TrainerType.GEETA, TrainerType.NEMONA]),
];
break;
}
@ -718,7 +713,7 @@ export class SingleTypeChallenge extends Challenge {
super(Challenges.SINGLE_TYPE, 18);
}
override applyStarterChoice(pokemon: PokemonSpecies, valid: Utils.BooleanHolder, dexAttr: DexAttrProps): boolean {
override applyStarterChoice(pokemon: PokemonSpecies, valid: BooleanHolder, dexAttr: DexAttrProps): boolean {
const speciesForm = getPokemonSpeciesForm(pokemon.speciesId, dexAttr.formIndex);
const types = [speciesForm.type1, speciesForm.type2];
if (!types.includes(this.value - 1)) {
@ -728,7 +723,7 @@ export class SingleTypeChallenge extends Challenge {
return false;
}
applyPokemonInBattle(pokemon: Pokemon, valid: Utils.BooleanHolder): boolean {
applyPokemonInBattle(pokemon: Pokemon, valid: BooleanHolder): boolean {
if (
pokemon.isPlayer() &&
!pokemon.isOfType(this.value - 1, false, false, true) &&
@ -798,7 +793,7 @@ export class FreshStartChallenge extends Challenge {
super(Challenges.FRESH_START, 1);
}
applyStarterChoice(pokemon: PokemonSpecies, valid: Utils.BooleanHolder): boolean {
applyStarterChoice(pokemon: PokemonSpecies, valid: BooleanHolder): boolean {
if (!defaultStarterSpecies.includes(pokemon.speciesId)) {
valid.value = false;
return true;
@ -806,7 +801,7 @@ export class FreshStartChallenge extends Challenge {
return false;
}
applyStarterCost(species: Species, cost: Utils.NumberHolder): boolean {
applyStarterCost(species: Species, cost: NumberHolder): boolean {
if (defaultStarterSpecies.includes(species)) {
cost.value = speciesStarterCosts[species];
return true;
@ -864,7 +859,7 @@ export class InverseBattleChallenge extends Challenge {
return 0;
}
applyTypeEffectiveness(effectiveness: Utils.NumberHolder): boolean {
applyTypeEffectiveness(effectiveness: NumberHolder): boolean {
if (effectiveness.value < 1) {
effectiveness.value = 2;
return true;
@ -887,7 +882,7 @@ export class FlipStatChallenge extends Challenge {
}
override applyFlipStat(_pokemon: Pokemon, baseStats: number[]) {
const origStats = Utils.deepCopy(baseStats);
const origStats = deepCopy(baseStats);
baseStats[0] = origStats[5];
baseStats[1] = origStats[4];
baseStats[2] = origStats[3];
@ -923,7 +918,7 @@ export class LowerStarterMaxCostChallenge extends Challenge {
return (DEFAULT_PARTY_MAX_COST - overrideValue).toString();
}
applyStarterChoice(pokemon: PokemonSpecies, valid: Utils.BooleanHolder): boolean {
applyStarterChoice(pokemon: PokemonSpecies, valid: BooleanHolder): boolean {
if (speciesStarterCosts[pokemon.speciesId] > DEFAULT_PARTY_MAX_COST - this.value) {
valid.value = false;
return true;
@ -957,7 +952,7 @@ export class LowerStarterPointsChallenge extends Challenge {
return (DEFAULT_PARTY_MAX_COST - overrideValue).toString();
}
applyStarterPoints(points: Utils.NumberHolder): boolean {
applyStarterPoints(points: NumberHolder): boolean {
points.value -= this.value;
return true;
}
@ -974,34 +969,34 @@ export class LowerStarterPointsChallenge extends Challenge {
* Apply all challenges that modify starter choice.
* @param challengeType {@link ChallengeType} ChallengeType.STARTER_CHOICE
* @param pokemon {@link PokemonSpecies} The pokemon to check the validity of.
* @param valid {@link Utils.BooleanHolder} A BooleanHolder, the value gets set to false if the pokemon isn't allowed.
* @param valid {@link BooleanHolder} A BooleanHolder, the value gets set to false if the pokemon isn't allowed.
* @param dexAttr {@link DexAttrProps} The dex attributes of the pokemon.
* @returns True if any challenge was successfully applied.
*/
export function applyChallenges(
challengeType: ChallengeType.STARTER_CHOICE,
pokemon: PokemonSpecies,
valid: Utils.BooleanHolder,
valid: BooleanHolder,
dexAttr: DexAttrProps,
): boolean;
/**
* Apply all challenges that modify available total starter points.
* @param challengeType {@link ChallengeType} ChallengeType.STARTER_POINTS
* @param points {@link Utils.NumberHolder} The amount of points you have available.
* @param points {@link NumberHolder} The amount of points you have available.
* @returns True if any challenge was successfully applied.
*/
export function applyChallenges(challengeType: ChallengeType.STARTER_POINTS, points: Utils.NumberHolder): boolean;
export function applyChallenges(challengeType: ChallengeType.STARTER_POINTS, points: NumberHolder): boolean;
/**
* Apply all challenges that modify the cost of a starter.
* @param challengeType {@link ChallengeType} ChallengeType.STARTER_COST
* @param species {@link Species} The pokemon to change the cost of.
* @param points {@link Utils.NumberHolder} The cost of the pokemon.
* @param points {@link NumberHolder} The cost of the pokemon.
* @returns True if any challenge was successfully applied.
*/
export function applyChallenges(
challengeType: ChallengeType.STARTER_COST,
species: Species,
cost: Utils.NumberHolder,
cost: NumberHolder,
): boolean;
/**
* Apply all challenges that modify a starter after selection.
@ -1014,13 +1009,13 @@ export function applyChallenges(challengeType: ChallengeType.STARTER_MODIFY, pok
* Apply all challenges that what pokemon you can have in battle.
* @param challengeType {@link ChallengeType} ChallengeType.POKEMON_IN_BATTLE
* @param pokemon {@link Pokemon} The pokemon to check the validity of.
* @param valid {@link Utils.BooleanHolder} A BooleanHolder, the value gets set to false if the pokemon isn't allowed.
* @param valid {@link BooleanHolder} A BooleanHolder, the value gets set to false if the pokemon isn't allowed.
* @returns True if any challenge was successfully applied.
*/
export function applyChallenges(
challengeType: ChallengeType.POKEMON_IN_BATTLE,
pokemon: Pokemon,
valid: Utils.BooleanHolder,
valid: BooleanHolder,
): boolean;
/**
* Apply all challenges that modify what fixed battles there are.
@ -1037,17 +1032,14 @@ export function applyChallenges(
/**
* Apply all challenges that modify type effectiveness.
* @param challengeType {@linkcode ChallengeType} ChallengeType.TYPE_EFFECTIVENESS
* @param effectiveness {@linkcode Utils.NumberHolder} The current effectiveness of the move.
* @param effectiveness {@linkcode NumberHolder} The current effectiveness of the move.
* @returns True if any challenge was successfully applied.
*/
export function applyChallenges(
challengeType: ChallengeType.TYPE_EFFECTIVENESS,
effectiveness: Utils.NumberHolder,
): boolean;
export function applyChallenges(challengeType: ChallengeType.TYPE_EFFECTIVENESS, effectiveness: NumberHolder): boolean;
/**
* Apply all challenges that modify what level AI are.
* @param challengeType {@link ChallengeType} ChallengeType.AI_LEVEL
* @param level {@link Utils.NumberHolder} The generated level of the pokemon.
* @param level {@link NumberHolder} The generated level of the pokemon.
* @param levelCap {@link Number} The maximum level cap for the current wave.
* @param isTrainer {@link Boolean} Whether this is a trainer pokemon.
* @param isBoss {@link Boolean} Whether this is a non-trainer boss pokemon.
@ -1055,7 +1047,7 @@ export function applyChallenges(
*/
export function applyChallenges(
challengeType: ChallengeType.AI_LEVEL,
level: Utils.NumberHolder,
level: NumberHolder,
levelCap: number,
isTrainer: boolean,
isBoss: boolean,
@ -1064,25 +1056,25 @@ export function applyChallenges(
* Apply all challenges that modify how many move slots the AI has.
* @param challengeType {@link ChallengeType} ChallengeType.AI_MOVE_SLOTS
* @param pokemon {@link Pokemon} The pokemon being considered.
* @param moveSlots {@link Utils.NumberHolder} The amount of move slots.
* @param moveSlots {@link NumberHolder} The amount of move slots.
* @returns True if any challenge was successfully applied.
*/
export function applyChallenges(
challengeType: ChallengeType.AI_MOVE_SLOTS,
pokemon: Pokemon,
moveSlots: Utils.NumberHolder,
moveSlots: NumberHolder,
): boolean;
/**
* Apply all challenges that modify whether a pokemon has its passive.
* @param challengeType {@link ChallengeType} ChallengeType.PASSIVE_ACCESS
* @param pokemon {@link Pokemon} The pokemon to modify.
* @param hasPassive {@link Utils.BooleanHolder} Whether it has its passive.
* @param hasPassive {@link BooleanHolder} Whether it has its passive.
* @returns True if any challenge was successfully applied.
*/
export function applyChallenges(
challengeType: ChallengeType.PASSIVE_ACCESS,
pokemon: Pokemon,
hasPassive: Utils.BooleanHolder,
hasPassive: BooleanHolder,
): boolean;
/**
* Apply all challenges that modify the game modes settings.
@ -1096,7 +1088,7 @@ export function applyChallenges(challengeType: ChallengeType.GAME_MODE_MODIFY):
* @param pokemon {@link Pokemon} What pokemon would learn the move.
* @param moveSource {@link MoveSourceType} What source the pokemon would get the move from.
* @param move {@link Moves} The move in question.
* @param level {@link Utils.NumberHolder} The level threshold for access.
* @param level {@link NumberHolder} The level threshold for access.
* @returns True if any challenge was successfully applied.
*/
export function applyChallenges(
@ -1104,7 +1096,7 @@ export function applyChallenges(
pokemon: Pokemon,
moveSource: MoveSourceType,
move: Moves,
level: Utils.NumberHolder,
level: NumberHolder,
): boolean;
/**
* Apply all challenges that modify what weight a pokemon gives to move generation
@ -1112,7 +1104,7 @@ export function applyChallenges(
* @param pokemon {@link Pokemon} What pokemon would learn the move.
* @param moveSource {@link MoveSourceType} What source the pokemon would get the move from.
* @param move {@link Moves} The move in question.
* @param weight {@link Utils.NumberHolder} The weight of the move.
* @param weight {@link NumberHolder} The weight of the move.
* @returns True if any challenge was successfully applied.
*/
export function applyChallenges(
@ -1120,7 +1112,7 @@ export function applyChallenges(
pokemon: Pokemon,
moveSource: MoveSourceType,
move: Moves,
weight: Utils.NumberHolder,
weight: NumberHolder,
): boolean;
export function applyChallenges(challengeType: ChallengeType.FLIP_STAT, pokemon: Pokemon, baseStats: number[]): boolean;
@ -1225,7 +1217,7 @@ export function initChallenges() {
*/
export function checkStarterValidForChallenge(species: PokemonSpecies, props: DexAttrProps, soft: boolean) {
if (!soft) {
const isValidForChallenge = new Utils.BooleanHolder(true);
const isValidForChallenge = new BooleanHolder(true);
applyChallenges(ChallengeType.STARTER_CHOICE, species, isValidForChallenge, props);
return isValidForChallenge.value;
}
@ -1263,7 +1255,7 @@ export function checkStarterValidForChallenge(species: PokemonSpecies, props: De
* @returns `true` if the species is considered valid.
*/
function checkSpeciesValidForChallenge(species: PokemonSpecies, props: DexAttrProps, soft: boolean) {
const isValidForChallenge = new Utils.BooleanHolder(true);
const isValidForChallenge = new BooleanHolder(true);
applyChallenges(ChallengeType.STARTER_CHOICE, species, isValidForChallenge, props);
if (!soft || !pokemonFormChanges.hasOwnProperty(species.speciesId)) {
return isValidForChallenge.value;
@ -1282,7 +1274,7 @@ function checkSpeciesValidForChallenge(species: PokemonSpecies, props: DexAttrPr
return species.forms.some((f2, formIndex) => {
if (f1.formKey === f2.formKey) {
const formProps = { ...props, formIndex };
const isFormValidForChallenge = new Utils.BooleanHolder(true);
const isFormValidForChallenge = new BooleanHolder(true);
applyChallenges(ChallengeType.STARTER_CHOICE, species, isFormValidForChallenge, formProps);
return isFormValidForChallenge.value;
}

View File

@ -3,7 +3,7 @@ import type { Species } from "#enums/species";
import { globalScene } from "#app/global-scene";
import { PlayerPokemon } from "#app/field/pokemon";
import type { Starter } from "#app/ui/starter-select-ui-handler";
import * as Utils from "#app/utils";
import { randSeedGauss, randSeedInt, randSeedItem, getEnumValues } from "#app/utils";
import type { PokemonSpeciesForm } from "#app/data/pokemon-species";
import PokemonSpecies, { getPokemonSpecies, getPokemonSpeciesForm } from "#app/data/pokemon-species";
import { speciesStarterCosts } from "#app/data/balance/starters";
@ -43,8 +43,8 @@ export function getDailyRunStarters(seed: string): Starter[] {
}
const starterCosts: number[] = [];
starterCosts.push(Math.min(Math.round(3.5 + Math.abs(Utils.randSeedGauss(1))), 8));
starterCosts.push(Utils.randSeedInt(9 - starterCosts[0], 1));
starterCosts.push(Math.min(Math.round(3.5 + Math.abs(randSeedGauss(1))), 8));
starterCosts.push(randSeedInt(9 - starterCosts[0], 1));
starterCosts.push(10 - (starterCosts[0] + starterCosts[1]));
for (let c = 0; c < starterCosts.length; c++) {
@ -52,7 +52,7 @@ export function getDailyRunStarters(seed: string): Starter[] {
const costSpecies = Object.keys(speciesStarterCosts)
.map(s => Number.parseInt(s) as Species)
.filter(s => speciesStarterCosts[s] === cost);
const randPkmSpecies = getPokemonSpecies(Utils.randSeedItem(costSpecies));
const randPkmSpecies = getPokemonSpecies(randSeedItem(costSpecies));
const starterSpecies = getPokemonSpecies(
randPkmSpecies.getTrainerSpeciesForLevel(startingLevel, true, PartyMemberStrength.STRONGER),
);
@ -143,7 +143,7 @@ const dailyBiomeWeights: BiomeWeights = {
};
export function getDailyStartingBiome(): Biome {
const biomes = Utils.getEnumValues(Biome).filter(b => b !== Biome.TOWN && b !== Biome.END);
const biomes = getEnumValues(Biome).filter(b => b !== Biome.TOWN && b !== Biome.END);
let totalWeight = 0;
const biomeThresholds: number[] = [];
@ -155,7 +155,7 @@ export function getDailyStartingBiome(): Biome {
biomeThresholds.push(totalWeight);
}
const randInt = Utils.randSeedInt(totalWeight);
const randInt = randSeedInt(totalWeight);
for (let i = 0; i < biomes.length; i++) {
if (randInt < biomeThresholds[i]) {
@ -164,5 +164,5 @@ export function getDailyStartingBiome(): Biome {
}
// Fallback in case something went wrong
return biomes[Utils.randSeedInt(biomes.length)];
return biomes[randSeedInt(biomes.length)];
}

View File

@ -4,7 +4,7 @@ import type PokemonSpecies from "#app/data/pokemon-species";
import { getPokemonSpecies } from "#app/data/pokemon-species";
import { speciesStarterCosts } from "#app/data/balance/starters";
import { VariantTier } from "#enums/variant-tier";
import * as Utils from "#app/utils";
import { randInt, randomString, randSeedInt, getIvsFromId } from "#app/utils";
import Overrides from "#app/overrides";
import { pokemonPrevolutions } from "#app/data/balance/pokemon-evolutions";
import type { PlayerPokemon } from "#app/field/pokemon";
@ -171,7 +171,7 @@ export class Egg {
this.checkForPityTierOverrides();
}
this._id = eggOptions?.id ?? Utils.randInt(EGG_SEED, EGG_SEED * this._tier);
this._id = eggOptions?.id ?? randInt(EGG_SEED, EGG_SEED * this._tier);
this._sourceType = eggOptions?.sourceType ?? undefined;
this._hatchWaves = eggOptions?.hatchWaves ?? this.getEggTierDefaultHatchWaves();
@ -203,7 +203,7 @@ export class Egg {
}
};
const seedOverride = Utils.randomString(24);
const seedOverride = randomString(24);
globalScene.executeWithSeedOffset(
() => {
generateEggProperties(eggOptions);
@ -248,18 +248,15 @@ export class Egg {
let pokemonSpecies = getPokemonSpecies(this._species);
// Special condition to have Phione eggs also have a chance of generating Manaphy
if (this._species === Species.PHIONE && this._sourceType === EggSourceType.SAME_SPECIES_EGG) {
pokemonSpecies = getPokemonSpecies(
Utils.randSeedInt(MANAPHY_EGG_MANAPHY_RATE) ? Species.PHIONE : Species.MANAPHY,
);
pokemonSpecies = getPokemonSpecies(randSeedInt(MANAPHY_EGG_MANAPHY_RATE) ? Species.PHIONE : Species.MANAPHY);
}
// Sets the hidden ability if a hidden ability exists and
// the override is set or the egg hits the chance
let abilityIndex: number | undefined = undefined;
const sameSpeciesEggHACheck =
this._sourceType === EggSourceType.SAME_SPECIES_EGG && !Utils.randSeedInt(SAME_SPECIES_EGG_HA_RATE);
const gachaEggHACheck =
!(this._sourceType === EggSourceType.SAME_SPECIES_EGG) && !Utils.randSeedInt(GACHA_EGG_HA_RATE);
this._sourceType === EggSourceType.SAME_SPECIES_EGG && !randSeedInt(SAME_SPECIES_EGG_HA_RATE);
const gachaEggHACheck = !(this._sourceType === EggSourceType.SAME_SPECIES_EGG) && !randSeedInt(GACHA_EGG_HA_RATE);
if (pokemonSpecies.abilityHidden && (this._overrideHiddenAbility || sameSpeciesEggHACheck || gachaEggHACheck)) {
abilityIndex = 2;
}
@ -269,7 +266,7 @@ export class Egg {
ret.shiny = this._isShiny;
ret.variant = this._variantTier;
const secondaryIvs = Utils.getIvsFromId(Utils.randSeedInt(4294967295));
const secondaryIvs = getIvsFromId(randSeedInt(4294967295));
for (let s = 0; s < ret.ivs.length; s++) {
ret.ivs[s] = Math.max(ret.ivs[s], secondaryIvs[s]);
@ -370,7 +367,7 @@ export class Egg {
}
const tierMultiplier = this.isManaphyEgg() ? 2 : Math.pow(2, 3 - this.tier);
return Utils.randSeedInt(baseChance * tierMultiplier) ? Utils.randSeedInt(3) : 3;
return randSeedInt(baseChance * tierMultiplier) ? randSeedInt(3) : 3;
}
private getEggTierDefaultHatchWaves(eggTier?: EggTier): number {
@ -392,7 +389,7 @@ export class Egg {
private rollEggTier(): EggTier {
const tierValueOffset =
this._sourceType === EggSourceType.GACHA_LEGENDARY ? GACHA_LEGENDARY_UP_THRESHOLD_OFFSET : 0;
const tierValue = Utils.randInt(256);
const tierValue = randInt(256);
return tierValue >= GACHA_DEFAULT_COMMON_EGG_THRESHOLD + tierValueOffset
? EggTier.COMMON
: tierValue >= GACHA_DEFAULT_RARE_EGG_THRESHOLD + tierValueOffset
@ -417,11 +414,11 @@ export class Egg {
* when Utils.randSeedInt(8) = 1, and by making the generatePlayerPokemon() species
* check pass when Utils.randSeedInt(8) = 0, we can tell them apart during tests.
*/
const rand = Utils.randSeedInt(MANAPHY_EGG_MANAPHY_RATE) !== 1;
const rand = randSeedInt(MANAPHY_EGG_MANAPHY_RATE) !== 1;
return rand ? Species.PHIONE : Species.MANAPHY;
}
if (this.tier === EggTier.LEGENDARY && this._sourceType === EggSourceType.GACHA_LEGENDARY) {
if (!Utils.randSeedInt(2)) {
if (!randSeedInt(2)) {
return getLegendaryGachaSpeciesForTimestamp(this.timestamp);
}
}
@ -501,7 +498,7 @@ export class Egg {
let species: Species;
const rand = Utils.randSeedInt(totalWeight);
const rand = randSeedInt(totalWeight);
for (let s = 0; s < speciesWeights.length; s++) {
if (rand < speciesWeights[s]) {
species = speciesPool[s];
@ -539,7 +536,7 @@ export class Egg {
break;
}
return !Utils.randSeedInt(shinyChance);
return !randSeedInt(shinyChance);
}
// Uses the same logic as pokemon.generateVariant(). I would like to only have this logic in one
@ -550,7 +547,7 @@ export class Egg {
return VariantTier.STANDARD;
}
const rand = Utils.randSeedInt(10);
const rand = randSeedInt(10);
if (rand >= SHINY_VARIANT_CHANCE) {
return VariantTier.STANDARD; // 6/10
}

File diff suppressed because it is too large Load Diff

View File

@ -12,7 +12,7 @@ import { modifierTypes } from "#app/modifier/modifier-type";
import { MysteryEncounterType } from "#enums/mystery-encounter-type";
import { PartyMemberStrength } from "#enums/party-member-strength";
import { globalScene } from "#app/global-scene";
import * as Utils from "#app/utils";
import { randSeedInt } from "#app/utils";
import type MysteryEncounter from "#app/data/mystery-encounters/mystery-encounter";
import { MysteryEncounterBuilder } from "#app/data/mystery-encounters/mystery-encounter";
import { MysteryEncounterTier } from "#enums/mystery-encounter-tier";
@ -46,7 +46,7 @@ export const MysteriousChallengersEncounter: MysteryEncounter = MysteryEncounter
const normalConfig = trainerConfigs[normalTrainerType].clone();
let female = false;
if (normalConfig.hasGenders) {
female = !!Utils.randSeedInt(2);
female = !!randSeedInt(2);
}
const normalSpriteKey = normalConfig.getSpriteKey(female, normalConfig.doubleOnly);
encounter.enemyPartyConfigs.push({
@ -76,7 +76,7 @@ export const MysteriousChallengersEncounter: MysteryEncounter = MysteryEncounter
hardConfig.setPartyTemplates(hardTemplate);
female = false;
if (hardConfig.hasGenders) {
female = !!Utils.randSeedInt(2);
female = !!randSeedInt(2);
}
const hardSpriteKey = hardConfig.getSpriteKey(female, hardConfig.doubleOnly);
encounter.enemyPartyConfigs.push({
@ -96,7 +96,7 @@ export const MysteriousChallengersEncounter: MysteryEncounter = MysteryEncounter
brutalConfig.partyTemplateFunc = null; // Overrides gym leader party template func
female = false;
if (brutalConfig.hasGenders) {
female = !!Utils.randSeedInt(2);
female = !!randSeedInt(2);
}
const brutalSpriteKey = brutalConfig.getSpriteKey(female, brutalConfig.doubleOnly);
encounter.enemyPartyConfigs.push({

View File

@ -5,7 +5,7 @@ import { capitalizeFirstLetter, isNullOrUndefined } from "#app/utils";
import type { MysteryEncounterType } from "#enums/mystery-encounter-type";
import type { MysteryEncounterSpriteConfig } from "#app/field/mystery-encounter-intro";
import MysteryEncounterIntroVisuals from "#app/field/mystery-encounter-intro";
import * as Utils from "#app/utils";
import { randSeedInt } from "#app/utils";
import type { StatusEffect } from "#enums/status-effect";
import type { OptionTextDisplay } from "./mystery-encounter-dialogue";
import type MysteryEncounterDialogue from "./mystery-encounter-dialogue";
@ -378,13 +378,13 @@ export default class MysteryEncounter implements IMysteryEncounter {
}
if (truePrimaryPool.length > 0) {
// Always choose from the non-overlapping pokemon first
this.primaryPokemon = truePrimaryPool[Utils.randSeedInt(truePrimaryPool.length, 0)];
this.primaryPokemon = truePrimaryPool[randSeedInt(truePrimaryPool.length, 0)];
return true;
}
// If there are multiple overlapping pokemon, we're okay - just choose one and take it out of the primary pokemon pool
if (overlap.length > 1 || this.secondaryPokemon.length - overlap.length >= 1) {
// is this working?
this.primaryPokemon = overlap[Utils.randSeedInt(overlap.length, 0)];
this.primaryPokemon = overlap[randSeedInt(overlap.length, 0)];
this.secondaryPokemon = this.secondaryPokemon.filter(supp => supp !== this.primaryPokemon);
return true;
}
@ -394,7 +394,7 @@ export default class MysteryEncounter implements IMysteryEncounter {
return false;
}
// this means we CAN have the same pokemon be a primary and secondary pokemon, so just choose any qualifying one randomly.
this.primaryPokemon = qualified[Utils.randSeedInt(qualified.length, 0)];
this.primaryPokemon = qualified[randSeedInt(qualified.length, 0)];
return true;
}

View File

@ -30,8 +30,7 @@ import type { OptionSelectConfig, OptionSelectItem } from "#app/ui/abstact-optio
import type { PartyOption, PokemonSelectFilter } from "#app/ui/party-ui-handler";
import { PartyUiMode } from "#app/ui/party-ui-handler";
import { Mode } from "#app/ui/ui";
import * as Utils from "#app/utils";
import { isNullOrUndefined, randSeedInt, randSeedItem } from "#app/utils";
import { isNullOrUndefined, randSeedInt, randomString, randSeedItem } from "#app/utils";
import type { BattlerTagType } from "#enums/battler-tag-type";
import { Biome } from "#enums/biome";
import type { TrainerType } from "#enums/trainer-type";
@ -58,7 +57,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";
@ -168,7 +167,7 @@ export async function initBattleWithEnemyConfig(partyConfig: EnemyPartyConfig):
const doubleTrainer = trainerConfig.doubleOnly || (trainerConfig.hasDouble && !!partyConfig.doubleBattle);
doubleBattle = doubleTrainer;
const trainerFemale = isNullOrUndefined(partyConfig.female) ? !!Utils.randSeedInt(2) : partyConfig.female;
const trainerFemale = isNullOrUndefined(partyConfig.female) ? !!randSeedInt(2) : partyConfig.female;
const newTrainer = new Trainer(
trainerConfig.trainerType,
doubleTrainer ? TrainerVariant.DOUBLE : trainerFemale ? TrainerVariant.FEMALE : TrainerVariant.DEFAULT,
@ -286,7 +285,7 @@ export async function initBattleWithEnemyConfig(partyConfig: EnemyPartyConfig):
// Generate new id, reset status and HP in case using data source
if (config.dataSource) {
enemyPokemon.id = Utils.randSeedInt(4294967296);
enemyPokemon.id = randSeedInt(4294967296);
}
// Set form
@ -1115,7 +1114,7 @@ export function calculateMEAggregateStats(baseSpawnWeight: number) {
const validMEfloorsByBiome = new Map<string, number>(biomes.map(b => [b, 0]));
let currentBiome = Biome.TOWN;
let currentArena = globalScene.newArena(currentBiome);
globalScene.setSeed(Utils.randomString(24));
globalScene.setSeed(randomString(24));
globalScene.resetSeed();
for (let i = 10; i < 180; i++) {
// Boss
@ -1130,16 +1129,16 @@ export function calculateMEAggregateStats(baseSpawnWeight: number) {
globalScene.executeWithSeedOffset(() => {
biomes = (biomeLinks[currentBiome] as (Biome | [Biome, number])[])
.filter(b => {
return !Array.isArray(b) || !Utils.randSeedInt(b[1]);
return !Array.isArray(b) || !randSeedInt(b[1]);
})
.map(b => (!Array.isArray(b) ? b : b[0]));
}, i * 100);
if (biomes! && biomes.length > 0) {
const specialBiomes = biomes.filter(b => alwaysPickTheseBiomes.includes(b));
if (specialBiomes.length > 0) {
currentBiome = specialBiomes[Utils.randSeedInt(specialBiomes.length)];
currentBiome = specialBiomes[randSeedInt(specialBiomes.length)];
} else {
currentBiome = biomes[Utils.randSeedInt(biomes.length)];
currentBiome = biomes[randSeedInt(biomes.length)];
}
}
} else if (biomeLinks.hasOwnProperty(currentBiome)) {
@ -1167,7 +1166,7 @@ export function calculateMEAggregateStats(baseSpawnWeight: number) {
// Otherwise, roll encounter
const roll = Utils.randSeedInt(256);
const roll = randSeedInt(256);
validMEfloorsByBiome.set(Biome[currentBiome], (validMEfloorsByBiome.get(Biome[currentBiome]) ?? 0) + 1);
// If total number of encounters is lower than expected for the run, slightly favor a new encounter
@ -1192,7 +1191,7 @@ export function calculateMEAggregateStats(baseSpawnWeight: number) {
tierWeights[1] = tierWeights[1] - 4 * numEncounters[1];
const totalWeight = tierWeights.reduce((a, b) => a + b);
const tierValue = Utils.randSeedInt(totalWeight);
const tierValue = randSeedInt(totalWeight);
const commonThreshold = totalWeight - tierWeights[0]; // 64 - 32 = 32
const uncommonThreshold = totalWeight - tierWeights[0] - tierWeights[1]; // 64 - 32 - 16 = 16
const rareThreshold = totalWeight - tierWeights[0] - tierWeights[1] - tierWeights[2]; // 64 - 32 - 16 - 10 = 6
@ -1281,7 +1280,7 @@ export function calculateRareSpawnAggregateStats(luckValue: number) {
const calculateNumRareEncounters = (): any[] => {
const bossEncountersByRarity = [0, 0, 0, 0];
globalScene.setSeed(Utils.randomString(24));
globalScene.setSeed(randomString(24));
globalScene.resetSeed();
// There are 12 wild boss floors
for (let i = 0; i < 12; i++) {
@ -1291,7 +1290,7 @@ export function calculateRareSpawnAggregateStats(luckValue: number) {
if (!Number.isNaN(luckValue)) {
luckModifier = luckValue * 0.5;
}
const tierValue = Utils.randSeedInt(64 - luckModifier);
const tierValue = randSeedInt(64 - luckModifier);
const tier =
tierValue >= 20
? BiomePoolTier.BOSS

View File

@ -1,4 +1,4 @@
import * as Utils from "../utils";
import { toReadableString } from "#app/utils";
import { TextStyle, getBBCodeFrag } from "../ui/text";
import { Nature } from "#enums/nature";
import { UiTheme } from "#enums/ui-theme";
@ -12,7 +12,7 @@ export function getNatureName(
ignoreBBCode = false,
uiTheme: UiTheme = UiTheme.DEFAULT,
): string {
let ret = Utils.toReadableString(Nature[nature]);
let ret = toReadableString(Nature[nature]);
//Translating nature
if (i18next.exists(`nature:${ret}`)) {
ret = i18next.t(`nature:${ret}` as any);

View File

@ -8,7 +8,7 @@ import type { AnySound } from "#app/battle-scene";
import { globalScene } from "#app/global-scene";
import type { GameMode } from "#app/game-mode";
import { DexAttr, type StarterMoveset } from "#app/system/game-data";
import * as Utils from "#app/utils";
import { isNullOrUndefined, capitalizeString, randSeedInt, randSeedGauss, randSeedItem } from "#app/utils";
import { uncatchableSpecies } from "#app/data/balance/biomes";
import { speciesEggMoves } from "#app/data/balance/egg-moves";
import { GrowthRate } from "#app/data/exp";
@ -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,
@ -289,7 +290,7 @@ export abstract class PokemonSpeciesForm {
* @returns The id of the ability
*/
getPassiveAbility(formIndex?: number): Abilities {
if (Utils.isNullOrUndefined(formIndex)) {
if (isNullOrUndefined(formIndex)) {
formIndex = this.formIndex;
}
let starterSpeciesId = this.speciesId;
@ -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<void> {
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<void>(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 (!isNullOrUndefined(variant)) {
loadPokemonVariantAssets(spriteKey, spritePath, variant).then(() => resolve());
}
});
if (startLoad) {
if (!globalScene.load.isLoading()) {
@ -845,8 +852,8 @@ export default class PokemonSpecies extends PokemonSpeciesForm implements Locali
*/
getFormNameToDisplay(formIndex = 0, append = false): string {
const formKey = this.forms?.[formIndex!]?.formKey;
const formText = Utils.capitalizeString(formKey, "-", false, false) || "";
const speciesName = Utils.capitalizeString(Species[this.speciesId], "_", true, false);
const formText = capitalizeString(formKey, "-", false, false) || "";
const speciesName = capitalizeString(Species[this.speciesId], "_", true, false);
let ret = "";
const region = this.getRegion();
@ -877,7 +884,7 @@ export default class PokemonSpecies extends PokemonSpeciesForm implements Locali
if (i18next.exists(i18key)) {
ret = i18next.t(i18key);
} else {
const rootSpeciesName = Utils.capitalizeString(Species[this.getRootSpeciesId()], "_", true, false);
const rootSpeciesName = capitalizeString(Species[this.getRootSpeciesId()], "_", true, false);
const i18RootKey = `pokemonForm:${rootSpeciesName}${formText}`;
ret = i18next.exists(i18RootKey) ? i18next.t(i18RootKey) : formText;
}
@ -1072,7 +1079,7 @@ export default class PokemonSpecies extends PokemonSpeciesForm implements Locali
return this.speciesId;
}
const randValue = evolutionPool.size === 1 ? 0 : Utils.randSeedInt(totalWeight);
const randValue = evolutionPool.size === 1 ? 0 : randSeedInt(totalWeight);
for (const weight of evolutionPool.keys()) {
if (randValue < weight) {
@ -1157,7 +1164,7 @@ export default class PokemonSpecies extends PokemonSpeciesForm implements Locali
Math.min(
Math.max(
evolution?.level! +
Math.round(Utils.randSeedGauss(0.5, 1 + levelDiff * 0.2) * Math.max(evolution?.wildDelay!, 0.5) * 5) -
Math.round(randSeedGauss(0.5, 1 + levelDiff * 0.2) * Math.max(evolution?.wildDelay!, 0.5) * 5) -
1,
2,
evolution?.level!,
@ -1175,7 +1182,7 @@ export default class PokemonSpecies extends PokemonSpeciesForm implements Locali
Math.min(
Math.max(
lastPrevolutionLevel +
Math.round(Utils.randSeedGauss(0.5, 1 + levelDiff * 0.2) * Math.max(evolution?.wildDelay!, 0.5) * 5),
Math.round(randSeedGauss(0.5, 1 + levelDiff * 0.2) * Math.max(evolution?.wildDelay!, 0.5) * 5),
lastPrevolutionLevel + 1,
evolution?.level!,
),
@ -1360,7 +1367,7 @@ export function getPokerusStarters(): PokemonSpecies[] {
globalScene.executeWithSeedOffset(
() => {
while (pokerusStarters.length < POKERUS_STARTER_COUNT) {
const randomSpeciesId = Number.parseInt(Utils.randSeedItem(Object.keys(speciesStarterCosts)), 10);
const randomSpeciesId = Number.parseInt(randSeedItem(Object.keys(speciesStarterCosts)), 10);
const species = getPokemonSpecies(randomSpeciesId);
if (!pokerusStarters.includes(species)) {
pokerusStarters.push(species);

View File

@ -1,12 +1,12 @@
import { TrainerType } from "#enums/trainer-type";
import * as Utils from "../utils";
import { toReadableString } from "#app/utils";
class TrainerNameConfig {
public urls: string[];
public femaleUrls: string[] | null;
constructor(type: TrainerType, ...urls: string[]) {
this.urls = urls.length ? urls : [Utils.toReadableString(TrainerType[type]).replace(/ /g, "_")];
this.urls = urls.length ? urls : [toReadableString(TrainerType[type]).replace(/ /g, "_")];
}
hasGenderVariant(...femaleUrls: string[]): TrainerNameConfig {

View File

@ -1,7 +1,7 @@
import { globalScene } from "#app/global-scene";
import { modifierTypes } from "#app/modifier/modifier-type";
import { PokemonMove } from "#app/field/pokemon";
import * as Utils from "#app/utils";
import { toReadableString, isNullOrUndefined, randSeedItem, randSeedInt } from "#app/utils";
import { pokemonEvolutions, pokemonPrevolutions } from "#app/data/balance/pokemon-evolutions";
import { getPokemonSpecies } from "#app/data/pokemon-species";
import { tmSpecies } from "#app/data/balance/tms";
@ -139,7 +139,7 @@ export class TrainerConfig {
constructor(trainerType: TrainerType, allowLegendaries?: boolean) {
this.trainerType = trainerType;
this.trainerAI = new TrainerAI();
this.name = Utils.toReadableString(TrainerType[this.getDerivedType()]);
this.name = toReadableString(TrainerType[this.getDerivedType()]);
this.battleBgm = "battle_trainer";
this.mixedBattleBgm = "battle_trainer";
this.victoryBgm = "victory_trainer";
@ -482,10 +482,10 @@ export class TrainerConfig {
.fill(null)
.map((_, i) => i)
.filter(i => shedinjaCanTera || party[i].species.speciesId !== Species.SHEDINJA); // Shedinja can only Tera on Bug specialty type (or no specialty type)
const setPartySlot = !Utils.isNullOrUndefined(slot) ? Phaser.Math.Wrap(slot, 0, party.length) : -1; // If we have a tera slot defined, wrap it to party size.
const setPartySlot = !isNullOrUndefined(slot) ? Phaser.Math.Wrap(slot, 0, party.length) : -1; // If we have a tera slot defined, wrap it to party size.
for (let t = 0; t < Math.min(count(), party.length); t++) {
const randomIndex =
partyMemberIndexes.indexOf(setPartySlot) > -1 ? setPartySlot : Utils.randSeedItem(partyMemberIndexes);
partyMemberIndexes.indexOf(setPartySlot) > -1 ? setPartySlot : randSeedItem(partyMemberIndexes);
partyMemberIndexes.splice(partyMemberIndexes.indexOf(randomIndex), 1);
if (this.hasSpecialtyType()) {
party[randomIndex].teraType = this.specialtyType;
@ -555,7 +555,7 @@ export class TrainerConfig {
initI18n();
}
if (!Utils.isNullOrUndefined(specialtyType)) {
if (!isNullOrUndefined(specialtyType)) {
this.setSpecialtyType(specialtyType);
}
@ -636,7 +636,7 @@ export class TrainerConfig {
}
this.setPartyMemberFunc(-(s + 1), getRandomPartyMemberFunc(speciesPool));
});
if (!Utils.isNullOrUndefined(specialtyType)) {
if (!isNullOrUndefined(specialtyType)) {
this.setSpeciesFilter(p => p.isOfType(specialtyType));
this.setSpecialtyType(specialtyType);
}
@ -749,7 +749,7 @@ export class TrainerConfig {
});
// Set species filter and specialty type if provided, otherwise filter by base total.
if (!Utils.isNullOrUndefined(specialtyType)) {
if (!isNullOrUndefined(specialtyType)) {
this.setSpeciesFilter(p => p.isOfType(specialtyType) && p.baseTotal >= ELITE_FOUR_MINIMUM_BST);
this.setSpecialtyType(specialtyType);
} else {
@ -927,7 +927,7 @@ export class TrainerConfig {
* @returns true if specialtyType is defined and not Type.UNKNOWN
*/
hasSpecialtyType(): boolean {
return !Utils.isNullOrUndefined(this.specialtyType) && this.specialtyType !== PokemonType.UNKNOWN;
return !isNullOrUndefined(this.specialtyType) && this.specialtyType !== PokemonType.UNKNOWN;
}
/**
@ -1006,7 +1006,7 @@ export function getRandomPartyMemberFunc(
postProcess?: (enemyPokemon: EnemyPokemon) => void,
) {
return (level: number, strength: PartyMemberStrength) => {
let species = Utils.randSeedItem(speciesPool);
let species = randSeedItem(speciesPool);
if (!ignoreEvolution) {
species = getPokemonSpecies(species).getTrainerSpeciesForLevel(
level,
@ -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)
@ -3554,7 +3549,7 @@ export const trainerConfigs: TrainerConfigs = {
.setPartyMemberFunc(
5,
getRandomPartyMemberFunc([Species.URSHIFU], TrainerSlot.TRAINER, true, p => {
p.formIndex = Utils.randSeedInt(2, 2); // Random G-Max Urshifu
p.formIndex = randSeedInt(2, 2); // Random G-Max Urshifu
p.generateAndPopulateMoveset();
p.generateName();
p.gender = Gender.MALE;
@ -3664,10 +3659,10 @@ export const trainerConfigs: TrainerConfigs = {
.setPartyMemberFunc(
4,
getRandomPartyMemberFunc([Species.OGERPON], TrainerSlot.TRAINER, true, p => {
p.formIndex = Utils.randSeedInt(4); // Random Ogerpon Tera Mask
p.formIndex = randSeedInt(4); // Random Ogerpon Tera Mask
p.generateAndPopulateMoveset();
p.pokeball = PokeballType.ULTRA_BALL;
if (!p.moveset.some(move => !Utils.isNullOrUndefined(move) && move.moveId === Moves.IVY_CUDGEL)) {
if (!p.moveset.some(move => !isNullOrUndefined(move) && move.moveId === Moves.IVY_CUDGEL)) {
// Check if Ivy Cudgel is in the moveset, if not, replace the first move with Ivy Cudgel.
p.moveset[0] = new PokemonMove(Moves.IVY_CUDGEL);
}
@ -4718,10 +4713,10 @@ export const trainerConfigs: TrainerConfigs = {
.setPartyMemberFunc(
2,
getRandomPartyMemberFunc([Species.SILVALLY], TrainerSlot.TRAINER, true, p => {
p.formIndex = Utils.randSeedInt(18); // Random Silvally Form
p.formIndex = randSeedInt(18); // Random Silvally Form
p.generateAndPopulateMoveset();
p.pokeball = PokeballType.ROGUE_BALL;
if (!p.moveset.some(move => !Utils.isNullOrUndefined(move) && move.moveId === Moves.MULTI_ATTACK)) {
if (!p.moveset.some(move => !isNullOrUndefined(move) && move.moveId === Moves.MULTI_ATTACK)) {
// Check if Multi Attack is in the moveset, if not, replace the first move with Multi Attack.
p.moveset[0] = new PokemonMove(Moves.MULTI_ATTACK);
}
@ -4838,8 +4833,8 @@ export const trainerConfigs: TrainerConfigs = {
p.setBoss(true, 2);
p.generateAndPopulateMoveset();
p.pokeball = PokeballType.ULTRA_BALL;
p.formIndex = Utils.randSeedInt(4, 1); // Shock, Burn, Chill, or Douse Drive
if (!p.moveset.some(move => !Utils.isNullOrUndefined(move) && move.moveId === Moves.TECHNO_BLAST)) {
p.formIndex = randSeedInt(4, 1); // Shock, Burn, Chill, or Douse Drive
if (!p.moveset.some(move => !isNullOrUndefined(move) && move.moveId === Moves.TECHNO_BLAST)) {
// Check if Techno Blast is in the moveset, if not, replace the first move with Techno Blast.
p.moveset[2] = new PokemonMove(Moves.TECHNO_BLAST);
}
@ -5011,7 +5006,7 @@ export const trainerConfigs: TrainerConfigs = {
1,
getRandomPartyMemberFunc([Species.ROTOM], TrainerSlot.TRAINER, true, p => {
p.generateAndPopulateMoveset();
p.formIndex = Utils.randSeedInt(5, 1); // Heat, Wash, Frost, Fan, or Mow
p.formIndex = randSeedInt(5, 1); // Heat, Wash, Frost, Fan, or Mow
}),
)
.setPartyMemberFunc(
@ -5024,7 +5019,7 @@ export const trainerConfigs: TrainerConfigs = {
.setPartyMemberFunc(
3,
getRandomPartyMemberFunc([Species.REVAVROOM], TrainerSlot.TRAINER, true, p => {
p.formIndex = Utils.randSeedInt(5, 1); // Random Starmobile form
p.formIndex = randSeedInt(5, 1); // Random Starmobile form
p.generateAndPopulateMoveset();
p.pokeball = PokeballType.ROGUE_BALL;
}),

View File

@ -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;
}
}

View File

@ -5,7 +5,7 @@ import type Pokemon from "../field/pokemon";
import { PokemonType } from "#enums/pokemon-type";
import type Move from "./moves/move";
import { AttackMove } from "./moves/move";
import * as Utils from "../utils";
import { randSeedInt } from "#app/utils";
import { SuppressWeatherEffectAbAttr } from "./ability";
import { TerrainType, getTerrainName } from "./terrain";
import i18next from "i18next";
@ -416,7 +416,7 @@ export function getRandomWeatherType(arena: Arena): WeatherType {
totalWeight += w.weight;
}
const rand = Utils.randSeedInt(totalWeight);
const rand = randSeedInt(totalWeight);
let w = 0;
for (const weather of weatherPool) {
w += weather.weight;

View File

@ -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 {

View File

@ -1,8 +1,7 @@
import { globalScene } from "#app/global-scene";
import type { BiomeTierTrainerPools, PokemonPools } from "#app/data/balance/biomes";
import { biomePokemonPools, BiomePoolTier, biomeTrainerPools } from "#app/data/balance/biomes";
import type { Constructor } from "#app/utils";
import * as Utils from "#app/utils";
import { randSeedInt, NumberHolder, isNullOrUndefined, type Constructor } from "#app/utils";
import type PokemonSpecies from "#app/data/pokemon-species";
import { getPokemonSpecies } from "#app/data/pokemon-species";
import {
@ -124,7 +123,7 @@ export class Arena {
if (typeof luckValue !== "undefined") {
luckModifier = luckValue * (isBossSpecies ? 0.5 : 2);
}
const tierValue = Utils.randSeedInt(randVal - luckModifier);
const tierValue = randSeedInt(randVal - luckModifier);
let tier = !isBossSpecies
? tierValue >= 156
? BiomePoolTier.COMMON
@ -153,7 +152,7 @@ export class Arena {
if (!tierPool.length) {
ret = globalScene.randomSpecies(waveIndex, level);
} else {
const entry = tierPool[Utils.randSeedInt(tierPool.length)];
const entry = tierPool[randSeedInt(tierPool.length)];
let species: Species;
if (typeof entry === "number") {
species = entry as Species;
@ -164,7 +163,7 @@ export class Arena {
if (level >= levelThreshold) {
const speciesIds = entry[levelThreshold];
if (speciesIds.length > 1) {
species = speciesIds[Utils.randSeedInt(speciesIds.length)];
species = speciesIds[randSeedInt(speciesIds.length)];
} else {
species = speciesIds[0];
}
@ -211,7 +210,7 @@ export class Arena {
!!this.trainerPool[BiomePoolTier.BOSS].length &&
(globalScene.gameMode.isTrainerBoss(waveIndex, this.biomeType, globalScene.offsetGym) || isBoss);
console.log(isBoss, this.trainerPool);
const tierValue = Utils.randSeedInt(!isTrainerBoss ? 512 : 64);
const tierValue = randSeedInt(!isTrainerBoss ? 512 : 64);
let tier = !isTrainerBoss
? tierValue >= 156
? BiomePoolTier.COMMON
@ -235,7 +234,7 @@ export class Arena {
tier--;
}
const tierPool = this.trainerPool[tier] || [];
return !tierPool.length ? TrainerType.BREEDER : tierPool[Utils.randSeedInt(tierPool.length)];
return !tierPool.length ? TrainerType.BREEDER : tierPool[randSeedInt(tierPool.length)];
}
getSpeciesFormIndex(species: PokemonSpecies): number {
@ -336,9 +335,9 @@ export class Arena {
return false;
}
const weatherDuration = new Utils.NumberHolder(0);
const weatherDuration = new NumberHolder(0);
if (!Utils.isNullOrUndefined(user)) {
if (!isNullOrUndefined(user)) {
weatherDuration.value = 5;
globalScene.applyModifier(FieldEffectModifier, user.isPlayer(), user, weatherDuration);
}
@ -417,9 +416,9 @@ export class Arena {
const oldTerrainType = this.terrain?.terrainType || TerrainType.NONE;
const terrainDuration = new Utils.NumberHolder(0);
const terrainDuration = new NumberHolder(0);
if (!Utils.isNullOrUndefined(user)) {
if (!isNullOrUndefined(user)) {
terrainDuration.value = 5;
globalScene.applyModifier(FieldEffectModifier, user.isPlayer(), user, terrainDuration);
}
@ -1013,7 +1012,7 @@ export class ArenaBase extends Phaser.GameObjects.Container {
if (!this.player) {
globalScene.executeWithSeedOffset(
() => {
this.propValue = propValue === undefined ? (hasProps ? Utils.randSeedInt(8) : 0) : propValue;
this.propValue = propValue === undefined ? (hasProps ? randSeedInt(8) : 0) : propValue;
this.props.forEach((prop, p) => {
const propKey = `${biomeKey}_b${hasProps ? `_${p + 1}` : ""}`;
prop.setTexture(propKey);

View File

@ -2,7 +2,7 @@ import { TextStyle, addTextObject } from "../ui/text";
import type { DamageResult } from "./pokemon";
import type Pokemon from "./pokemon";
import { HitResult } from "./pokemon";
import * as Utils from "../utils";
import { formatStat, fixedInt } from "#app/utils";
import type { BattlerIndex } from "../battle";
import { globalScene } from "#app/global-scene";
@ -30,7 +30,7 @@ export default class DamageNumberHandler {
const damageNumber = addTextObject(
target.x,
-(globalScene.game.canvas.height / 6) + target.y - target.getSprite().height / 2,
Utils.formatStat(amount, true),
formatStat(amount, true),
TextStyle.SUMMARY,
);
damageNumber.setName("text-damage-number");
@ -86,14 +86,14 @@ export default class DamageNumberHandler {
if (globalScene.damageNumbersMode === 1) {
globalScene.tweens.add({
targets: damageNumber,
duration: Utils.fixedInt(750),
duration: fixedInt(750),
alpha: 1,
y: "-=32",
});
globalScene.tweens.add({
delay: 375,
targets: damageNumber,
duration: Utils.fixedInt(625),
duration: fixedInt(625),
alpha: 0,
ease: "Sine.easeIn",
onComplete: () => {
@ -110,7 +110,7 @@ export default class DamageNumberHandler {
targets: damageNumber,
tweens: [
{
duration: Utils.fixedInt(250),
duration: fixedInt(250),
alpha: 1,
scaleX: 0.75 * baseScale,
scaleY: 1.25 * baseScale,
@ -118,7 +118,7 @@ export default class DamageNumberHandler {
ease: "Cubic.easeOut",
},
{
duration: Utils.fixedInt(175),
duration: fixedInt(175),
alpha: 1,
scaleX: 0.875 * baseScale,
scaleY: 1.125 * baseScale,
@ -126,59 +126,59 @@ export default class DamageNumberHandler {
ease: "Cubic.easeIn",
},
{
duration: Utils.fixedInt(100),
duration: fixedInt(100),
scaleX: 1.25 * baseScale,
scaleY: 0.75 * baseScale,
ease: "Cubic.easeOut",
},
{
duration: Utils.fixedInt(175),
duration: fixedInt(175),
scaleX: 0.875 * baseScale,
scaleY: 1.125 * baseScale,
y: "-=8",
ease: "Cubic.easeOut",
},
{
duration: Utils.fixedInt(50),
duration: fixedInt(50),
scaleX: 0.925 * baseScale,
scaleY: 1.075 * baseScale,
y: "+=8",
ease: "Cubic.easeIn",
},
{
duration: Utils.fixedInt(100),
duration: fixedInt(100),
scaleX: 1.125 * baseScale,
scaleY: 0.875 * baseScale,
ease: "Cubic.easeOut",
},
{
duration: Utils.fixedInt(175),
duration: fixedInt(175),
scaleX: 0.925 * baseScale,
scaleY: 1.075 * baseScale,
y: "-=4",
ease: "Cubic.easeOut",
},
{
duration: Utils.fixedInt(50),
duration: fixedInt(50),
scaleX: 0.975 * baseScale,
scaleY: 1.025 * baseScale,
y: "+=4",
ease: "Cubic.easeIn",
},
{
duration: Utils.fixedInt(100),
duration: fixedInt(100),
scaleX: 1.075 * baseScale,
scaleY: 0.925 * baseScale,
ease: "Cubic.easeOut",
},
{
duration: Utils.fixedInt(25),
duration: fixedInt(25),
scaleX: baseScale,
scaleY: baseScale,
ease: "Cubic.easeOut",
},
{
delay: Utils.fixedInt(500),
delay: fixedInt(500),
alpha: 0,
onComplete: () => {
this.damageNumbers

View File

@ -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", "");

View File

@ -1,6 +1,6 @@
import { globalScene } from "#app/global-scene";
import Pokemon from "./pokemon";
import * as Utils from "../utils";
import { fixedInt, randInt } from "#app/utils";
export default class PokemonSpriteSparkleHandler {
private sprites: Set<Phaser.GameObjects.Sprite>;
@ -9,7 +9,7 @@ export default class PokemonSpriteSparkleHandler {
this.sprites = new Set();
globalScene.tweens.addCounter({
duration: Utils.fixedInt(200),
duration: fixedInt(200),
from: 0,
to: 1,
yoyo: true,
@ -36,7 +36,7 @@ export default class PokemonSpriteSparkleHandler {
const parent = (pokemon || s).parentContainer;
const texture = s.texture;
const [width, height] = [texture.source[0].width, texture.source[0].height];
const [pixelX, pixelY] = [Utils.randInt(width), Utils.randInt(height)];
const [pixelX, pixelY] = [randInt(width), randInt(height)];
const ratioX = s.width / width;
const ratioY = s.height / height;
const pixel = texture.manager.getPixel(pixelX, pixelY, texture.key, "__BASE");
@ -51,7 +51,7 @@ export default class PokemonSpriteSparkleHandler {
sparkle.setName("sprite-tera-sparkle");
sparkle.play("tera_sparkle");
parent.add(sparkle);
s.scene.time.delayedCall(Utils.fixedInt(Math.floor((1000 / 12) * 13)), () => sparkle.destroy());
s.scene.time.delayedCall(fixedInt(Math.floor((1000 / 12) * 13)), () => sparkle.destroy());
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -11,7 +11,7 @@ import { TrainerSlot } from "#enums/trainer-slot";
import { TrainerPoolTier } from "#enums/trainer-pool-tier";
import { TeraAIMode } from "#enums/tera-ai-mode";
import type { EnemyPokemon } from "#app/field/pokemon";
import * as Utils from "#app/utils";
import { randSeedWeightedItem, randSeedItem, randSeedInt } from "#app/utils";
import type { PersistentModifier } from "#app/modifier/modifier";
import { ArenaTagSide, ArenaTrapTag } from "#app/data/arena-tag";
import { getIsInitialized, initI18n } from "#app/plugins/i18n";
@ -58,7 +58,7 @@ export default class Trainer extends Phaser.GameObjects.Container {
this.partyTemplateIndex = Math.min(
partyTemplateIndex !== undefined
? partyTemplateIndex
: Utils.randSeedWeightedItem(this.config.partyTemplates.map((_, i) => i)),
: randSeedWeightedItem(this.config.partyTemplates.map((_, i) => i)),
this.config.partyTemplates.length - 1,
);
const classKey = `trainersCommon:${TrainerType[trainerType]}`;
@ -71,9 +71,7 @@ export default class Trainer extends Phaser.GameObjects.Container {
? ".FEMALE"
: ".MALE"
: "";
const trainerKey = Utils.randSeedItem(
Object.keys(i18next.t(`${classKey}${genderKey}`, { returnObjects: true })),
);
const trainerKey = randSeedItem(Object.keys(i18next.t(`${classKey}${genderKey}`, { returnObjects: true })));
this.nameKey = `${classKey}${genderKey}.${trainerKey}`;
}
this.name = i18next.t(this.nameKey);
@ -87,7 +85,7 @@ export default class Trainer extends Phaser.GameObjects.Container {
}
} else {
const partnerGenderKey = i18next.exists(`${classKey}.FEMALE`) ? ".FEMALE" : "";
const partnerTrainerKey = Utils.randSeedItem(
const partnerTrainerKey = randSeedItem(
Object.keys(
i18next.t(`${classKey}${partnerGenderKey}`, {
returnObjects: true,
@ -420,7 +418,7 @@ export default class Trainer extends Phaser.GameObjects.Container {
// If useNewSpeciesPool is true, we need to generate a new species from the new species pool, otherwise we generate a random species
let species = useNewSpeciesPool
? getPokemonSpecies(newSpeciesPool[Math.floor(Utils.randSeedInt(newSpeciesPool.length))])
? getPokemonSpecies(newSpeciesPool[Math.floor(randSeedInt(newSpeciesPool.length))])
: template.isSameSpecies(index) && index > offset
? getPokemonSpecies(
battle.enemyParty[offset].species.getTrainerSpeciesForLevel(
@ -461,7 +459,7 @@ export default class Trainer extends Phaser.GameObjects.Container {
let baseSpecies: PokemonSpecies;
if (this.config.speciesPools) {
const tierValue = Utils.randSeedInt(512);
const tierValue = randSeedInt(512);
let tier =
tierValue >= 156
? TrainerPoolTier.COMMON
@ -480,7 +478,7 @@ export default class Trainer extends Phaser.GameObjects.Container {
tier--;
}
const tierPool = this.config.speciesPools[tier];
baseSpecies = getPokemonSpecies(Utils.randSeedItem(tierPool));
baseSpecies = getPokemonSpecies(randSeedItem(tierPool));
} else {
baseSpecies = globalScene.randomSpecies(battle.waveIndex, level, false, this.config.speciesFilter);
}
@ -619,7 +617,7 @@ export default class Trainer extends Phaser.GameObjects.Container {
if (maxScorePartyMemberIndexes.length > 1) {
let rand: number;
globalScene.executeWithSeedOffset(
() => (rand = Utils.randSeedInt(maxScorePartyMemberIndexes.length)),
() => (rand = randSeedInt(maxScorePartyMemberIndexes.length)),
globalScene.currentBattle.turn << 2,
);
return maxScorePartyMemberIndexes[rand!];

View File

@ -7,7 +7,7 @@ import type PokemonSpecies from "./data/pokemon-species";
import { allSpecies } from "./data/pokemon-species";
import type { Arena } from "./field/arena";
import Overrides from "#app/overrides";
import * as Utils from "./utils";
import { randSeedInt, randSeedItem } from "#app/utils";
import { Biome } from "#enums/biome";
import { Species } from "#enums/species";
import { Challenges } from "./enums/challenges";
@ -186,7 +186,7 @@ export class GameMode implements GameModeConfig {
if (w < waveIndex) {
globalScene.executeWithSeedOffset(() => {
const waveTrainerChance = arena.getTrainerChance();
if (!Utils.randSeedInt(waveTrainerChance)) {
if (!randSeedInt(waveTrainerChance)) {
allowTrainerBattle = false;
}
}, w);
@ -196,7 +196,7 @@ export class GameMode implements GameModeConfig {
}
}
}
return Boolean(allowTrainerBattle && trainerChance && !Utils.randSeedInt(trainerChance));
return Boolean(allowTrainerBattle && trainerChance && !randSeedInt(trainerChance));
}
return false;
}
@ -222,7 +222,7 @@ export class GameMode implements GameModeConfig {
s.speciesId !== Species.ETERNATUS &&
s.speciesId !== Species.ARCEUS,
);
return Utils.randSeedItem(allFinalBossSpecies);
return randSeedItem(allFinalBossSpecies);
}
return null;

View File

@ -1,6 +1,5 @@
import Phaser from "phaser";
import * as Utils from "./utils";
import { deepCopy } from "./utils";
import { deepCopy, getEnumValues } from "#app/utils";
import pad_generic from "./configs/inputs/pad_generic";
import pad_unlicensedSNES from "./configs/inputs/pad_unlicensedSNES";
import pad_xbox360 from "./configs/inputs/pad_xbox360";
@ -102,7 +101,7 @@ export class InputsController {
[Device.KEYBOARD]: "default",
};
for (const b of Utils.getEnumValues(Button)) {
for (const b of getEnumValues(Button)) {
this.interactions[b] = {
pressTime: false,
isPressed: false,

View File

@ -4,7 +4,7 @@ import CacheBustedLoaderPlugin from "#app/plugins/cache-busted-loader-plugin";
import { SceneBase } from "#app/scene-base";
import { WindowVariant, getWindowVariantSuffix } from "#app/ui/ui-theme";
import { isMobile } from "#app/touch-controls";
import * as Utils from "#app/utils";
import { localPing, getEnumValues, hasAllLocalizedSprites, getEnumKeys } from "#app/utils";
import { initPokemonPrevolutions, initPokemonStarters } from "#app/data/balance/pokemon-evolutions";
import { initBiomes } from "#app/data/balance/biomes";
import { initEggMoves } from "#app/data/balance/egg-moves";
@ -34,7 +34,7 @@ export class LoadingScene extends SceneBase {
}
preload() {
Utils.localPing();
localPing();
this.load["manifest"] = this.game["manifest"];
this.loadImage("loading_bg", "arenas");
@ -49,7 +49,7 @@ export class LoadingScene extends SceneBase {
this.loadImage("friendship_overlay", "ui");
this.loadImage("cursor", "ui");
this.loadImage("cursor_reverse", "ui");
for (const wv of Utils.getEnumValues(WindowVariant)) {
for (const wv of getEnumValues(WindowVariant)) {
for (let w = 1; w <= 5; w++) {
this.loadImage(`window_${w}${getWindowVariantSuffix(wv)}`, "ui/windows");
}
@ -177,7 +177,7 @@ export class LoadingScene extends SceneBase {
this.loadImage("default_bg", "arenas");
// Load arena images
Utils.getEnumValues(Biome).map(bt => {
getEnumValues(Biome).map(bt => {
const btKey = Biome[bt].toLowerCase();
const isBaseAnimated = btKey === "end";
const baseAKey = `${btKey}_a`;
@ -239,7 +239,7 @@ export class LoadingScene extends SceneBase {
// Get current lang and load the types atlas for it. English will only load types while all other languages will load types and types_<lang>
const lang = i18next.resolvedLanguage;
if (lang !== "en") {
if (Utils.hasAllLocalizedSprites(lang)) {
if (hasAllLocalizedSprites(lang)) {
this.loadAtlas(`statuses_${lang}`, "");
this.loadAtlas(`types_${lang}`, "");
} else {
@ -268,7 +268,7 @@ export class LoadingScene extends SceneBase {
this.loadAtlas("egg_icons", "egg");
this.loadAtlas("egg_shard", "egg");
this.loadAtlas("egg_lightrays", "egg");
for (const gt of Utils.getEnumKeys(GachaType)) {
for (const gt of getEnumKeys(GachaType)) {
const key = gt.toLowerCase();
this.loadImage(`gacha_${key}`, "egg");
this.loadAtlas(`gacha_underlay_${key}`, "egg");

View File

@ -6,9 +6,10 @@ import i18next from "i18next";
/**
* Retrieves the Pokemon's name, potentially with an affix indicating its role (wild or foe) in the current battle context, translated
* @param pokemon {@linkcode Pokemon} name and battle context will be retrieved from this instance
* @param {boolean} useIllusion - Whether we want the name of the illusion or not. Default value : true
* @returns {string} ex: "Wild Gengar", "Ectoplasma sauvage"
*/
export function getPokemonNameWithAffix(pokemon: Pokemon | undefined): string {
export function getPokemonNameWithAffix(pokemon: Pokemon | undefined, useIllusion = true): string {
if (!pokemon) {
return "Missigno";
}
@ -18,19 +19,17 @@ export function getPokemonNameWithAffix(pokemon: Pokemon | undefined): string {
return !pokemon.isPlayer()
? pokemon.hasTrainer()
? i18next.t("battle:foePokemonWithAffix", {
pokemonName: pokemon.getNameToRender(),
pokemonName: pokemon.getNameToRender(useIllusion),
})
: i18next.t("battle:wildPokemonWithAffix", {
pokemonName: pokemon.getNameToRender(),
pokemonName: pokemon.getNameToRender(useIllusion),
})
: pokemon.getNameToRender();
: pokemon.getNameToRender(useIllusion);
case BattleSpec.FINAL_BOSS:
return !pokemon.isPlayer()
? i18next.t("battle:foePokemonWithAffix", {
pokemonName: pokemon.getNameToRender(),
})
: pokemon.getNameToRender();
? i18next.t("battle:foePokemonWithAffix", { pokemonName: pokemon.getNameToRender(useIllusion) })
: pokemon.getNameToRender(useIllusion);
default:
return pokemon.getNameToRender();
return pokemon.getNameToRender(useIllusion);
}
}

View File

@ -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";

View File

@ -1,7 +1,7 @@
import { BattlerIndex, BattleType } from "#app/battle";
import { globalScene } from "#app/global-scene";
import { PLAYER_PARTY_MAX_SIZE } from "#app/constants";
import { applyAbAttrs, SyncEncounterNatureAbAttr } from "#app/data/ability";
import { applyAbAttrs, SyncEncounterNatureAbAttr, applyPreSummonAbAttrs, PreSummonAbAttr } from "#app/data/ability";
import { initEncounterAnims, loadEncounterAnimAssets } from "#app/data/battle-anims";
import { getCharVariantFromDialogue } from "#app/data/dialogue";
import { getEncounterText } from "#app/data/mystery-encounters/utils/encounter-dialogue-utils";
@ -259,6 +259,9 @@ export class EncounterPhase extends BattlePhase {
}
if (e < (battle.double ? 2 : 1)) {
if (battle.battleType === BattleType.WILD) {
for (const pokemon of globalScene.getField()) {
applyPreSummonAbAttrs(PreSummonAbAttr, pokemon, []);
}
globalScene.field.add(enemyPokemon);
battle.seenEnemyPartyMemberIds.add(enemyPokemon.id);
const playerPokemon = globalScene.getPlayerPokemon();
@ -545,7 +548,7 @@ export class EncounterPhase extends BattlePhase {
const enemyField = globalScene.getEnemyField();
enemyField.forEach((enemyPokemon, e) => {
if (enemyPokemon.isShiny()) {
if (enemyPokemon.isShiny(true)) {
globalScene.unshiftPhase(new ShinySparklePhase(BattlerIndex.ENEMY + e));
}
/** This sets Eternatus' held item to be untransferrable, preventing it from being stolen */

View File

@ -71,6 +71,7 @@ export class LevelUpPhase extends PlayerPartyMemberPokemonPhase {
if (!this.pokemon.pauseEvolutions) {
const evolution = this.pokemon.getEvolution();
if (evolution) {
this.pokemon.breakIllusion()
globalScene.unshiftPhase(new EvolutionPhase(this.pokemon, evolution, this.lastLevel));
}
}

View File

@ -297,16 +297,16 @@ export class MoveEffectPhase extends PokemonPhase {
);
}
/** Is the target protected by Protect, etc. or a relevant conditional protection effect? */
const isProtected =
![MoveTarget.ENEMY_SIDE, MoveTarget.BOTH_SIDES].includes(this.move.getMove().moveTarget) &&
(bypassIgnoreProtect.value ||
!this.move.getMove().doesFlagEffectApply({ flag: MoveFlags.IGNORE_PROTECT, user, target })) &&
(hasConditionalProtectApplied.value ||
(!target.findTags(t => t instanceof DamageProtectedTag).length &&
target.findTags(t => t instanceof ProtectedTag).find(t => target.lapseTag(t.tagType))) ||
(this.move.getMove().category !== MoveCategory.STATUS &&
target.findTags(t => t instanceof DamageProtectedTag).find(t => target.lapseTag(t.tagType))));
/** Is the target protected by Protect, etc. or a relevant conditional protection effect? */
const isProtected =
![MoveTarget.ENEMY_SIDE, MoveTarget.BOTH_SIDES].includes(this.move.getMove().moveTarget) &&
(bypassIgnoreProtect.value ||
!this.move.getMove().doesFlagEffectApply({ flag: MoveFlags.IGNORE_PROTECT, user, target })) &&
(hasConditionalProtectApplied.value ||
(!target.findTags(t => t instanceof DamageProtectedTag).length &&
target.findTags(t => t instanceof ProtectedTag).find(t => target.lapseTag(t.tagType))) ||
(this.move.getMove().category !== MoveCategory.STATUS &&
target.findTags(t => t instanceof DamageProtectedTag).find(t => target.lapseTag(t.tagType))));
/** Is the target hidden by the effects of its Commander ability? */
const isCommanding =
@ -316,11 +316,11 @@ export class MoveEffectPhase extends PokemonPhase {
/** Is the target reflecting status moves from the magic coat move? */
const isReflecting = !!target.getTag(BattlerTagType.MAGIC_COAT);
/** Is the target's magic bounce ability not ignored and able to reflect this move? */
const canMagicBounce =
!isReflecting &&
!move.doesFlagEffectApply({ flag: MoveFlags.IGNORE_ABILITIES, user, target }) &&
target.hasAbilityWithAttr(ReflectStatusMoveAbAttr);
/** Is the target's magic bounce ability not ignored and able to reflect this move? */
const canMagicBounce =
!isReflecting &&
!move.doesFlagEffectApply({ flag: MoveFlags.IGNORE_ABILITIES, user, target }) &&
target.hasAbilityWithAttr(ReflectStatusMoveAbAttr);
const semiInvulnerableTag = target.getTag(SemiInvulnerableTag);
@ -333,21 +333,19 @@ export class MoveEffectPhase extends PokemonPhase {
(isReflecting || canMagicBounce) &&
!semiInvulnerableTag;
// If the move will bounce, then queue the bounce and move on to the next target
if (!target.switchOutStatus && willBounce) {
const newTargets = move.isMultiTarget()
? getMoveTargets(target, move.id).targets
: [user.getBattlerIndex()];
if (!isReflecting) {
// TODO: Ability displays should be handled by the ability
queuedPhases.push(
new ShowAbilityPhase(
target.getBattlerIndex(),
target.getPassiveAbility().hasAttr(ReflectStatusMoveAbAttr),
),
);
queuedPhases.push(new HideAbilityPhase());
}
// If the move will bounce, then queue the bounce and move on to the next target
if (!target.switchOutStatus && willBounce) {
const newTargets = move.isMultiTarget() ? getMoveTargets(target, move.id).targets : [user.getBattlerIndex()];
if (!isReflecting) {
// TODO: Ability displays should be handled by the ability
queuedPhases.push(
new ShowAbilityPhase(
target.getBattlerIndex(),
target.getPassiveAbility().hasAttr(ReflectStatusMoveAbAttr),
),
);
queuedPhases.push(new HideAbilityPhase());
}
queuedPhases.push(new MovePhase(target, newTargets, new PokemonMove(move.id, 0, 0, true), true, true, true));
continue;

View File

@ -4,7 +4,7 @@ import type { PartyOption } from "#app/ui/party-ui-handler";
import PartyUiHandler, { PartyUiMode } from "#app/ui/party-ui-handler";
import { Mode } from "#app/ui/ui";
import i18next from "i18next";
import * as Utils from "#app/utils";
import { toDmgValue, isNullOrUndefined } from "#app/utils";
import { BattlePhase } from "#app/phases/battle-phase";
import { SwitchSummonPhase } from "#app/phases/switch-summon-phase";
import { ToggleDoublePositionPhase } from "#app/phases/toggle-double-position-phase";
@ -33,7 +33,7 @@ export class RevivalBlessingPhase extends BattlePhase {
pokemon.resetTurnData();
pokemon.resetStatus();
pokemon.heal(Math.min(Utils.toDmgValue(0.5 * pokemon.getMaxHp()), pokemon.getMaxHp()));
pokemon.heal(Math.min(toDmgValue(0.5 * pokemon.getMaxHp()), pokemon.getMaxHp()));
globalScene.queueMessage(
i18next.t("moveTriggers:revivalBlessing", {
pokemonName: pokemon.name,
@ -46,7 +46,7 @@ export class RevivalBlessingPhase extends BattlePhase {
if (
globalScene.currentBattle.double &&
globalScene.getPlayerParty().length > 1 &&
!Utils.isNullOrUndefined(allyPokemon)
!isNullOrUndefined(allyPokemon)
) {
if (slotIndex <= 1) {
// Revived ally pokemon

View File

@ -33,24 +33,12 @@ export class SelectBiomePhase extends BattlePhase {
} else if (globalScene.gameMode.hasRandomBiomes) {
setNextBiome(this.generateNextBiome());
} else if (Array.isArray(biomeLinks[currentBiome])) {
let biomes: Biome[] = [];
globalScene.executeWithSeedOffset(() => {
biomes = (biomeLinks[currentBiome] as (Biome | [Biome, number])[])
.filter(b => !Array.isArray(b) || !randSeedInt(b[1]))
.map(b => (!Array.isArray(b) ? b : b[0]));
}, globalScene.currentBattle.waveIndex);
const biomes: Biome[] = (biomeLinks[currentBiome] as (Biome | [Biome, number])[])
.filter(b => !Array.isArray(b) || !randSeedInt(b[1]))
.map(b => (!Array.isArray(b) ? b : b[0]));
if (biomes.length > 1 && globalScene.findModifier(m => m instanceof MapModifier)) {
let biomeChoices: Biome[] = [];
globalScene.executeWithSeedOffset(() => {
biomeChoices = (
!Array.isArray(biomeLinks[currentBiome])
? [biomeLinks[currentBiome] as Biome]
: (biomeLinks[currentBiome] as (Biome | [Biome, number])[])
)
.filter(b => !Array.isArray(b) || !randSeedInt(b[1]))
.map(b => (Array.isArray(b) ? b[0] : b));
}, globalScene.currentBattle.waveIndex);
const biomeSelectItems = biomeChoices.map(b => {
const biomeSelectItems = biomes.map(b => {
const ret: OptionSelectItem = {
label: getBiomeName(b),
handler: () => {

View File

@ -12,7 +12,7 @@ import type { Starter } from "#app/ui/starter-select-ui-handler";
import { Mode } from "#app/ui/ui";
import type { Species } from "#enums/species";
import SoundFade from "phaser3-rex-plugins/plugins/soundfade";
import * as Utils from "../utils";
import { isNullOrUndefined } from "#app/utils";
export class SelectStarterPhase extends Phase {
start() {
@ -49,7 +49,7 @@ export class SelectStarterPhase extends Phase {
let starterFormIndex = Math.min(starterProps.formIndex, Math.max(starter.species.forms.length - 1, 0));
if (
starter.species.speciesId in Overrides.STARTER_FORM_OVERRIDES &&
!Utils.isNullOrUndefined(Overrides.STARTER_FORM_OVERRIDES[starter.species.speciesId]) &&
!isNullOrUndefined(Overrides.STARTER_FORM_OVERRIDES[starter.species.speciesId]) &&
starter.species.forms[Overrides.STARTER_FORM_OVERRIDES[starter.species.speciesId]!]
) {
starterFormIndex = Overrides.STARTER_FORM_OVERRIDES[starter.species.speciesId]!;
@ -87,7 +87,7 @@ export class SelectStarterPhase extends Phase {
starterPokemon.nickname = starter.nickname;
}
if (!Utils.isNullOrUndefined(starter.teraType)) {
if (!isNullOrUndefined(starter.teraType)) {
starterPokemon.teraType = starter.teraType;
} else {
starterPokemon.teraType = starterPokemon.species.type1;

View File

@ -13,6 +13,7 @@ import { PostSummonPhase } from "./post-summon-phase";
import { GameOverPhase } from "./game-over-phase";
import { ShinySparklePhase } from "./shiny-sparkle-phase";
import { MysteryEncounterMode } from "#enums/mystery-encounter-mode";
import { applyPreSummonAbAttrs, PreSummonAbAttr } from "#app/data/ability";
import { globalScene } from "#app/global-scene";
export class SummonPhase extends PartyMemberPokemonPhase {
@ -27,6 +28,7 @@ export class SummonPhase extends PartyMemberPokemonPhase {
start() {
super.start();
applyPreSummonAbAttrs(PreSummonAbAttr, this.getPokemon());
this.preSummon();
}
@ -126,7 +128,7 @@ export class SummonPhase extends PartyMemberPokemonPhase {
this.player ? 36 : 248,
this.player ? 80 : 44,
"pb",
getPokeballAtlasKey(pokemon.pokeball),
getPokeballAtlasKey(pokemon.getPokeball(true)),
);
pokeball.setVisible(false);
pokeball.setOrigin(0.5, 0.625);
@ -175,7 +177,11 @@ export class SummonPhase extends PartyMemberPokemonPhase {
}
globalScene.currentBattle.seenEnemyPartyMemberIds.add(pokemon.id);
}
addPokeballOpenParticles(pokemon.x, pokemon.y - 16, pokemon.pokeball);
addPokeballOpenParticles(
pokemon.x,
pokemon.y - 16,
pokemon.getPokeball(true),
);
globalScene.updateModifiers(this.player);
globalScene.updateFieldScale();
pokemon.showInfo();
@ -183,7 +189,7 @@ export class SummonPhase extends PartyMemberPokemonPhase {
pokemon.setVisible(true);
pokemon.getSprite().setVisible(true);
pokemon.setScale(0.5);
pokemon.tint(getPokeballTintColor(pokemon.pokeball));
pokemon.tint(getPokeballTintColor(pokemon.getPokeball(true)));
pokemon.untint(250, "Sine.easeIn");
globalScene.updateFieldScale();
globalScene.tweens.add({
@ -270,7 +276,7 @@ export class SummonPhase extends PartyMemberPokemonPhase {
onEnd(): void {
const pokemon = this.getPokemon();
if (pokemon.isShiny()) {
if (pokemon.isShiny(true)) {
globalScene.unshiftPhase(new ShinySparklePhase(pokemon.getBattlerIndex()));
}

View File

@ -1,5 +1,11 @@
import { globalScene } from "#app/global-scene";
import { applyPreSwitchOutAbAttrs, PostDamageForceSwitchAbAttr, PreSwitchOutAbAttr } from "#app/data/ability";
import {
applyPreSummonAbAttrs,
applyPreSwitchOutAbAttrs,
PostDamageForceSwitchAbAttr,
PreSummonAbAttr,
PreSwitchOutAbAttr,
} from "#app/data/ability";
import { allMoves, ForceSwitchOutAttr } from "#app/data/moves/move";
import { getPokeballTintColor } from "#app/data/pokeball";
import { SpeciesFormChangeActiveTrigger } from "#app/data/pokemon-forms";
@ -99,7 +105,7 @@ export class SwitchSummonPhase extends SummonPhase {
);
globalScene.playSound("se/pb_rel");
pokemon.hideInfo();
pokemon.tint(getPokeballTintColor(pokemon.pokeball), 1, 250, "Sine.easeIn");
pokemon.tint(getPokeballTintColor(pokemon.getPokeball(true)), 1, 250, "Sine.easeIn");
globalScene.tweens.add({
targets: pokemon,
duration: 250,
@ -116,6 +122,7 @@ export class SwitchSummonPhase extends SummonPhase {
const party = this.player ? this.getParty() : globalScene.getEnemyParty();
const switchedInPokemon = party[this.slotIndex];
this.lastPokemon = this.getPokemon();
applyPreSummonAbAttrs(PreSummonAbAttr, switchedInPokemon);
applyPreSwitchOutAbAttrs(PreSwitchOutAbAttr, this.lastPokemon);
if (this.switchType === SwitchType.BATON_PASS && switchedInPokemon) {
(this.player ? globalScene.getEnemyField() : globalScene.getPlayerField()).forEach(enemyPokemon =>

View File

@ -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 { getCurrentTime } from "#app/utils";
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,
},
);
@ -236,7 +34,7 @@ export default class FieldSpritePipeline extends Phaser.Renderer.WebGL.Pipelines
const time = globalScene.currentBattle?.waveIndex
? ((globalScene.currentBattle.waveIndex + globalScene.waveCycleOffset) % 40) / 40 // ((new Date().getSeconds() * 1000 + new Date().getMilliseconds()) % 10000) / 10000
: Utils.getCurrentTime();
: getCurrentTime();
this.set1f("time", time);
this.set1i("ignoreTimeTint", ignoreTimeTint ? 1 : 0);
this.set1i("isOutside", globalScene.arena.isOutside() ? 1 : 0);

View File

@ -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;
}

View File

@ -0,0 +1,10 @@
precision mediump float;
uniform sampler2D uMainSampler;
varying vec2 outTexCoord;
void main()
{
gl_FragColor = 1.0 - texture2D(uMainSampler, outTexCoord);
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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) {

View File

@ -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 { rgbHexToRgba } 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[];
@ -450,8 +144,8 @@ export default class SpritePipeline extends FieldSpritePipeline {
const baseColors = Object.keys(variantColors[variant]);
for (let c = 0; c < 32; c++) {
if (c < baseColors.length) {
const baseColor = Array.from(Object.values(Utils.rgbHexToRgba(baseColors[c])));
const variantColor = Array.from(Object.values(Utils.rgbHexToRgba(variantColors[variant][baseColors[c]])));
const baseColor = Array.from(Object.values(rgbHexToRgba(baseColors[c])));
const variantColor = Array.from(Object.values(rgbHexToRgba(variantColors[variant][baseColors[c]])));
flatBaseColors.splice(flatBaseColors.length, 0, ...baseColor);
flatVariantColors.splice(flatVariantColors.length, 0, ...variantColor.map(c => c / 255.0));
} else {

View File

@ -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<void> {
await Promise.allSettled(moveIds.map(m => initMoveAnim(m)));
await loadMoveAnimAssets(moveIds);
}

View File

@ -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<void> {
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());
}

View File

@ -0,0 +1 @@
export const expSpriteKeys: Set<string> = new Set();

View File

@ -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;
}

145
src/sprites/variant.ts Normal file
View File

@ -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<void> {
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<void> {
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<void> {
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<void> {
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;
}
});
}

View File

@ -2,7 +2,7 @@ import type { Modifier } from "typescript";
import { TurnHeldItemTransferModifier } from "../modifier/modifier";
import { pokemonEvolutions } from "#app/data/balance/pokemon-evolutions";
import i18next from "i18next";
import * as Utils from "../utils";
import { NumberHolder } from "#app/utils";
import { PlayerGender } from "#enums/player-gender";
import type { Challenge } from "#app/data/challenge";
import {
@ -138,7 +138,7 @@ export class DamageAchv extends Achv {
"",
iconImage,
score,
(args: any[]) => (args[0] instanceof Utils.NumberHolder ? args[0].value : args[0]) >= this.damageAmount,
(args: any[]) => (args[0] instanceof NumberHolder ? args[0].value : args[0]) >= this.damageAmount,
);
this.damageAmount = damageAmount;
}
@ -154,7 +154,7 @@ export class HealAchv extends Achv {
"",
iconImage,
score,
(args: any[]) => (args[0] instanceof Utils.NumberHolder ? args[0].value : args[0]) >= this.healAmount,
(args: any[]) => (args[0] instanceof NumberHolder ? args[0].value : args[0]) >= this.healAmount,
);
this.healAmount = healAmount;
}
@ -170,7 +170,7 @@ export class LevelAchv extends Achv {
"",
iconImage,
score,
(args: any[]) => (args[0] instanceof Utils.NumberHolder ? args[0].value : args[0]) >= this.level,
(args: any[]) => (args[0] instanceof NumberHolder ? args[0].value : args[0]) >= this.level,
);
this.level = level;
}

View File

@ -8,7 +8,7 @@ import { pokemonPrevolutions } from "#app/data/balance/pokemon-evolutions";
import type PokemonSpecies from "#app/data/pokemon-species";
import { allSpecies, getPokemonSpecies } from "#app/data/pokemon-species";
import { speciesStarterCosts } from "#app/data/balance/starters";
import * as Utils from "#app/utils";
import { randInt, getEnumKeys, isLocal, executeIf, fixedInt, randSeedItem, NumberHolder } from "#app/utils";
import Overrides from "#app/overrides";
import PokemonData from "#app/system/pokemon-data";
import PersistentModifierData from "#app/system/modifier-data";
@ -32,11 +32,12 @@ 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";
import { TagAddedEvent, TerrainChangedEvent, WeatherChangedEvent } from "#app/events/arena";
// biome-ignore lint/style/noNamespaceImport: Something weird is going on here and I don't want to touch it
import * as Modifier from "#app/modifier/modifier";
import { StatusEffect } from "#enums/status-effect";
import ChallengeData from "#app/system/challenge-data";
@ -360,8 +361,8 @@ export class GameData {
this.loadSettings();
this.loadGamepadSettings();
this.loadMappingConfigs();
this.trainerId = Utils.randInt(65536);
this.secretId = Utils.randInt(65536);
this.trainerId = randInt(65536);
this.secretId = randInt(65536);
this.starterData = {};
this.gameStats = new GameStats();
this.runHistory = {};
@ -589,7 +590,7 @@ export class GameData {
}
if (systemData.voucherCounts) {
Utils.getEnumKeys(VoucherType).forEach(key => {
getEnumKeys(VoucherType).forEach(key => {
const index = VoucherType[key];
this.voucherCounts[index] = systemData.voucherCounts[index] || 0;
});
@ -617,7 +618,7 @@ export class GameData {
* At the moment, only retrievable from locale cache
*/
async getRunHistoryData(): Promise<RunHistoryData> {
if (!Utils.isLocal) {
if (!isLocal) {
/**
* Networking Code DO NOT DELETE!
* Note: Might have to be migrated to `pokerogue-api.ts`
@ -1035,6 +1036,7 @@ export class GameData {
}
getSession(slotId: number): Promise<SessionSaveData | null> {
// biome-ignore lint/suspicious/noAsyncPromiseExecutor: <explanation>
return new Promise(async (resolve, reject) => {
if (slotId < 0) {
return resolve(null);
@ -1075,6 +1077,7 @@ export class GameData {
}
loadSession(slotId: number, sessionData?: SessionSaveData): Promise<boolean> {
// biome-ignore lint/suspicious/noAsyncPromiseExecutor: <explanation>
return new Promise(async (resolve, reject) => {
try {
const initSessionFromData = async (sessionData: SessionSaveData) => {
@ -1406,7 +1409,7 @@ export class GameData {
saveAll(skipVerification = false, sync = false, useCachedSession = false, useCachedSystem = false): Promise<boolean> {
return new Promise<boolean>(resolve => {
Utils.executeIf(!skipVerification, updateUserInfo).then(success => {
executeIf(!skipVerification, updateUserInfo).then(success => {
if (success !== null && !success) {
return resolve(false);
}
@ -1423,12 +1426,11 @@ export class GameData {
),
) // TODO: is this bang correct?
: this.getSessionSaveData();
const maxIntAttrValue = 0x80000000;
const systemData = useCachedSystem
? this.parseSystemData(decrypt(localStorage.getItem(`data_${loggedInUser?.username}`)!, bypassLogin))
: this.getSystemSaveData(); // TODO: is this bang correct?
const request = {
system: systemData,
session: sessionData,
@ -1445,7 +1447,6 @@ export class GameData {
bypassLogin,
),
);
localStorage.setItem(
`sessionData${globalScene.sessionSlotId ? globalScene.sessionSlotId : ""}_${loggedInUser?.username}`,
encrypt(JSON.stringify(sessionData), bypassLogin),
@ -1586,7 +1587,7 @@ export class GameData {
}
const displayError = (error: string) =>
globalScene.ui.showText(error, null, () => globalScene.ui.showText("", 0), Utils.fixedInt(1500));
globalScene.ui.showText(error, null, () => globalScene.ui.showText("", 0), fixedInt(1500));
dataName = dataName!; // tell TS compiler that dataName is defined!
if (!valid) {
@ -1594,7 +1595,7 @@ export class GameData {
`Your ${dataName} data could not be loaded. It may be corrupted.`,
null,
() => globalScene.ui.showText("", 0),
Utils.fixedInt(1500),
fixedInt(1500),
);
}
@ -1687,7 +1688,7 @@ export class GameData {
() => {
const neutralNatures = [Nature.HARDY, Nature.DOCILE, Nature.SERIOUS, Nature.BASHFUL, Nature.QUIRKY];
for (let s = 0; s < defaultStarterSpecies.length; s++) {
defaultStarterNatures.push(Utils.randSeedItem(neutralNatures));
defaultStarterNatures.push(randSeedItem(neutralNatures));
}
},
0,
@ -2188,7 +2189,7 @@ export class GameData {
value = decrementValue(value);
}
const cost = new Utils.NumberHolder(value);
const cost = new NumberHolder(value);
applyChallenges(ChallengeType.STARTER_COST, speciesId, cost);
return cost.value;
@ -2216,7 +2217,7 @@ export class GameData {
entry.hatchedCount = 0;
}
if (!entry.hasOwnProperty("natureAttr") || (entry.caughtAttr && !entry.natureAttr)) {
entry.natureAttr = this.defaultDexData?.[k].natureAttr || 1 << Utils.randInt(25, 1);
entry.natureAttr = this.defaultDexData?.[k].natureAttr || 1 << randInt(25, 1);
}
}
}

View File

@ -3,7 +3,7 @@ import type FadeIn from "phaser3-rex-plugins/plugins/audio/fade/FadeIn";
import type FadeOut from "phaser3-rex-plugins/plugins/audio/fade/FadeOut";
import type BattleScene from "#app/battle-scene";
import { globalScene } from "#app/global-scene";
import * as Utils from "../utils";
import { FixedInt } from "#app/utils";
type FadeInType = typeof FadeIn;
type FadeOutType = typeof FadeOut;
@ -11,9 +11,9 @@ type FadeOutType = typeof FadeOut;
export function initGameSpeed() {
const thisArg = this as BattleScene;
const transformValue = (value: number | Utils.FixedInt): number => {
if (value instanceof Utils.FixedInt) {
return (value as Utils.FixedInt).value;
const transformValue = (value: number | FixedInt): number => {
if (value instanceof FixedInt) {
return (value as FixedInt).value;
}
return thisArg.gameSpeed === 1 ? value : Math.ceil((value /= thisArg.gameSpeed));
};

View File

@ -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";
@ -79,12 +79,14 @@ export default class PokemonData {
this.id = source.id;
this.player = sourcePokemon ? sourcePokemon.isPlayer() : source.player;
this.species = sourcePokemon ? sourcePokemon.species.speciesId : source.species;
this.nickname = sourcePokemon ? sourcePokemon.nickname : source.nickname;
this.nickname = sourcePokemon
? (!!sourcePokemon.summonData?.illusion ? sourcePokemon.summonData.illusion.basePokemon.nickname : sourcePokemon.nickname)
: source.nickname;
this.formIndex = Math.max(Math.min(source.formIndex, getPokemonSpecies(this.species).forms.length - 1), 0);
this.abilityIndex = source.abilityIndex;
this.passive = source.passive;
this.shiny = source.shiny;
this.variant = source.variant;
this.shiny = sourcePokemon ? sourcePokemon.isShiny() : source.shiny;
this.variant = sourcePokemon ? sourcePokemon.getVariant() : source.variant;
this.pokeball = source.pokeball;
this.level = source.level;
this.exp = source.exp;
@ -117,8 +119,12 @@ export default class PokemonData {
this.fusionSpecies = sourcePokemon ? sourcePokemon.fusionSpecies?.speciesId : source.fusionSpecies;
this.fusionFormIndex = source.fusionFormIndex;
this.fusionAbilityIndex = source.fusionAbilityIndex;
this.fusionShiny = source.fusionShiny;
this.fusionVariant = source.fusionVariant;
this.fusionShiny = sourcePokemon
? (!!sourcePokemon.summonData?.illusion ? sourcePokemon.summonData.illusion.basePokemon.fusionShiny : sourcePokemon.fusionShiny)
: source.fusionShiny;
this.fusionVariant = sourcePokemon
? (!!sourcePokemon.summonData?.illusion ? sourcePokemon.summonData.illusion.basePokemon.fusionVariant : sourcePokemon.fusionVariant)
: source.fusionVariant;
this.fusionGender = source.fusionGender;
this.fusionLuck =
source.fusionLuck !== undefined ? source.fusionLuck : source.fusionShiny ? source.fusionVariant + 1 : 0;
@ -174,6 +180,7 @@ export default class PokemonData {
this.summonData.types = source.summonData.types;
this.summonData.speciesForm = source.summonData.speciesForm;
this.summonDataSpeciesFormIndex = source.summonDataSpeciesFormIndex;
this.summonData.illusionBroken = source.summonData.illusionBroken;
if (source.summonData.tags) {
this.summonData.tags = source.summonData.tags?.map(t => loadBattlerTag(t));
@ -219,6 +226,7 @@ export default class PokemonData {
if (this.summonData) {
// when loading from saved session, recover summonData.speciesFrom and form index species object
// used to stay transformed on reload session
if (this.summonData.speciesForm) {
this.summonData.speciesForm = getPokemonSpeciesForm(
this.summonData.speciesForm.speciesId,

View File

@ -48,12 +48,15 @@ export const settingsMigrators: Readonly<SettingsSaveMigrator[]> = [settingsMigr
// import * as vA_B_C from "./versions/vA_B_C";
// --- v1.0.4 (and below) PATCHES --- //
// biome-ignore lint/style/noNamespaceImport: Convenience (TODO: make this a file-wide ignore when Biome supports those)
import * as v1_0_4 from "./versions/v1_0_4";
// --- v1.7.0 PATCHES --- //
// biome-ignore lint/style/noNamespaceImport: Convenience
import * as v1_7_0 from "./versions/v1_7_0";
// --- v1.8.3 PATCHES --- //
// biome-ignore lint/style/noNamespaceImport: Convenience
import * as v1_8_3 from "./versions/v1_8_3";
/** Current game version */

View File

@ -3,7 +3,7 @@ import { TextStyle, addBBCodeTextObject, getTextColor, getTextStyleOptions } fro
import { Mode } from "./ui";
import UiHandler from "./ui-handler";
import { addWindow } from "./ui-theme";
import * as Utils from "../utils";
import { rgbHexToRgba, fixedInt } from "#app/utils";
import { argbFromRgba } from "@material/material-color-utilities";
import { Button } from "#enums/buttons";
import BBCodeText from "phaser3-rex-plugins/plugins/gameobjects/tagtext/bbcodetext/BBCodeText";
@ -178,8 +178,8 @@ export default abstract class AbstractOptionSelectUiHandler extends UiHandler {
itemOverlayIcon.setPositionRelative(this.optionSelectText, 36 * this.scale, 7 + i * (114 * this.scale - 3));
if (option.itemArgs) {
itemIcon.setTint(argbFromRgba(Utils.rgbHexToRgba(option.itemArgs[0])));
itemOverlayIcon.setTint(argbFromRgba(Utils.rgbHexToRgba(option.itemArgs[1])));
itemIcon.setTint(argbFromRgba(rgbHexToRgba(option.itemArgs[0])));
itemOverlayIcon.setTint(argbFromRgba(rgbHexToRgba(option.itemArgs[1])));
}
}
}
@ -207,7 +207,7 @@ export default abstract class AbstractOptionSelectUiHandler extends UiHandler {
this.blockInput = true;
this.optionSelectTextContainer.setAlpha(0.5);
this.cursorObj?.setAlpha(0.8);
globalScene.time.delayedCall(Utils.fixedInt(this.config.delay), () => this.unblockInput());
globalScene.time.delayedCall(fixedInt(this.config.delay), () => this.unblockInput());
}
if (this.config?.supportHover) {

View File

@ -16,7 +16,7 @@ import type { TurnEndEvent } from "../events/battle-scene";
import { BattleSceneEventType } from "../events/battle-scene";
import { ArenaTagType } from "#enums/arena-tag-type";
import TimeOfDayWidget from "./time-of-day-widget";
import * as Utils from "../utils";
import { toCamelCaseString, formatText, fixedInt } from "#app/utils";
import type { ParseKeys } from "i18next";
import i18next from "i18next";
@ -47,10 +47,10 @@ export function getFieldEffectText(arenaTagType: string): string {
if (!arenaTagType || arenaTagType === ArenaTagType.NONE) {
return arenaTagType;
}
const effectName = Utils.toCamelCaseString(arenaTagType);
const effectName = toCamelCaseString(arenaTagType);
const i18nKey = `arenaFlyout:${effectName}` as ParseKeys;
const resultName = i18next.t(i18nKey);
return !resultName || resultName === i18nKey ? Utils.formatText(arenaTagType) : resultName;
return !resultName || resultName === i18nKey ? formatText(arenaTagType) : resultName;
}
export class ArenaFlyout extends Phaser.GameObjects.Container {
@ -411,7 +411,7 @@ export class ArenaFlyout extends Phaser.GameObjects.Container {
globalScene.tweens.add({
targets: this.flyoutParent,
x: visible ? this.anchorX : this.anchorX - this.translationX,
duration: Utils.fixedInt(125),
duration: fixedInt(125),
ease: "Sine.easeInOut",
alpha: visible ? 1 : 0,
onComplete: () => (this.timeOfDayWidget.parentVisible = visible),

View File

@ -1,7 +1,7 @@
import type { InfoToggle } from "../battle-scene";
import { TextStyle, addTextObject } from "./text";
import { addWindow } from "./ui-theme";
import * as Utils from "../utils";
import { fixedInt } from "#app/utils";
import i18next from "i18next";
import { globalScene } from "#app/global-scene";
@ -93,7 +93,7 @@ export class BaseStatsOverlay extends Phaser.GameObjects.Container implements In
}
globalScene.tweens.add({
targets: this.statsLabels,
duration: Utils.fixedInt(125),
duration: fixedInt(125),
ease: "Sine.easeInOut",
alpha: visible ? 1 : 0,
});

View File

@ -1,6 +1,6 @@
import type { default as Pokemon } from "../field/pokemon";
import { addTextObject, TextStyle } from "./text";
import * as Utils from "../utils";
import { fixedInt } from "#app/utils";
import { globalScene } from "#app/global-scene";
import type Move from "#app/data/moves/move";
import type { BerryUsedEvent, MoveUsedEvent } from "../events/battle-scene";
@ -201,7 +201,7 @@ export default class BattleFlyout extends Phaser.GameObjects.Container {
globalScene.tweens.add({
targets: this.flyoutParent,
x: visible ? this.anchorX : this.anchorX - this.translationX,
duration: Utils.fixedInt(125),
duration: fixedInt(125),
ease: "Sine.easeInOut",
alpha: visible ? 1 : 0,
});

View File

@ -1,13 +1,13 @@
import type { EnemyPokemon, default as Pokemon } from "../field/pokemon";
import { getLevelTotalExp, getLevelRelExp } from "../data/exp";
import * as Utils from "../utils";
import { getLocalizedSpriteKey, fixedInt } from "#app/utils";
import { addTextObject, TextStyle } from "./text";
import { getGenderSymbol, getGenderColor, Gender } from "../data/gender";
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";
@ -163,7 +163,7 @@ export default class BattleInfo extends Phaser.GameObjects.Container {
this.splicedIcon.setInteractive(new Phaser.Geom.Rectangle(0, 0, 12, 15), Phaser.Geom.Rectangle.Contains);
this.add(this.splicedIcon);
this.statusIndicator = globalScene.add.sprite(0, 0, Utils.getLocalizedSpriteKey("statuses"));
this.statusIndicator = globalScene.add.sprite(0, 0, getLocalizedSpriteKey("statuses"));
this.statusIndicator.setName("icon_status");
this.statusIndicator.setVisible(false);
this.statusIndicator.setOrigin(0, 0);
@ -356,7 +356,7 @@ export default class BattleInfo extends Phaser.GameObjects.Container {
});
this.teraIcon.on("pointerout", () => globalScene.ui.hideTooltip());
const isFusion = pokemon.isFusion();
const isFusion = pokemon.isFusion(true);
this.splicedIcon.setPositionRelative(
this.nameText,
@ -375,7 +375,7 @@ export default class BattleInfo extends Phaser.GameObjects.Container {
}
const doubleShiny = isFusion && pokemon.shiny && pokemon.fusionShiny;
const baseVariant = !doubleShiny ? pokemon.getVariant() : pokemon.variant;
const baseVariant = !doubleShiny ? pokemon.getVariant(true) : pokemon.variant;
this.shinyIcon.setPositionRelative(
this.nameText,
@ -536,7 +536,7 @@ export default class BattleInfo extends Phaser.GameObjects.Container {
toggleStats(visible: boolean): void {
globalScene.tweens.add({
targets: this.statsContainer,
duration: Utils.fixedInt(125),
duration: fixedInt(125),
ease: "Sine.easeInOut",
alpha: visible ? 1 : 0,
});
@ -617,6 +617,11 @@ export default class BattleInfo extends Phaser.GameObjects.Container {
return resolve();
}
const gender: Gender = !!pokemon.summonData?.illusion ? pokemon.summonData?.illusion.gender : pokemon.gender;
this.genderText.setText(getGenderSymbol(gender));
this.genderText.setColor(getGenderColor(gender));
const nameUpdated = this.lastName !== pokemon.getNameToRender();
if (nameUpdated) {
@ -638,8 +643,10 @@ export default class BattleInfo extends Phaser.GameObjects.Container {
this.lastTeraType = teraType;
}
const isFusion = pokemon.isFusion(true);
if (nameUpdated || teraTypeUpdated) {
this.splicedIcon.setVisible(!!pokemon.fusionSpecies);
this.splicedIcon.setVisible(isFusion);
this.teraIcon.setPositionRelative(
this.nameText,
@ -764,7 +771,17 @@ export default class BattleInfo extends Phaser.GameObjects.Container {
this.lastStats = statsStr;
}
this.shinyIcon.setVisible(pokemon.isShiny());
this.shinyIcon.setVisible(pokemon.isShiny(true));
const doubleShiny = isFusion && pokemon.shiny && pokemon.fusionShiny;
const baseVariant = !doubleShiny ? pokemon.getVariant(true) : pokemon.variant;
this.shinyIcon.setTint(getVariantTint(baseVariant));
this.fusionShinyIcon.setVisible(doubleShiny);
if (isFusion) {
this.fusionShinyIcon.setTint(getVariantTint(pokemon.fusionVariant));
}
this.fusionShinyIcon.setPosition(this.shinyIcon.x, this.shinyIcon.y);
resolve();
});
@ -777,10 +794,11 @@ export default class BattleInfo extends Phaser.GameObjects.Container {
const nameSizeTest = addTextObject(0, 0, displayName, TextStyle.BATTLE_INFO);
nameTextWidth = nameSizeTest.displayWidth;
const gender: Gender = !!pokemon.summonData?.illusion ? pokemon.summonData?.illusion.gender : pokemon.gender;
while (
nameTextWidth >
(this.player || !this.boss ? 60 : 98) -
((pokemon.gender !== Gender.GENDERLESS ? 6 : 0) +
((gender !== Gender.GENDERLESS ? 6 : 0) +
(pokemon.fusionSpecies ? 8 : 0) +
(pokemon.isShiny() ? 8 : 0) +
(Math.min(pokemon.level.toString().length, 3) - 3) * 8)

View File

@ -1,6 +1,6 @@
import { addTextObject, TextStyle } from "./text";
import i18next from "i18next";
import * as Utils from "#app/utils";
import { formatText } from "#app/utils";
import { globalScene } from "#app/global-scene";
const hiddenX = -150;
@ -100,7 +100,7 @@ export default class BgmBar extends Phaser.GameObjects.Container {
getRealBgmName(bgmName: string): string {
return i18next.t([`bgmName:${bgmName}`, "bgmName:missing_entries"], {
name: Utils.formatText(bgmName),
name: formatText(bgmName),
});
}
}

View File

@ -2,7 +2,7 @@ import { starterColors } from "#app/battle-scene";
import { globalScene } from "#app/global-scene";
import { TextStyle, addTextObject } from "./text";
import { argbFromRgba } from "@material/material-color-utilities";
import * as Utils from "../utils";
import { rgbHexToRgba } from "#app/utils";
import type { Species } from "#enums/species";
export default class CandyBar extends Phaser.GameObjects.Container {
@ -60,8 +60,8 @@ export default class CandyBar extends Phaser.GameObjects.Container {
const colorScheme = starterColors[starterSpeciesId];
this.candyIcon.setTint(argbFromRgba(Utils.rgbHexToRgba(colorScheme[0])));
this.candyOverlayIcon.setTint(argbFromRgba(Utils.rgbHexToRgba(colorScheme[1])));
this.candyIcon.setTint(argbFromRgba(rgbHexToRgba(colorScheme[0])));
this.candyOverlayIcon.setTint(argbFromRgba(rgbHexToRgba(colorScheme[1])));
this.countText.setText(
`${globalScene.gameData.starterData[starterSpeciesId].candyCount + count} (+${count.toString()})`,

View File

@ -5,7 +5,7 @@ import { addWindow } from "./ui-theme";
import { Button } from "#enums/buttons";
import i18next from "i18next";
import type { Challenge } from "#app/data/challenge";
import * as Utils from "../utils";
import { getLocalizedSpriteKey } from "#app/utils";
import { Challenges } from "#app/enums/challenges";
import BBCodeText from "phaser3-rex-plugins/plugins/bbcodetext";
import { Color, ShadowColor } from "#app/enums/color";
@ -193,7 +193,7 @@ export default class GameChallengesUiHandler extends UiHandler {
};
}
this.monoTypeValue = globalScene.add.sprite(8, 98, Utils.getLocalizedSpriteKey("types"));
this.monoTypeValue = globalScene.add.sprite(8, 98, getLocalizedSpriteKey("types"));
this.monoTypeValue.setName("challenge-value-monotype-sprite");
this.monoTypeValue.setScale(0.86);
this.monoTypeValue.setVisible(false);

View File

@ -1,5 +1,5 @@
import { globalScene } from "#app/global-scene";
import * as Utils from "../utils";
import { MissingTextureKey } from "#app/utils";
export default class CharSprite extends Phaser.GameObjects.Container {
private sprite: Phaser.GameObjects.Sprite;
@ -57,7 +57,7 @@ export default class CharSprite extends Phaser.GameObjects.Container {
},
});
this.setVisible(globalScene.textures.get(key).key !== Utils.MissingTextureKey);
this.setVisible(globalScene.textures.get(key).key !== MissingTextureKey);
this.shown = true;
this.key = key;

View File

@ -1,6 +1,6 @@
import i18next from "i18next";
import { globalScene } from "#app/global-scene";
import * as Utils from "../utils";
import { getEnumKeys, executeIf } from "#app/utils";
import { TextStyle, addTextObject } from "./text";
import { WindowVariant, addWindow } from "./ui-theme";
import { pokerogueApi } from "#app/plugins/api/pokerogue-api";
@ -89,7 +89,7 @@ export class DailyRunScoreboard extends Phaser.GameObjects.Container {
this.prevCategoryButton.setInteractive(new Phaser.Geom.Rectangle(0, 0, 6, 10), Phaser.Geom.Rectangle.Contains);
this.prevCategoryButton.on("pointerup", () => {
this.update(this.category ? this.category - 1 : Utils.getEnumKeys(ScoreboardCategory).length - 1);
this.update(this.category ? this.category - 1 : getEnumKeys(ScoreboardCategory).length - 1);
});
this.nextCategoryButton = globalScene.add.sprite(window.displayWidth - 4, 4, "cursor");
@ -98,7 +98,7 @@ export class DailyRunScoreboard extends Phaser.GameObjects.Container {
this.nextCategoryButton.setInteractive(new Phaser.Geom.Rectangle(0, 0, 6, 10), Phaser.Geom.Rectangle.Contains);
this.nextCategoryButton.on("pointerup", () => {
this.update(this.category < Utils.getEnumKeys(ScoreboardCategory).length - 1 ? this.category + 1 : 0);
this.update(this.category < getEnumKeys(ScoreboardCategory).length - 1 ? this.category + 1 : 0);
});
this.prevPageButton = globalScene.add.sprite(
@ -226,7 +226,7 @@ export class DailyRunScoreboard extends Phaser.GameObjects.Container {
this.page = page = 1;
}
Utils.executeIf(category !== this.category || this.pageCount === undefined, () =>
executeIf(category !== this.category || this.pageCount === undefined, () =>
pokerogueApi.daily.getRankingsPageCount({ category }).then(count => (this.pageCount = count)),
)
.then(() => {

View File

@ -1,7 +1,7 @@
import { Mode } from "./ui";
import { TextStyle, addTextObject, getEggTierTextTint, getTextStyleOptions } from "./text";
import MessageUiHandler from "./message-ui-handler";
import * as Utils from "../utils";
import { getEnumValues, getEnumKeys, fixedInt, randSeedShuffle } from "#app/utils";
import type { IEggOptions } from "../data/egg";
import { Egg, getLegendaryGachaSpeciesForTimestamp } from "../data/egg";
import { VoucherType, getVoucherTypeIcon } from "../system/voucher";
@ -83,7 +83,7 @@ export default class EggGachaUiHandler extends MessageUiHandler {
});
}
Utils.getEnumValues(GachaType).forEach((gachaType, g) => {
getEnumValues(GachaType).forEach((gachaType, g) => {
const gachaTypeKey = GachaType[gachaType].toString().toLowerCase();
const gachaContainer = globalScene.add.container(180 * g, 18);
@ -272,7 +272,7 @@ export default class EggGachaUiHandler extends MessageUiHandler {
this.eggGachaContainer.add(this.eggGachaOptionsContainer);
new Array(Utils.getEnumKeys(VoucherType).length).fill(null).map((_, i) => {
new Array(getEnumKeys(VoucherType).length).fill(null).map((_, i) => {
const container = globalScene.add.container(globalScene.game.canvas.width / 6 - 56 * i, 0);
const bg = addWindow(0, 0, 56, 22);
@ -355,7 +355,7 @@ export default class EggGachaUiHandler extends MessageUiHandler {
if (this.transitioning && this.transitionCancelled) {
delay = Math.ceil(delay / 5);
}
return Utils.fixedInt(delay);
return fixedInt(delay);
}
pull(pullCount = 0, count = 0, eggs?: Egg[]): void {
@ -476,7 +476,7 @@ export default class EggGachaUiHandler extends MessageUiHandler {
eggs.push(egg);
}
// Shuffle the eggs in case the guaranteed one got added as last egg
eggs = Utils.randSeedShuffle<Egg>(eggs);
eggs = randSeedShuffle<Egg>(eggs);
(globalScene.currentBattle
? globalScene.gameData.saveAll(true, true, true)
@ -643,7 +643,7 @@ export default class EggGachaUiHandler extends MessageUiHandler {
}
showError(text: string): void {
this.showText(text, undefined, () => this.showText(this.defaultText), Utils.fixedInt(1500));
this.showText(text, undefined, () => this.showText(this.defaultText), fixedInt(1500));
}
setTransitioning(transitioning: boolean): void {
@ -783,7 +783,7 @@ export default class EggGachaUiHandler extends MessageUiHandler {
}
break;
case Button.RIGHT:
if (this.gachaCursor < Utils.getEnumKeys(GachaType).length - 1) {
if (this.gachaCursor < getEnumKeys(GachaType).length - 1) {
success = this.setGachaCursor(this.gachaCursor + 1);
}
break;

View File

@ -6,7 +6,7 @@ import { PokemonType } from "#enums/pokemon-type";
import { Command } from "./command-ui-handler";
import { Mode } from "./ui";
import UiHandler from "./ui-handler";
import * as Utils from "../utils";
import { getLocalizedSpriteKey, fixedInt, padInt } from "#app/utils";
import { MoveCategory } from "#enums/MoveCategory";
import i18next from "i18next";
import { Button } from "#enums/buttons";
@ -54,7 +54,7 @@ export default class FightUiHandler extends UiHandler implements InfoToggle {
this.typeIcon = globalScene.add.sprite(
globalScene.scaledCanvas.width - 57,
-36,
Utils.getLocalizedSpriteKey("types"),
getLocalizedSpriteKey("types"),
"unknown",
);
this.typeIcon.setVisible(false);
@ -199,7 +199,7 @@ export default class FightUiHandler extends UiHandler implements InfoToggle {
}
globalScene.tweens.add({
targets: [this.movesContainer, this.cursorObj],
duration: Utils.fixedInt(125),
duration: fixedInt(125),
ease: "Sine.easeInOut",
alpha: visible ? 0 : 1,
});
@ -245,7 +245,7 @@ export default class FightUiHandler extends UiHandler implements InfoToggle {
if (hasMove) {
const pokemonMove = moveset[cursor];
const moveType = pokemon.getMoveType(pokemonMove.getMove());
const textureKey = Utils.getLocalizedSpriteKey("types");
const textureKey = getLocalizedSpriteKey("types");
this.typeIcon.setTexture(textureKey, PokemonType[moveType].toLowerCase()).setScale(0.8);
const moveCategory = pokemonMove.getMove().category;
@ -255,8 +255,8 @@ export default class FightUiHandler extends UiHandler implements InfoToggle {
const maxPP = pokemonMove.getMovePp();
const pp = maxPP - pokemonMove.ppUsed;
const ppLeftStr = Utils.padInt(pp, 2, " ");
const ppMaxStr = Utils.padInt(maxPP, 2, " ");
const ppLeftStr = padInt(pp, 2, " ");
const ppMaxStr = padInt(maxPP, 2, " ");
this.ppText.setText(`${ppLeftStr}/${ppMaxStr}`);
this.powerText.setText(`${power >= 0 ? power : "---"}`);
this.accuracyText.setText(`${accuracy >= 0 ? accuracy : "---"}`);
@ -306,6 +306,9 @@ export default class FightUiHandler extends UiHandler implements InfoToggle {
pokemon,
pokemonMove.getMove(),
!opponent.battleData?.abilityRevealed,
undefined,
undefined,
true
);
if (effectiveness === undefined) {
return undefined;
@ -350,7 +353,7 @@ export default class FightUiHandler extends UiHandler implements InfoToggle {
const moveColors = opponents
.map(opponent =>
opponent.getMoveEffectiveness(pokemon, pokemonMove.getMove(), !opponent.battleData.abilityRevealed),
opponent.getMoveEffectiveness(pokemon, pokemonMove.getMove(), !opponent.battleData.abilityRevealed, undefined, undefined, true),
)
.sort((a, b) => b - a)
.map(effectiveness => getTypeDamageMultiplierColor(effectiveness ?? 0, "offense"));

View File

@ -4,7 +4,7 @@ import type { Mode } from "./ui";
import { TextStyle, addTextInputObject, addTextObject } from "./text";
import { WindowVariant, addWindow } from "./ui-theme";
import type InputText from "phaser3-rex-plugins/plugins/inputtext";
import * as Utils from "../utils";
import { fixedInt } from "#app/utils";
import { Button } from "#enums/buttons";
import { globalScene } from "#app/global-scene";
@ -135,7 +135,7 @@ export abstract class FormModalUiHandler extends ModalUiHandler {
this.tween = globalScene.tweens.add({
targets: this.modalContainer,
duration: Utils.fixedInt(1000),
duration: fixedInt(1000),
ease: "Sine.easeInOut",
y: "-=24",
alpha: 1,

View File

@ -3,7 +3,7 @@ import { TextStyle, addTextObject } from "#app/ui/text";
import type { Mode } from "#app/ui/ui";
import UiHandler from "#app/ui/ui-handler";
import { addWindow } from "#app/ui/ui-theme";
import * as Utils from "#app/utils";
import { getPlayTimeString, formatFancyLargeNumber, toReadableString } from "#app/utils";
import type { GameData } from "#app/system/game-data";
import { DexAttr } from "#app/system/game-data";
import { speciesStarterCosts } from "#app/data/balance/starters";
@ -25,7 +25,7 @@ interface DisplayStats {
const displayStats: DisplayStats = {
playTime: {
label_key: "playTime",
sourceFunc: gameData => Utils.getPlayTimeString(gameData.gameStats.playTime),
sourceFunc: gameData => getPlayTimeString(gameData.gameStats.playTime),
},
battles: {
label_key: "totalBattles",
@ -91,7 +91,7 @@ const displayStats: DisplayStats = {
},
highestMoney: {
label_key: "highestMoney",
sourceFunc: gameData => Utils.formatFancyLargeNumber(gameData.gameStats.highestMoney),
sourceFunc: gameData => formatFancyLargeNumber(gameData.gameStats.highestMoney),
},
highestDamage: {
label_key: "highestDamage",
@ -435,7 +435,7 @@ export function initStatsKeys() {
}
if (!(displayStats[key] as DisplayStat).label_key) {
const splittableKey = key.replace(/([a-z]{2,})([A-Z]{1}(?:[^A-Z]|$))/g, "$1_$2");
(displayStats[key] as DisplayStat).label_key = Utils.toReadableString(
(displayStats[key] as DisplayStat).label_key = toReadableString(
`${splittableKey[0].toUpperCase()}${splittableKey.slice(1)}`,
);
}

View File

@ -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";

View File

@ -1,7 +1,7 @@
import type { InputFieldConfig } from "./form-modal-ui-handler";
import { FormModalUiHandler } from "./form-modal-ui-handler";
import type { ModalConfig } from "./modal-ui-handler";
import * as Utils from "../utils";
import { fixedInt } from "#app/utils";
import { Mode } from "./ui";
import i18next from "i18next";
import { addTextObject, TextStyle } from "./text";
@ -283,7 +283,7 @@ export default class LoginFormUiHandler extends FormModalUiHandler {
this.externalPartyContainer.setAlpha(0);
globalScene.tweens.add({
targets: this.externalPartyContainer,
duration: Utils.fixedInt(1000),
duration: fixedInt(1000),
ease: "Sine.easeInOut",
y: "-=24",
alpha: 1,
@ -292,7 +292,7 @@ export default class LoginFormUiHandler extends FormModalUiHandler {
this.infoContainer.setAlpha(0);
globalScene.tweens.add({
targets: this.infoContainer,
duration: Utils.fixedInt(1000),
duration: fixedInt(1000),
ease: "Sine.easeInOut",
y: "-=24",
alpha: 1,

View File

@ -2,7 +2,7 @@ import { bypassLogin } from "#app/battle-scene";
import { globalScene } from "#app/global-scene";
import { TextStyle, addTextObject, getTextStyleOptions } from "./text";
import { Mode } from "./ui";
import * as Utils from "../utils";
import { getEnumKeys, isLocal, isBeta, fixedInt, getCookie, sessionIdKey } from "#app/utils";
import { addWindow, WindowVariant } from "./ui-theme";
import MessageUiHandler from "./message-ui-handler";
import type { OptionSelectConfig, OptionSelectItem } from "./abstact-option-select-ui-handler";
@ -75,7 +75,7 @@ export default class MenuUiHandler extends MessageUiHandler {
{ condition: bypassLogin, options: [MenuOptions.LOG_OUT] },
];
this.menuOptions = Utils.getEnumKeys(MenuOptions)
this.menuOptions = getEnumKeys(MenuOptions)
.map(m => Number.parseInt(MenuOptions[m]) as MenuOptions)
.filter(m => {
return !this.excludedMenus().some(exclusion => exclusion.condition && exclusion.options.includes(m));
@ -130,7 +130,7 @@ export default class MenuUiHandler extends MessageUiHandler {
{ condition: bypassLogin, options: [MenuOptions.LOG_OUT] },
];
this.menuOptions = Utils.getEnumKeys(MenuOptions)
this.menuOptions = getEnumKeys(MenuOptions)
.map(m => Number.parseInt(MenuOptions[m]) as MenuOptions)
.filter(m => {
return !this.excludedMenus().some(exclusion => exclusion.condition && exclusion.options.includes(m));
@ -238,7 +238,7 @@ export default class MenuUiHandler extends MessageUiHandler {
});
};
if (Utils.isLocal || Utils.isBeta) {
if (isLocal || isBeta) {
manageDataOptions.push({
label: i18next.t("menuUiHandler:importSession"),
handler: () => {
@ -292,7 +292,7 @@ export default class MenuUiHandler extends MessageUiHandler {
},
keepOpen: true,
});
if (Utils.isLocal || Utils.isBeta) {
if (isLocal || isBeta) {
manageDataOptions.push({
label: i18next.t("menuUiHandler:importData"),
handler: () => {
@ -328,7 +328,7 @@ export default class MenuUiHandler extends MessageUiHandler {
keepOpen: true,
},
);
if (Utils.isLocal || Utils.isBeta) {
if (isLocal || isBeta) {
// this should make sure we don't have this option in live
manageDataOptions.push({
label: "Test Dialogue",
@ -510,7 +510,7 @@ export default class MenuUiHandler extends MessageUiHandler {
this.render();
super.show(args);
this.menuOptions = Utils.getEnumKeys(MenuOptions)
this.menuOptions = getEnumKeys(MenuOptions)
.map(m => Number.parseInt(MenuOptions[m]) as MenuOptions)
.filter(m => {
return !this.excludedMenus().some(exclusion => exclusion.condition && exclusion.options.includes(m));
@ -574,7 +574,7 @@ export default class MenuUiHandler extends MessageUiHandler {
ui.setOverlayMode(Mode.EGG_LIST);
success = true;
} else {
ui.showText(i18next.t("menuUiHandler:noEggs"), null, () => ui.showText(""), Utils.fixedInt(1500));
ui.showText(i18next.t("menuUiHandler:noEggs"), null, () => ui.showText(""), fixedInt(1500));
error = true;
}
break;
@ -607,7 +607,7 @@ export default class MenuUiHandler extends MessageUiHandler {
: i18next.t("menuUiHandler:unlinkDiscord"),
handler: () => {
if (loggedInUser?.discordId === "") {
const token = Utils.getCookie(Utils.sessionIdKey);
const token = getCookie(sessionIdKey);
const redirectUri = encodeURIComponent(`${import.meta.env.VITE_SERVER_URL}/auth/discord/callback`);
const discordId = import.meta.env.VITE_DISCORD_CLIENT_ID;
const discordUrl = `https://discord.com/api/oauth2/authorize?client_id=${discordId}&redirect_uri=${redirectUri}&response_type=code&scope=identify&state=${token}&prompt=none`;
@ -627,7 +627,7 @@ export default class MenuUiHandler extends MessageUiHandler {
: i18next.t("menuUiHandler:unlinkGoogle"),
handler: () => {
if (loggedInUser?.googleId === "") {
const token = Utils.getCookie(Utils.sessionIdKey);
const token = getCookie(sessionIdKey);
const redirectUri = encodeURIComponent(`${import.meta.env.VITE_SERVER_URL}/auth/google/callback`);
const googleId = import.meta.env.VITE_GOOGLE_CLIENT_ID;
const googleUrl = `https://accounts.google.com/o/oauth2/auth?client_id=${googleId}&response_type=code&redirect_uri=${redirectUri}&scope=openid&state=${token}`;

View File

@ -1,6 +1,6 @@
import AwaitableUiHandler from "./awaitable-ui-handler";
import type { Mode } from "./ui";
import * as Utils from "../utils";
import { getFrameMs } from "#app/utils";
import { globalScene } from "#app/global-scene";
export default abstract class MessageUiHandler extends AwaitableUiHandler {
@ -183,7 +183,7 @@ export default abstract class MessageUiHandler extends AwaitableUiHandler {
if (charDelay) {
this.textTimer!.paused = true; // TODO: is the bang correct?
globalScene.tweens.addCounter({
duration: Utils.getFrameMs(charDelay),
duration: getFrameMs(charDelay),
onComplete: () => {
this.textTimer!.paused = false; // TODO: is the bang correct?
advance();
@ -193,7 +193,7 @@ export default abstract class MessageUiHandler extends AwaitableUiHandler {
this.textTimer!.paused = true;
globalScene.time.delayedCall(150, () => {
globalScene.ui.fadeOut(750).then(() => {
const delay = Utils.getFrameMs(charFade);
const delay = getFrameMs(charFade);
globalScene.time.delayedCall(delay, () => {
globalScene.ui.fadeIn(500).then(() => {
this.textTimer!.paused = false;

View File

@ -10,11 +10,10 @@ import { handleTutorial, Tutorial } from "../tutorial";
import { Button } from "#enums/buttons";
import MoveInfoOverlay from "./move-info-overlay";
import { allMoves } from "../data/moves/move";
import * as Utils from "./../utils";
import { formatMoney, NumberHolder } from "#app/utils";
import Overrides from "#app/overrides";
import i18next from "i18next";
import { ShopCursorTarget } from "#app/enums/shop-cursor-target";
import { NumberHolder } from "./../utils";
import Phaser from "phaser";
import type { PokeballType } from "#enums/pokeball";
@ -645,7 +644,7 @@ export default class ModifierSelectUiHandler extends AwaitableUiHandler {
this.rerollCostText.setVisible(true);
const canReroll = globalScene.money >= this.rerollCost;
const formattedMoney = Utils.formatMoney(globalScene.moneyFormat, this.rerollCost);
const formattedMoney = formatMoney(globalScene.moneyFormat, this.rerollCost);
this.rerollCostText.setText(i18next.t("modifierSelectUiHandler:rerollCost", { formattedMoney }));
this.rerollCostText.setColor(this.getTextColor(canReroll ? TextStyle.MONEY : TextStyle.PARTY_RED));
@ -933,7 +932,7 @@ class ModifierOption extends Phaser.GameObjects.Container {
const cost = Overrides.WAIVE_ROLL_FEE_OVERRIDE ? 0 : this.modifierTypeOption.cost;
const textStyle = cost <= globalScene.money ? TextStyle.MONEY : TextStyle.PARTY_RED;
const formattedMoney = Utils.formatMoney(globalScene.moneyFormat, cost);
const formattedMoney = formatMoney(globalScene.moneyFormat, cost);
this.itemCostText.setText(i18next.t("modifierSelectUiHandler:itemCost", { formattedMoney }));
this.itemCostText.setColor(getTextColor(textStyle, false, globalScene.uiTheme));

View File

@ -2,7 +2,7 @@ import type { InfoToggle } from "#app/battle-scene";
import { globalScene } from "#app/global-scene";
import { TextStyle, addTextObject } from "./text";
import { addWindow } from "./ui-theme";
import * as Utils from "../utils";
import { getLocalizedSpriteKey, fixedInt } from "#app/utils";
import type Move from "../data/moves/move";
import { MoveCategory } from "#enums/MoveCategory";
import { PokemonType } from "#enums/pokemon-type";
@ -120,7 +120,7 @@ export default class MoveInfoOverlay extends Phaser.GameObjects.Container implem
valuesBg.setOrigin(0, 0);
this.val.add(valuesBg);
this.typ = globalScene.add.sprite(25, EFF_HEIGHT - 35, Utils.getLocalizedSpriteKey("types"), "unknown");
this.typ = globalScene.add.sprite(25, EFF_HEIGHT - 35, getLocalizedSpriteKey("types"), "unknown");
this.typ.setScale(0.8);
this.val.add(this.typ);
@ -175,7 +175,7 @@ export default class MoveInfoOverlay extends Phaser.GameObjects.Container implem
this.pow.setText(move.power >= 0 ? move.power.toString() : "---");
this.acc.setText(move.accuracy >= 0 ? move.accuracy.toString() : "---");
this.pp.setText(move.pp >= 0 ? move.pp.toString() : "---");
this.typ.setTexture(Utils.getLocalizedSpriteKey("types"), PokemonType[move.type].toLowerCase());
this.typ.setTexture(getLocalizedSpriteKey("types"), PokemonType[move.type].toLowerCase());
this.cat.setFrame(MoveCategory[move.category].toLowerCase());
this.desc.setText(move?.effect || "");
@ -193,10 +193,10 @@ export default class MoveInfoOverlay extends Phaser.GameObjects.Container implem
// generate scrolling effects
this.descScroll = globalScene.tweens.add({
targets: this.desc,
delay: Utils.fixedInt(2000),
delay: fixedInt(2000),
loop: -1,
hold: Utils.fixedInt(2000),
duration: Utils.fixedInt((moveDescriptionLineCount - 3) * 2000),
hold: fixedInt(2000),
duration: fixedInt((moveDescriptionLineCount - 3) * 2000),
y: `-=${14.83 * (72 / 96) * (moveDescriptionLineCount - 3)}`,
});
}
@ -219,7 +219,7 @@ export default class MoveInfoOverlay extends Phaser.GameObjects.Container implem
}
globalScene.tweens.add({
targets: this.desc,
duration: Utils.fixedInt(125),
duration: fixedInt(125),
ease: "Sine.easeInOut",
alpha: visible ? 1 : 0,
});

View File

@ -6,8 +6,7 @@ import { addWindow, WindowVariant } from "./ui-theme";
import type { MysteryEncounterPhase } from "../phases/mystery-encounter-phases";
import { PartyUiMode } from "./party-ui-handler";
import type MysteryEncounterOption from "#app/data/mystery-encounters/mystery-encounter-option";
import * as Utils from "../utils";
import { isNullOrUndefined } from "../utils";
import { fixedInt, isNullOrUndefined } from "#app/utils";
import { getPokeballAtlasKey } from "../data/pokeball";
import type { OptionSelectSettings } from "#app/data/mystery-encounters/utils/encounter-phase-utils";
import { getEncounterText } from "#app/data/mystery-encounters/utils/encounter-dialogue-utils";
@ -456,10 +455,10 @@ export default class MysteryEncounterUiHandler extends UiHandler {
if (optionTextWidth > nonScrollWidth) {
this.optionScrollTweens[i] = globalScene.tweens.add({
targets: optionText,
delay: Utils.fixedInt(2000),
delay: fixedInt(2000),
loop: -1,
hold: Utils.fixedInt(2000),
duration: Utils.fixedInt(((optionTextWidth - nonScrollWidth) / 15) * 2000),
hold: fixedInt(2000),
duration: fixedInt(((optionTextWidth - nonScrollWidth) / 15) * 2000),
x: `-=${optionTextWidth - nonScrollWidth}`,
});
}
@ -527,10 +526,10 @@ export default class MysteryEncounterUiHandler extends UiHandler {
if (descriptionLineCount > 6) {
this.descriptionScrollTween = globalScene.tweens.add({
targets: descriptionTextObject,
delay: Utils.fixedInt(2000),
delay: fixedInt(2000),
loop: -1,
hold: Utils.fixedInt(2000),
duration: Utils.fixedInt((descriptionLineCount - 6) * 2000),
hold: fixedInt(2000),
duration: fixedInt((descriptionLineCount - 6) * 2000),
y: `-=${10 * (descriptionLineCount - 6)}`,
});
}
@ -637,10 +636,10 @@ export default class MysteryEncounterUiHandler extends UiHandler {
if (tooltipLineCount > 3) {
this.tooltipScrollTween = globalScene.tweens.add({
targets: tooltipTextObject,
delay: Utils.fixedInt(1200),
delay: fixedInt(1200),
loop: -1,
hold: Utils.fixedInt(1200),
duration: Utils.fixedInt((tooltipLineCount - 3) * 1200),
hold: fixedInt(1200),
duration: fixedInt((tooltipLineCount - 3) * 1200),
y: `-=${11.2 * (tooltipLineCount - 3)}`,
});
}

View File

@ -5,7 +5,7 @@ import { addBBCodeTextObject, addTextObject, getTextColor, TextStyle } from "#ap
import { Command } from "#app/ui/command-ui-handler";
import MessageUiHandler from "#app/ui/message-ui-handler";
import { Mode } from "#app/ui/ui";
import * as Utils from "#app/utils";
import { BooleanHolder, toReadableString, randInt, getLocalizedSpriteKey } from "#app/utils";
import {
PokemonFormChangeItemModifier,
PokemonHeldItemModifier,
@ -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";
@ -193,18 +193,14 @@ export default class PartyUiHandler extends MessageUiHandler {
public static FilterNonFainted = (pokemon: PlayerPokemon) => {
if (pokemon.isFainted()) {
return i18next.t("partyUiHandler:noEnergy", {
pokemonName: getPokemonNameWithAffix(pokemon),
});
return i18next.t("partyUiHandler:noEnergy", { pokemonName: getPokemonNameWithAffix(pokemon, false) });
}
return null;
};
public static FilterFainted = (pokemon: PlayerPokemon) => {
if (!pokemon.isFainted()) {
return i18next.t("partyUiHandler:hasEnergy", {
pokemonName: getPokemonNameWithAffix(pokemon),
});
return i18next.t("partyUiHandler:hasEnergy", { pokemonName: getPokemonNameWithAffix(pokemon, false) });
}
return null;
};
@ -215,12 +211,10 @@ export default class PartyUiHandler extends MessageUiHandler {
* @returns
*/
private FilterChallengeLegal = (pokemon: PlayerPokemon) => {
const challengeAllowed = new Utils.BooleanHolder(true);
const challengeAllowed = new BooleanHolder(true);
applyChallenges(ChallengeType.POKEMON_IN_BATTLE, pokemon, challengeAllowed);
if (!challengeAllowed.value) {
return i18next.t("partyUiHandler:cantBeUsed", {
pokemonName: getPokemonNameWithAffix(pokemon),
});
return i18next.t("partyUiHandler:cantBeUsed", { pokemonName: getPokemonNameWithAffix(pokemon, false) });
}
return null;
};
@ -232,9 +226,7 @@ export default class PartyUiHandler extends MessageUiHandler {
m => m instanceof PokemonHeldItemModifier && m.pokemonId === pokemon.id && m.matchType(modifier),
) as PokemonHeldItemModifier;
if (matchingModifier && matchingModifier.stackCount === matchingModifier.getMaxStackCount()) {
return i18next.t("partyUiHandler:tooManyItems", {
pokemonName: getPokemonNameWithAffix(pokemon),
});
return i18next.t("partyUiHandler:tooManyItems", { pokemonName: getPokemonNameWithAffix(pokemon, false) });
}
return null;
};
@ -583,7 +575,7 @@ export default class PartyUiHandler extends MessageUiHandler {
this.showText(
i18next.t(
pokemon.pauseEvolutions ? "partyUiHandler:pausedEvolutions" : "partyUiHandler:unpausedEvolutions",
{ pokemonName: getPokemonNameWithAffix(pokemon) },
{ pokemonName: getPokemonNameWithAffix(pokemon, false) },
),
undefined,
() => this.showText("", 0),
@ -596,14 +588,14 @@ export default class PartyUiHandler extends MessageUiHandler {
this.showText(
i18next.t("partyUiHandler:unspliceConfirmation", {
fusionName: pokemon.fusionSpecies?.name,
pokemonName: pokemon.name,
pokemonName: pokemon.getName(),
}),
null,
() => {
ui.setModeWithoutClear(
Mode.CONFIRM,
() => {
const fusionName = pokemon.name;
const fusionName = pokemon.getName();
pokemon.unfuse().then(() => {
this.clearPartySlots();
this.populatePartySlots();
@ -611,7 +603,7 @@ export default class PartyUiHandler extends MessageUiHandler {
this.showText(
i18next.t("partyUiHandler:wasReverted", {
fusionName: fusionName,
pokemonName: pokemon.name,
pokemonName: pokemon.getName(false),
}),
undefined,
() => {
@ -637,7 +629,7 @@ export default class PartyUiHandler extends MessageUiHandler {
this.blockInput = true;
this.showText(
i18next.t("partyUiHandler:releaseConfirmation", {
pokemonName: getPokemonNameWithAffix(pokemon),
pokemonName: getPokemonNameWithAffix(pokemon, false),
}),
null,
() => {
@ -1201,7 +1193,7 @@ export default class PartyUiHandler extends MessageUiHandler {
if (this.localizedOptions.includes(option)) {
optionName = i18next.t(`partyUiHandler:${PartyOption[option]}`);
} else {
optionName = Utils.toReadableString(PartyOption[option]);
optionName = toReadableString(PartyOption[option]);
}
}
break;
@ -1285,7 +1277,7 @@ export default class PartyUiHandler extends MessageUiHandler {
doRelease(slotIndex: number): void {
this.showText(
this.getReleaseMessage(getPokemonNameWithAffix(globalScene.getPlayerParty()[slotIndex])),
this.getReleaseMessage(getPokemonNameWithAffix(globalScene.getPlayerParty()[slotIndex], false)),
null,
() => {
this.clearPartySlots();
@ -1309,7 +1301,7 @@ export default class PartyUiHandler extends MessageUiHandler {
}
getReleaseMessage(pokemonName: string): string {
const rand = Utils.randInt(128);
const rand = randInt(128);
if (rand < 20) {
return i18next.t("partyUiHandler:goodbye", { pokemonName: pokemonName });
}
@ -1495,7 +1487,7 @@ class PartySlot extends Phaser.GameObjects.Container {
const slotInfoContainer = globalScene.add.container(0, 0);
this.add(slotInfoContainer);
let displayName = this.pokemon.getNameToRender();
let displayName = this.pokemon.getNameToRender(false);
let nameTextWidth: number;
const nameSizeTest = addTextObject(0, 0, displayName, TextStyle.PARTY);
@ -1566,7 +1558,7 @@ class PartySlot extends Phaser.GameObjects.Container {
}
if (this.pokemon.status) {
const statusIndicator = globalScene.add.sprite(0, 0, Utils.getLocalizedSpriteKey("statuses"));
const statusIndicator = globalScene.add.sprite(0, 0, getLocalizedSpriteKey("statuses"));
statusIndicator.setFrame(StatusEffect[this.pokemon.status?.effect].toLowerCase());
statusIndicator.setOrigin(0, 0);
statusIndicator.setPositionRelative(slotLevelLabel, this.slotIndex >= battlerCount ? 43 : 55, 0);
@ -1575,12 +1567,12 @@ class PartySlot extends Phaser.GameObjects.Container {
}
if (this.pokemon.isShiny()) {
const doubleShiny = this.pokemon.isFusion() && this.pokemon.shiny && this.pokemon.fusionShiny;
const doubleShiny = this.pokemon.isDoubleShiny(false);
const shinyStar = globalScene.add.image(0, 0, `shiny_star_small${doubleShiny ? "_1" : ""}`);
shinyStar.setOrigin(0, 0);
shinyStar.setPositionRelative(this.slotName, -9, 3);
shinyStar.setTint(getVariantTint(!doubleShiny ? this.pokemon.getVariant() : this.pokemon.variant));
shinyStar.setTint(getVariantTint(this.pokemon.getBaseVariant(doubleShiny)));
slotInfoContainer.add(shinyStar);
@ -1588,7 +1580,9 @@ class PartySlot extends Phaser.GameObjects.Container {
const fusionShinyStar = globalScene.add.image(0, 0, "shiny_star_small_2");
fusionShinyStar.setOrigin(0, 0);
fusionShinyStar.setPosition(shinyStar.x, shinyStar.y);
fusionShinyStar.setTint(getVariantTint(this.pokemon.fusionVariant));
fusionShinyStar.setTint(
getVariantTint(this.pokemon.summonData?.illusion?.basePokemon.fusionVariant ?? this.pokemon.fusionVariant),
);
slotInfoContainer.add(fusionShinyStar);
}

View File

@ -1,7 +1,7 @@
import type { InfoToggle } from "../battle-scene";
import { TextStyle, addTextObject } from "./text";
import { addWindow } from "./ui-theme";
import * as Utils from "../utils";
import { fixedInt } from "#app/utils";
import i18next from "i18next";
import { globalScene } from "#app/global-scene";
@ -128,10 +128,10 @@ export default class PokedexInfoOverlay extends Phaser.GameObjects.Container imp
// generate scrolling effects
this.descScroll = globalScene.tweens.add({
targets: this.desc,
delay: Utils.fixedInt(2000),
delay: fixedInt(2000),
loop: -1,
hold: Utils.fixedInt(2000),
duration: Utils.fixedInt((lineCount - 3) * 2000),
hold: fixedInt(2000),
duration: fixedInt((lineCount - 3) * 2000),
y: `-=${14.83 * (72 / 96) * (lineCount - 3)}`,
});
}
@ -154,7 +154,7 @@ export default class PokedexInfoOverlay extends Phaser.GameObjects.Container imp
}
globalScene.tweens.add({
targets: this.desc,
duration: Utils.fixedInt(125),
duration: fixedInt(125),
ease: "Sine.easeInOut",
alpha: visible ? 1 : 0,
});

View File

@ -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";

View File

@ -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";
@ -54,7 +54,7 @@ import {
toReadableString,
} from "#app/utils";
import type { Nature } from "#enums/nature";
import * as Utils from "../utils";
import { getEnumKeys } from "#app/utils";
import { speciesTmMoves } from "#app/data/balance/tms";
import type { BiomeTierTod } from "#app/data/balance/biomes";
import { BiomePoolTier, catchableSpecies } from "#app/data/balance/biomes";
@ -592,7 +592,7 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
this.menuContainer.setVisible(false);
this.menuOptions = Utils.getEnumKeys(MenuOptions).map(m => Number.parseInt(MenuOptions[m]) as MenuOptions);
this.menuOptions = getEnumKeys(MenuOptions).map(m => Number.parseInt(MenuOptions[m]) as MenuOptions);
this.optionSelectText = addBBCodeTextObject(
0,
@ -696,7 +696,7 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
this.starterAttributes = this.initStarterPrefs();
this.menuOptions = Utils.getEnumKeys(MenuOptions).map(m => Number.parseInt(MenuOptions[m]) as MenuOptions);
this.menuOptions = getEnumKeys(MenuOptions).map(m => Number.parseInt(MenuOptions[m]) as MenuOptions);
this.menuContainer.setVisible(true);

View File

@ -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";

View File

@ -1,7 +1,7 @@
import PokemonInfoContainer from "#app/ui/pokemon-info-container";
import { Gender } from "#app/data/gender";
import { PokemonType } from "#enums/pokemon-type";
import * as Utils from "#app/utils";
import { rgbHexToRgba, padInt } from "#app/utils";
import { TextStyle, addTextObject } from "#app/ui/text";
import { speciesEggMoves } from "#app/data/balance/egg-moves";
import { allMoves } from "#app/data/moves/move";
@ -154,14 +154,14 @@ export default class PokemonHatchInfoContainer extends PokemonInfoContainer {
super.show(pokemon, false, 1, hatchInfo.getDex(), hatchInfo.getStarterEntry(), true);
const colorScheme = starterColors[species.speciesId];
this.pokemonCandyIcon.setTint(argbFromRgba(Utils.rgbHexToRgba(colorScheme[0])));
this.pokemonCandyIcon.setTint(argbFromRgba(rgbHexToRgba(colorScheme[0])));
this.pokemonCandyIcon.setVisible(true);
this.pokemonCandyOverlayIcon.setTint(argbFromRgba(Utils.rgbHexToRgba(colorScheme[1])));
this.pokemonCandyOverlayIcon.setTint(argbFromRgba(rgbHexToRgba(colorScheme[1])));
this.pokemonCandyOverlayIcon.setVisible(true);
this.pokemonCandyCountText.setText(`x${globalScene.gameData.starterData[species.speciesId].candyCount}`);
this.pokemonCandyCountText.setVisible(true);
this.pokemonNumberText.setText(Utils.padInt(species.speciesId, 4));
this.pokemonNumberText.setText(padInt(species.speciesId, 4));
this.pokemonNameText.setText(species.name);
const hasEggMoves = species && speciesEggMoves.hasOwnProperty(species.speciesId);

View File

@ -1,5 +1,5 @@
import { globalScene } from "#app/global-scene";
import * as Utils from "../utils";
import { fixedInt } from "#app/utils";
export enum PokemonIconAnimMode {
NONE,
@ -27,7 +27,7 @@ export default class PokemonIconAnimHandler {
}
};
globalScene.tweens.addCounter({
duration: Utils.fixedInt(200),
duration: fixedInt(200),
from: 0,
to: 1,
yoyo: true,

Some files were not shown because too many files have changed in this diff Show More