diff --git a/public/images/pokemon/variant/169.json b/public/images/pokemon/variant/169.json index 92577fd0c34..3824fc5e351 100644 --- a/public/images/pokemon/variant/169.json +++ b/public/images/pokemon/variant/169.json @@ -1,15 +1,15 @@ { "0": { - "7b4a9c": "323f81", - "63197b": "142557", - "a55ace": "6265b4", + "7b4a9c": "d684ce", + "63197b": "9c528c", + "a55ace": "ffb5f7", "101010": "101010", - "b57bce": "99a3ee", - "08426b": "277eb2", - "ce0021": "ce0021", - "ffd600": "ffc3f4", - "d69400": "ff61e2", - "216b94": "4aa6ce", + "b57bce": "ffd6ef", + "08426b": "638400", + "ce0021": "940821", + "ffd600": "ffd600", + "d69400": "d69400", + "216b94": "8ca508", "ffffff": "ffffff", "a5a5a5": "a5a5a5", "6b6b6b": "6b6b6b" diff --git a/public/images/pokemon/variant/42.json b/public/images/pokemon/variant/42.json index 4ae5bf088cf..74311a59fb2 100644 --- a/public/images/pokemon/variant/42.json +++ b/public/images/pokemon/variant/42.json @@ -14,26 +14,26 @@ "943a7b": "175990" }, "1": { - "3a3a7b": "1d0f4e", - "5aadef": "3d4381", - "6384ce": "2f2a5f", - "631052": "892d03", - "ce6bb5": "f1a139", - "adceff": "666fb4", + "3a3a7b": "084a00", + "5aadef": "6b9c29", + "6384ce": "317300", + "631052": "c52931", + "ce6bb5": "ffada5", + "adceff": "84d64a", "000000": "000000", - "ad52ad": "d5711b", + "ad52ad": "e6737b", "636363": "636363", "ffffff": "ffffff", "d6d6d6": "d6d6d6", - "943a7b": "af4e0c" + "943a7b": "d6525a" }, "2": { - "3a3a7b": "584055", - "5aadef": "c1aec0", - "6384ce": "866881", + "3a3a7b": "3d2349", + "5aadef": "cbabca", + "6384ce": "916c8b", "631052": "54070c", "ce6bb5": "bc3b1d", - "adceff": "dfcddd", + "adceff": "e8d2e6", "000000": "000000", "ad52ad": "94241c", "636363": "636363", diff --git a/public/images/pokemon/variant/890-eternamax_2.png b/public/images/pokemon/variant/890-eternamax_2.png index 30c8333a431..b5aab00c241 100644 Binary files a/public/images/pokemon/variant/890-eternamax_2.png and b/public/images/pokemon/variant/890-eternamax_2.png differ diff --git a/public/images/pokemon/variant/890-eternamax_3.png b/public/images/pokemon/variant/890-eternamax_3.png index 48cd4dbe14a..29a3d84c0d6 100644 Binary files a/public/images/pokemon/variant/890-eternamax_3.png and b/public/images/pokemon/variant/890-eternamax_3.png differ diff --git a/public/images/pokemon/variant/_masterlist.json b/public/images/pokemon/variant/_masterlist.json index 22cb44852ea..ea9fe53622b 100644 --- a/public/images/pokemon/variant/_masterlist.json +++ b/public/images/pokemon/variant/_masterlist.json @@ -909,6 +909,11 @@ 2, 2 ], + "472": [ + 0, + 0, + 0 + ], "475-mega": [ 0, 2, @@ -2050,6 +2055,16 @@ 2, 1 ], + "41": [ + 0, + 1, + 1 + ], + "42": [ + 0, + 1, + 1 + ], "308": [ 0, 1, @@ -2869,7 +2884,7 @@ ], "383": [ 0, - 2, + 1, 1 ], "384-mega": [ @@ -4143,6 +4158,16 @@ 1, 1 ], + "41": [ + 0, + 1, + 1 + ], + "42": [ + 0, + 1, + 1 + ], "308": [ 0, 1, @@ -4538,7 +4563,7 @@ ], "747": [ 0, - 1, + 2, 1 ], "748": [ @@ -4591,6 +4616,11 @@ 1, 1 ], + "770": [ + 0, + 0, + 0 + ], "771": [ 0, 2, diff --git a/public/images/pokemon/variant/back/383.json b/public/images/pokemon/variant/back/383.json index bfa8917302b..f3760c0244e 100644 --- a/public/images/pokemon/variant/back/383.json +++ b/public/images/pokemon/variant/back/383.json @@ -1,4 +1,21 @@ { + "1": { + "000000": "000000", + "7b2129": "032a10", + "9c2929": "10371a", + "ff736b": "419e49", + "ff2129": "2b5b32", + "bd3131": "0f461c", + "3a3a3a": "383540", + "736363": "625769", + "ffffff": "fff6de", + "bdbdd6": "e5d4b6", + "9c6b31": "d51b3e", + "ffce31": "ff435d", + "94848c": "72798b", + "ffbdbd": "49c74f", + "ad9ca5": "ad9ca5" + }, "2": { "000000": "000000", "7b2129": "123953", diff --git a/public/images/pokemon/variant/back/622.json b/public/images/pokemon/variant/back/622.json index 4f0338f4e15..9ad7426a9d7 100644 --- a/public/images/pokemon/variant/back/622.json +++ b/public/images/pokemon/variant/back/622.json @@ -1,19 +1,19 @@ { "0": { - "298c8c": "1c3820", - "5aada5": "3e5d43", - "84cece": "758076", - "004a52": "102c16", - "106b63": "0d1e10", + "298c8c": "427373", + "5aada5": "6b9c94", + "84cece": "94bdbd", + "004a52": "192121", + "106b63": "21524a", "191921": "191921", - "106b7b": "102c16", - "29848c": "224427", - "6b4200": "54190e", - "c59c52": "a65c3f", - "9c7329": "763826", - "dece94": "e46424", - "ffefa5": "ff9942", - "bdad73": "cb3000" + "106b7b": "293a42", + "29848c": "424a5a", + "6b4200": "523a10", + "c59c52": "b59463", + "9c7329": "846b3a", + "dece94": "b5de21", + "ffefa5": "d6ff42", + "bdad73": "94bd00" }, "1": { "298c8c": "793907", diff --git a/public/images/pokemon/variant/back/female/41.json b/public/images/pokemon/variant/back/female/41.json new file mode 100644 index 00000000000..87c18df01ac --- /dev/null +++ b/public/images/pokemon/variant/back/female/41.json @@ -0,0 +1,24 @@ +{ + "1": { + "101010": "101010", + "8cb5ef": "4e538f", + "4a427b": "14093b", + "637bb5": "37326f", + "73215a": "aa4c18", + "b5529c": "cc7b32", + "bdceff": "868ecc", + "ffffff": "ffffff", + "636363": "636363" + }, + "2": { + "101010": "101010", + "8cb5ef": "cbabca", + "4a427b": "4d3259", + "637bb5": "916c8b", + "73215a": "670f10", + "b5529c": "94241c", + "bdceff": "e8d2e6", + "ffffff": "ffffff", + "636363": "636363" + } +} \ No newline at end of file diff --git a/public/images/pokemon/variant/back/female/42.json b/public/images/pokemon/variant/back/female/42.json new file mode 100644 index 00000000000..d2be9f7ced5 --- /dev/null +++ b/public/images/pokemon/variant/back/female/42.json @@ -0,0 +1,24 @@ +{ + "1": { + "3a3a7b": "1d0f4e", + "6384ce": "2f2a5f", + "adceff": "666fb4", + "5aadef": "3d4381", + "631052": "892d03", + "000000": "000000", + "ce6bb5": "f1a139", + "ad52ad": "d5711b", + "943a7b": "af4e0c" + }, + "2": { + "3a3a7b": "3d2349", + "6384ce": "916c8b", + "adceff": "e8d2e6", + "5aadef": "cbabca", + "631052": "54070c", + "000000": "000000", + "ce6bb5": "bc3b1d", + "ad52ad": "94241c", + "943a7b": "6c1314" + } +} \ No newline at end of file diff --git a/public/images/pokemon/variant/exp/747_2.json b/public/images/pokemon/variant/exp/747_2.json new file mode 100644 index 00000000000..4273c853522 --- /dev/null +++ b/public/images/pokemon/variant/exp/747_2.json @@ -0,0 +1,188 @@ +{ + "textures": [ + { + "image": "747_2.png", + "format": "RGBA8888", + "size": { + "w": 110, + "h": 110 + }, + "scale": 1, + "frames": [ + { + "filename": "0003.png", + "rotated": false, + "trimmed": false, + "sourceSize": { + "w": 55, + "h": 47 + }, + "spriteSourceSize": { + "x": 0, + "y": 0, + "w": 55, + "h": 47 + }, + "frame": { + "x": 0, + "y": 0, + "w": 55, + "h": 47 + } + }, + { + "filename": "0004.png", + "rotated": false, + "trimmed": false, + "sourceSize": { + "w": 55, + "h": 47 + }, + "spriteSourceSize": { + "x": 0, + "y": 0, + "w": 55, + "h": 47 + }, + "frame": { + "x": 0, + "y": 0, + "w": 55, + "h": 47 + } + }, + { + "filename": "0007.png", + "rotated": false, + "trimmed": false, + "sourceSize": { + "w": 55, + "h": 47 + }, + "spriteSourceSize": { + "x": 0, + "y": 0, + "w": 55, + "h": 47 + }, + "frame": { + "x": 0, + "y": 0, + "w": 55, + "h": 47 + } + }, + { + "filename": "0008.png", + "rotated": false, + "trimmed": false, + "sourceSize": { + "w": 55, + "h": 47 + }, + "spriteSourceSize": { + "x": 0, + "y": 0, + "w": 55, + "h": 47 + }, + "frame": { + "x": 0, + "y": 0, + "w": 55, + "h": 47 + } + }, + { + "filename": "0001.png", + "rotated": false, + "trimmed": true, + "sourceSize": { + "w": 55, + "h": 47 + }, + "spriteSourceSize": { + "x": 0, + "y": 0, + "w": 55, + "h": 46 + }, + "frame": { + "x": 55, + "y": 0, + "w": 55, + "h": 46 + } + }, + { + "filename": "0002.png", + "rotated": false, + "trimmed": true, + "sourceSize": { + "w": 55, + "h": 47 + }, + "spriteSourceSize": { + "x": 0, + "y": 0, + "w": 55, + "h": 46 + }, + "frame": { + "x": 55, + "y": 0, + "w": 55, + "h": 46 + } + }, + { + "filename": "0005.png", + "rotated": false, + "trimmed": true, + "sourceSize": { + "w": 55, + "h": 47 + }, + "spriteSourceSize": { + "x": 0, + "y": 1, + "w": 55, + "h": 46 + }, + "frame": { + "x": 55, + "y": 46, + "w": 55, + "h": 46 + } + }, + { + "filename": "0006.png", + "rotated": false, + "trimmed": true, + "sourceSize": { + "w": 55, + "h": 47 + }, + "spriteSourceSize": { + "x": 0, + "y": 1, + "w": 55, + "h": 46 + }, + "frame": { + "x": 55, + "y": 46, + "w": 55, + "h": 46 + } + } + ] + } + ], + "meta": { + "app": "https://www.codeandweb.com/texturepacker", + "version": "3.0", + "smartupdate": "$TexturePacker:SmartUpdate:e4c4f790c4f0286f608dcdb15a609059:464f7ae7db1c0d034c2a1a65612b0da8:b26f7254994561969f00f765318acf1c$" + } +} \ No newline at end of file diff --git a/public/images/pokemon/variant/exp/890-eternamax_2.json b/public/images/pokemon/variant/exp/890-eternamax_2.json new file mode 100644 index 00000000000..895a2f27841 --- /dev/null +++ b/public/images/pokemon/variant/exp/890-eternamax_2.json @@ -0,0 +1,755 @@ +{ + "textures": [ + { + "image": "890-eternamax_2.png", + "format": "RGBA8888", + "size": { + "w": 579, + "h": 579 + }, + "scale": 1, + "frames": [ + { + "filename": "0035.png", + "rotated": false, + "trimmed": true, + "sourceSize": { + "w": 112, + "h": 112 + }, + "spriteSourceSize": { + "x": 8, + "y": 9, + "w": 100, + "h": 98 + }, + "frame": { + "x": 0, + "y": 0, + "w": 100, + "h": 98 + } + }, + { + "filename": "0031.png", + "rotated": false, + "trimmed": true, + "sourceSize": { + "w": 112, + "h": 112 + }, + "spriteSourceSize": { + "x": 8, + "y": 8, + "w": 95, + "h": 100 + }, + "frame": { + "x": 100, + "y": 0, + "w": 95, + "h": 100 + } + }, + { + "filename": "0029.png", + "rotated": false, + "trimmed": true, + "sourceSize": { + "w": 112, + "h": 112 + }, + "spriteSourceSize": { + "x": 11, + "y": 8, + "w": 91, + "h": 100 + }, + "frame": { + "x": 0, + "y": 98, + "w": 91, + "h": 100 + } + }, + { + "filename": "0001.png", + "rotated": false, + "trimmed": true, + "sourceSize": { + "w": 112, + "h": 112 + }, + "spriteSourceSize": { + "x": 8, + "y": 9, + "w": 96, + "h": 98 + }, + "frame": { + "x": 91, + "y": 100, + "w": 96, + "h": 98 + } + }, + { + "filename": "0032.png", + "rotated": false, + "trimmed": true, + "sourceSize": { + "w": 112, + "h": 112 + }, + "spriteSourceSize": { + "x": 8, + "y": 9, + "w": 95, + "h": 99 + }, + "frame": { + "x": 187, + "y": 100, + "w": 95, + "h": 99 + } + }, + { + "filename": "0030.png", + "rotated": false, + "trimmed": true, + "sourceSize": { + "w": 112, + "h": 112 + }, + "spriteSourceSize": { + "x": 9, + "y": 10, + "w": 91, + "h": 98 + }, + "frame": { + "x": 0, + "y": 198, + "w": 91, + "h": 98 + } + }, + { + "filename": "0007.png", + "rotated": false, + "trimmed": true, + "sourceSize": { + "w": 112, + "h": 112 + }, + "spriteSourceSize": { + "x": 11, + "y": 10, + "w": 88, + "h": 98 + }, + "frame": { + "x": 91, + "y": 198, + "w": 88, + "h": 98 + } + }, + { + "filename": "0002.png", + "rotated": false, + "trimmed": true, + "sourceSize": { + "w": 112, + "h": 112 + }, + "spriteSourceSize": { + "x": 8, + "y": 10, + "w": 95, + "h": 97 + }, + "frame": { + "x": 195, + "y": 0, + "w": 95, + "h": 97 + } + }, + { + "filename": "0003.png", + "rotated": false, + "trimmed": true, + "sourceSize": { + "w": 112, + "h": 112 + }, + "spriteSourceSize": { + "x": 8, + "y": 11, + "w": 95, + "h": 97 + }, + "frame": { + "x": 179, + "y": 199, + "w": 95, + "h": 97 + } + }, + { + "filename": "0004.png", + "rotated": false, + "trimmed": true, + "sourceSize": { + "w": 112, + "h": 112 + }, + "spriteSourceSize": { + "x": 8, + "y": 11, + "w": 95, + "h": 97 + }, + "frame": { + "x": 274, + "y": 199, + "w": 95, + "h": 97 + } + }, + { + "filename": "0033.png", + "rotated": false, + "trimmed": true, + "sourceSize": { + "w": 112, + "h": 112 + }, + "spriteSourceSize": { + "x": 8, + "y": 11, + "w": 95, + "h": 97 + }, + "frame": { + "x": 290, + "y": 0, + "w": 95, + "h": 97 + } + }, + { + "filename": "0034.png", + "rotated": false, + "trimmed": true, + "sourceSize": { + "w": 112, + "h": 112 + }, + "spriteSourceSize": { + "x": 8, + "y": 11, + "w": 94, + "h": 96 + }, + "frame": { + "x": 282, + "y": 97, + "w": 94, + "h": 96 + } + }, + { + "filename": "0028.png", + "rotated": false, + "trimmed": true, + "sourceSize": { + "w": 112, + "h": 112 + }, + "spriteSourceSize": { + "x": 11, + "y": 11, + "w": 90, + "h": 97 + }, + "frame": { + "x": 369, + "y": 193, + "w": 90, + "h": 97 + } + }, + { + "filename": "0005.png", + "rotated": false, + "trimmed": true, + "sourceSize": { + "w": 112, + "h": 112 + }, + "spriteSourceSize": { + "x": 8, + "y": 13, + "w": 93, + "h": 95 + }, + "frame": { + "x": 385, + "y": 0, + "w": 93, + "h": 95 + } + }, + { + "filename": "0017.png", + "rotated": false, + "trimmed": true, + "sourceSize": { + "w": 112, + "h": 112 + }, + "spriteSourceSize": { + "x": 13, + "y": 9, + "w": 91, + "h": 96 + }, + "frame": { + "x": 385, + "y": 95, + "w": 91, + "h": 96 + } + }, + { + "filename": "0008.png", + "rotated": false, + "trimmed": true, + "sourceSize": { + "w": 112, + "h": 112 + }, + "spriteSourceSize": { + "x": 12, + "y": 11, + "w": 87, + "h": 97 + }, + "frame": { + "x": 369, + "y": 290, + "w": 87, + "h": 97 + } + }, + { + "filename": "0009.png", + "rotated": false, + "trimmed": true, + "sourceSize": { + "w": 112, + "h": 112 + }, + "spriteSourceSize": { + "x": 11, + "y": 12, + "w": 90, + "h": 96 + }, + "frame": { + "x": 456, + "y": 290, + "w": 90, + "h": 96 + } + }, + { + "filename": "0015.png", + "rotated": false, + "trimmed": true, + "sourceSize": { + "w": 112, + "h": 112 + }, + "spriteSourceSize": { + "x": 12, + "y": 8, + "w": 90, + "h": 96 + }, + "frame": { + "x": 459, + "y": 191, + "w": 90, + "h": 96 + } + }, + { + "filename": "0016.png", + "rotated": false, + "trimmed": true, + "sourceSize": { + "w": 112, + "h": 112 + }, + "spriteSourceSize": { + "x": 13, + "y": 8, + "w": 90, + "h": 95 + }, + "frame": { + "x": 476, + "y": 95, + "w": 90, + "h": 95 + } + }, + { + "filename": "0014.png", + "rotated": false, + "trimmed": true, + "sourceSize": { + "w": 112, + "h": 112 + }, + "spriteSourceSize": { + "x": 12, + "y": 11, + "w": 89, + "h": 95 + }, + "frame": { + "x": 478, + "y": 0, + "w": 89, + "h": 95 + } + }, + { + "filename": "0027.png", + "rotated": false, + "trimmed": true, + "sourceSize": { + "w": 112, + "h": 112 + }, + "spriteSourceSize": { + "x": 11, + "y": 12, + "w": 89, + "h": 96 + }, + "frame": { + "x": 456, + "y": 386, + "w": 89, + "h": 96 + } + }, + { + "filename": "0025.png", + "rotated": false, + "trimmed": true, + "sourceSize": { + "w": 112, + "h": 112 + }, + "spriteSourceSize": { + "x": 11, + "y": 11, + "w": 89, + "h": 95 + }, + "frame": { + "x": 0, + "y": 296, + "w": 89, + "h": 95 + } + }, + { + "filename": "0006.png", + "rotated": false, + "trimmed": true, + "sourceSize": { + "w": 112, + "h": 112 + }, + "spriteSourceSize": { + "x": 9, + "y": 14, + "w": 89, + "h": 94 + }, + "frame": { + "x": 89, + "y": 296, + "w": 89, + "h": 94 + } + }, + { + "filename": "0011.png", + "rotated": false, + "trimmed": true, + "sourceSize": { + "w": 112, + "h": 112 + }, + "spriteSourceSize": { + "x": 12, + "y": 11, + "w": 88, + "h": 95 + }, + "frame": { + "x": 178, + "y": 296, + "w": 88, + "h": 95 + } + }, + { + "filename": "0023.png", + "rotated": false, + "trimmed": true, + "sourceSize": { + "w": 112, + "h": 112 + }, + "spriteSourceSize": { + "x": 12, + "y": 11, + "w": 87, + "h": 95 + }, + "frame": { + "x": 89, + "y": 390, + "w": 87, + "h": 95 + } + }, + { + "filename": "0013.png", + "rotated": false, + "trimmed": true, + "sourceSize": { + "w": 112, + "h": 112 + }, + "spriteSourceSize": { + "x": 11, + "y": 12, + "w": 89, + "h": 94 + }, + "frame": { + "x": 0, + "y": 391, + "w": 89, + "h": 94 + } + }, + { + "filename": "0012.png", + "rotated": false, + "trimmed": true, + "sourceSize": { + "w": 112, + "h": 112 + }, + "spriteSourceSize": { + "x": 11, + "y": 14, + "w": 89, + "h": 93 + }, + "frame": { + "x": 266, + "y": 387, + "w": 89, + "h": 93 + } + }, + { + "filename": "0019.png", + "rotated": false, + "trimmed": true, + "sourceSize": { + "w": 112, + "h": 112 + }, + "spriteSourceSize": { + "x": 16, + "y": 13, + "w": 85, + "h": 91 + }, + "frame": { + "x": 266, + "y": 296, + "w": 85, + "h": 91 + } + }, + { + "filename": "0024.png", + "rotated": false, + "trimmed": true, + "sourceSize": { + "w": 112, + "h": 112 + }, + "spriteSourceSize": { + "x": 11, + "y": 13, + "w": 88, + "h": 94 + }, + "frame": { + "x": 176, + "y": 391, + "w": 88, + "h": 94 + } + }, + { + "filename": "0010.png", + "rotated": false, + "trimmed": true, + "sourceSize": { + "w": 112, + "h": 112 + }, + "spriteSourceSize": { + "x": 12, + "y": 13, + "w": 87, + "h": 94 + }, + "frame": { + "x": 355, + "y": 387, + "w": 87, + "h": 94 + } + }, + { + "filename": "0018.png", + "rotated": false, + "trimmed": true, + "sourceSize": { + "w": 112, + "h": 112 + }, + "spriteSourceSize": { + "x": 16, + "y": 11, + "w": 87, + "h": 94 + }, + "frame": { + "x": 264, + "y": 480, + "w": 87, + "h": 94 + } + }, + { + "filename": "0026.png", + "rotated": false, + "trimmed": true, + "sourceSize": { + "w": 112, + "h": 112 + }, + "spriteSourceSize": { + "x": 11, + "y": 14, + "w": 89, + "h": 93 + }, + "frame": { + "x": 351, + "y": 481, + "w": 89, + "h": 93 + } + }, + { + "filename": "0022.png", + "rotated": false, + "trimmed": true, + "sourceSize": { + "w": 112, + "h": 112 + }, + "spriteSourceSize": { + "x": 12, + "y": 11, + "w": 87, + "h": 93 + }, + "frame": { + "x": 440, + "y": 482, + "w": 87, + "h": 93 + } + }, + { + "filename": "0021.png", + "rotated": false, + "trimmed": true, + "sourceSize": { + "w": 112, + "h": 112 + }, + "spriteSourceSize": { + "x": 13, + "y": 10, + "w": 86, + "h": 94 + }, + "frame": { + "x": 0, + "y": 485, + "w": 86, + "h": 94 + } + }, + { + "filename": "0020.png", + "rotated": false, + "trimmed": true, + "sourceSize": { + "w": 112, + "h": 112 + }, + "spriteSourceSize": { + "x": 13, + "y": 14, + "w": 85, + "h": 91 + }, + "frame": { + "x": 86, + "y": 485, + "w": 85, + "h": 91 + } + } + ] + } + ], + "meta": { + "app": "https://www.codeandweb.com/texturepacker", + "version": "3.0", + "smartupdate": "$TexturePacker:SmartUpdate:8fd9e1830200ec8e4aac8571cc2d27a6:c966e3efce03c7bae43d7bca6d6dfa62:cedd2711a12bbacba5623505fe88bd92$" + } +} \ No newline at end of file diff --git a/public/images/pokemon/variant/exp/890-eternamax_3.json b/public/images/pokemon/variant/exp/890-eternamax_3.json new file mode 100644 index 00000000000..ecc084c689f --- /dev/null +++ b/public/images/pokemon/variant/exp/890-eternamax_3.json @@ -0,0 +1,755 @@ +{ + "textures": [ + { + "image": "890-eternamax_3.png", + "format": "RGBA8888", + "size": { + "w": 579, + "h": 579 + }, + "scale": 1, + "frames": [ + { + "filename": "0035.png", + "rotated": false, + "trimmed": true, + "sourceSize": { + "w": 112, + "h": 112 + }, + "spriteSourceSize": { + "x": 8, + "y": 9, + "w": 100, + "h": 98 + }, + "frame": { + "x": 0, + "y": 0, + "w": 100, + "h": 98 + } + }, + { + "filename": "0031.png", + "rotated": false, + "trimmed": true, + "sourceSize": { + "w": 112, + "h": 112 + }, + "spriteSourceSize": { + "x": 8, + "y": 8, + "w": 95, + "h": 100 + }, + "frame": { + "x": 100, + "y": 0, + "w": 95, + "h": 100 + } + }, + { + "filename": "0029.png", + "rotated": false, + "trimmed": true, + "sourceSize": { + "w": 112, + "h": 112 + }, + "spriteSourceSize": { + "x": 11, + "y": 8, + "w": 91, + "h": 100 + }, + "frame": { + "x": 0, + "y": 98, + "w": 91, + "h": 100 + } + }, + { + "filename": "0001.png", + "rotated": false, + "trimmed": true, + "sourceSize": { + "w": 112, + "h": 112 + }, + "spriteSourceSize": { + "x": 8, + "y": 9, + "w": 96, + "h": 98 + }, + "frame": { + "x": 91, + "y": 100, + "w": 96, + "h": 98 + } + }, + { + "filename": "0032.png", + "rotated": false, + "trimmed": true, + "sourceSize": { + "w": 112, + "h": 112 + }, + "spriteSourceSize": { + "x": 8, + "y": 9, + "w": 95, + "h": 99 + }, + "frame": { + "x": 187, + "y": 100, + "w": 95, + "h": 99 + } + }, + { + "filename": "0030.png", + "rotated": false, + "trimmed": true, + "sourceSize": { + "w": 112, + "h": 112 + }, + "spriteSourceSize": { + "x": 9, + "y": 10, + "w": 91, + "h": 98 + }, + "frame": { + "x": 0, + "y": 198, + "w": 91, + "h": 98 + } + }, + { + "filename": "0007.png", + "rotated": false, + "trimmed": true, + "sourceSize": { + "w": 112, + "h": 112 + }, + "spriteSourceSize": { + "x": 11, + "y": 10, + "w": 88, + "h": 98 + }, + "frame": { + "x": 91, + "y": 198, + "w": 88, + "h": 98 + } + }, + { + "filename": "0002.png", + "rotated": false, + "trimmed": true, + "sourceSize": { + "w": 112, + "h": 112 + }, + "spriteSourceSize": { + "x": 8, + "y": 10, + "w": 95, + "h": 97 + }, + "frame": { + "x": 195, + "y": 0, + "w": 95, + "h": 97 + } + }, + { + "filename": "0003.png", + "rotated": false, + "trimmed": true, + "sourceSize": { + "w": 112, + "h": 112 + }, + "spriteSourceSize": { + "x": 8, + "y": 11, + "w": 95, + "h": 97 + }, + "frame": { + "x": 179, + "y": 199, + "w": 95, + "h": 97 + } + }, + { + "filename": "0004.png", + "rotated": false, + "trimmed": true, + "sourceSize": { + "w": 112, + "h": 112 + }, + "spriteSourceSize": { + "x": 8, + "y": 11, + "w": 95, + "h": 97 + }, + "frame": { + "x": 274, + "y": 199, + "w": 95, + "h": 97 + } + }, + { + "filename": "0033.png", + "rotated": false, + "trimmed": true, + "sourceSize": { + "w": 112, + "h": 112 + }, + "spriteSourceSize": { + "x": 8, + "y": 11, + "w": 95, + "h": 97 + }, + "frame": { + "x": 290, + "y": 0, + "w": 95, + "h": 97 + } + }, + { + "filename": "0034.png", + "rotated": false, + "trimmed": true, + "sourceSize": { + "w": 112, + "h": 112 + }, + "spriteSourceSize": { + "x": 8, + "y": 11, + "w": 94, + "h": 96 + }, + "frame": { + "x": 282, + "y": 97, + "w": 94, + "h": 96 + } + }, + { + "filename": "0028.png", + "rotated": false, + "trimmed": true, + "sourceSize": { + "w": 112, + "h": 112 + }, + "spriteSourceSize": { + "x": 11, + "y": 11, + "w": 90, + "h": 97 + }, + "frame": { + "x": 369, + "y": 193, + "w": 90, + "h": 97 + } + }, + { + "filename": "0005.png", + "rotated": false, + "trimmed": true, + "sourceSize": { + "w": 112, + "h": 112 + }, + "spriteSourceSize": { + "x": 8, + "y": 13, + "w": 93, + "h": 95 + }, + "frame": { + "x": 385, + "y": 0, + "w": 93, + "h": 95 + } + }, + { + "filename": "0017.png", + "rotated": false, + "trimmed": true, + "sourceSize": { + "w": 112, + "h": 112 + }, + "spriteSourceSize": { + "x": 13, + "y": 9, + "w": 91, + "h": 96 + }, + "frame": { + "x": 385, + "y": 95, + "w": 91, + "h": 96 + } + }, + { + "filename": "0008.png", + "rotated": false, + "trimmed": true, + "sourceSize": { + "w": 112, + "h": 112 + }, + "spriteSourceSize": { + "x": 12, + "y": 11, + "w": 87, + "h": 97 + }, + "frame": { + "x": 369, + "y": 290, + "w": 87, + "h": 97 + } + }, + { + "filename": "0009.png", + "rotated": false, + "trimmed": true, + "sourceSize": { + "w": 112, + "h": 112 + }, + "spriteSourceSize": { + "x": 11, + "y": 12, + "w": 90, + "h": 96 + }, + "frame": { + "x": 456, + "y": 290, + "w": 90, + "h": 96 + } + }, + { + "filename": "0015.png", + "rotated": false, + "trimmed": true, + "sourceSize": { + "w": 112, + "h": 112 + }, + "spriteSourceSize": { + "x": 12, + "y": 8, + "w": 90, + "h": 96 + }, + "frame": { + "x": 459, + "y": 191, + "w": 90, + "h": 96 + } + }, + { + "filename": "0016.png", + "rotated": false, + "trimmed": true, + "sourceSize": { + "w": 112, + "h": 112 + }, + "spriteSourceSize": { + "x": 13, + "y": 8, + "w": 90, + "h": 95 + }, + "frame": { + "x": 476, + "y": 95, + "w": 90, + "h": 95 + } + }, + { + "filename": "0014.png", + "rotated": false, + "trimmed": true, + "sourceSize": { + "w": 112, + "h": 112 + }, + "spriteSourceSize": { + "x": 12, + "y": 11, + "w": 89, + "h": 95 + }, + "frame": { + "x": 478, + "y": 0, + "w": 89, + "h": 95 + } + }, + { + "filename": "0027.png", + "rotated": false, + "trimmed": true, + "sourceSize": { + "w": 112, + "h": 112 + }, + "spriteSourceSize": { + "x": 11, + "y": 12, + "w": 89, + "h": 96 + }, + "frame": { + "x": 456, + "y": 386, + "w": 89, + "h": 96 + } + }, + { + "filename": "0025.png", + "rotated": false, + "trimmed": true, + "sourceSize": { + "w": 112, + "h": 112 + }, + "spriteSourceSize": { + "x": 11, + "y": 11, + "w": 89, + "h": 95 + }, + "frame": { + "x": 0, + "y": 296, + "w": 89, + "h": 95 + } + }, + { + "filename": "0006.png", + "rotated": false, + "trimmed": true, + "sourceSize": { + "w": 112, + "h": 112 + }, + "spriteSourceSize": { + "x": 9, + "y": 14, + "w": 89, + "h": 94 + }, + "frame": { + "x": 89, + "y": 296, + "w": 89, + "h": 94 + } + }, + { + "filename": "0011.png", + "rotated": false, + "trimmed": true, + "sourceSize": { + "w": 112, + "h": 112 + }, + "spriteSourceSize": { + "x": 12, + "y": 11, + "w": 88, + "h": 95 + }, + "frame": { + "x": 178, + "y": 296, + "w": 88, + "h": 95 + } + }, + { + "filename": "0023.png", + "rotated": false, + "trimmed": true, + "sourceSize": { + "w": 112, + "h": 112 + }, + "spriteSourceSize": { + "x": 12, + "y": 11, + "w": 87, + "h": 95 + }, + "frame": { + "x": 89, + "y": 390, + "w": 87, + "h": 95 + } + }, + { + "filename": "0013.png", + "rotated": false, + "trimmed": true, + "sourceSize": { + "w": 112, + "h": 112 + }, + "spriteSourceSize": { + "x": 11, + "y": 12, + "w": 89, + "h": 94 + }, + "frame": { + "x": 0, + "y": 391, + "w": 89, + "h": 94 + } + }, + { + "filename": "0012.png", + "rotated": false, + "trimmed": true, + "sourceSize": { + "w": 112, + "h": 112 + }, + "spriteSourceSize": { + "x": 11, + "y": 14, + "w": 89, + "h": 93 + }, + "frame": { + "x": 266, + "y": 387, + "w": 89, + "h": 93 + } + }, + { + "filename": "0019.png", + "rotated": false, + "trimmed": true, + "sourceSize": { + "w": 112, + "h": 112 + }, + "spriteSourceSize": { + "x": 16, + "y": 13, + "w": 85, + "h": 91 + }, + "frame": { + "x": 266, + "y": 296, + "w": 85, + "h": 91 + } + }, + { + "filename": "0024.png", + "rotated": false, + "trimmed": true, + "sourceSize": { + "w": 112, + "h": 112 + }, + "spriteSourceSize": { + "x": 11, + "y": 13, + "w": 88, + "h": 94 + }, + "frame": { + "x": 176, + "y": 391, + "w": 88, + "h": 94 + } + }, + { + "filename": "0010.png", + "rotated": false, + "trimmed": true, + "sourceSize": { + "w": 112, + "h": 112 + }, + "spriteSourceSize": { + "x": 12, + "y": 13, + "w": 87, + "h": 94 + }, + "frame": { + "x": 355, + "y": 387, + "w": 87, + "h": 94 + } + }, + { + "filename": "0018.png", + "rotated": false, + "trimmed": true, + "sourceSize": { + "w": 112, + "h": 112 + }, + "spriteSourceSize": { + "x": 16, + "y": 11, + "w": 87, + "h": 94 + }, + "frame": { + "x": 264, + "y": 480, + "w": 87, + "h": 94 + } + }, + { + "filename": "0026.png", + "rotated": false, + "trimmed": true, + "sourceSize": { + "w": 112, + "h": 112 + }, + "spriteSourceSize": { + "x": 11, + "y": 14, + "w": 89, + "h": 93 + }, + "frame": { + "x": 351, + "y": 481, + "w": 89, + "h": 93 + } + }, + { + "filename": "0022.png", + "rotated": false, + "trimmed": true, + "sourceSize": { + "w": 112, + "h": 112 + }, + "spriteSourceSize": { + "x": 12, + "y": 11, + "w": 87, + "h": 93 + }, + "frame": { + "x": 440, + "y": 482, + "w": 87, + "h": 93 + } + }, + { + "filename": "0021.png", + "rotated": false, + "trimmed": true, + "sourceSize": { + "w": 112, + "h": 112 + }, + "spriteSourceSize": { + "x": 13, + "y": 10, + "w": 86, + "h": 94 + }, + "frame": { + "x": 0, + "y": 485, + "w": 86, + "h": 94 + } + }, + { + "filename": "0020.png", + "rotated": false, + "trimmed": true, + "sourceSize": { + "w": 112, + "h": 112 + }, + "spriteSourceSize": { + "x": 13, + "y": 14, + "w": 85, + "h": 91 + }, + "frame": { + "x": 86, + "y": 485, + "w": 85, + "h": 91 + } + } + ] + } + ], + "meta": { + "app": "https://www.codeandweb.com/texturepacker", + "version": "3.0", + "smartupdate": "$TexturePacker:SmartUpdate:8fd9e1830200ec8e4aac8571cc2d27a6:c966e3efce03c7bae43d7bca6d6dfa62:cedd2711a12bbacba5623505fe88bd92$" + } +} \ No newline at end of file diff --git a/public/images/pokemon/variant/female/41.json b/public/images/pokemon/variant/female/41.json new file mode 100644 index 00000000000..08446ef4908 --- /dev/null +++ b/public/images/pokemon/variant/female/41.json @@ -0,0 +1,26 @@ +{ + "1": { + "101010": "101010", + "637bb5": "37326f", + "4a427b": "14093b", + "bdceff": "868ecc", + "8cb5ef": "4e538f", + "b5529c": "cc7b32", + "73215a": "aa4c18", + "d673bd": "f0ad57", + "ffffff": "ffffff", + "636363": "636363" + }, + "2": { + "101010": "101010", + "637bb5": "916c8b", + "4a427b": "4d3259", + "bdceff": "e8d2e6", + "8cb5ef": "cbabca", + "b5529c": "94241c", + "73215a": "670f10", + "d673bd": "bc3b1d", + "ffffff": "ffffff", + "636363": "636363" + } +} \ No newline at end of file diff --git a/public/images/pokemon/variant/female/42.json b/public/images/pokemon/variant/female/42.json new file mode 100644 index 00000000000..000e127793e --- /dev/null +++ b/public/images/pokemon/variant/female/42.json @@ -0,0 +1,30 @@ +{ + "1": { + "3a3a7b": "1d0f4e", + "5aadef": "3d4381", + "6384ce": "2f2a5f", + "631052": "892d03", + "ce6bb5": "f1a139", + "adceff": "666fb4", + "000000": "000000", + "ad52ad": "d5711b", + "636363": "636363", + "ffffff": "ffffff", + "d6d6d6": "d6d6d6", + "943a7b": "af4e0c" + }, + "2": { + "3a3a7b": "3d2349", + "5aadef": "cbabca", + "6384ce": "916c8b", + "631052": "54070c", + "ce6bb5": "bc3b1d", + "adceff": "e8d2e6", + "000000": "000000", + "ad52ad": "94241c", + "636363": "636363", + "ffffff": "ffffff", + "d6d6d6": "d6d6d6", + "943a7b": "6c1314" + } +} \ No newline at end of file diff --git a/public/images/ui/legacy/summary_moves_effect.png b/public/images/ui/legacy/summary_moves_effect.png index ed422d1b439..8d6ef024cf3 100644 Binary files a/public/images/ui/legacy/summary_moves_effect.png and b/public/images/ui/legacy/summary_moves_effect.png differ diff --git a/public/images/ui/legacy/summary_moves_effect_de.png b/public/images/ui/legacy/summary_moves_effect_de.png new file mode 100644 index 00000000000..8d6ef024cf3 Binary files /dev/null and b/public/images/ui/legacy/summary_moves_effect_de.png differ diff --git a/public/images/ui/legacy/summary_moves_effect_es.png b/public/images/ui/legacy/summary_moves_effect_es.png new file mode 100644 index 00000000000..a48f90cc8f6 Binary files /dev/null and b/public/images/ui/legacy/summary_moves_effect_es.png differ diff --git a/public/images/ui/legacy/summary_moves_effect_fr.png b/public/images/ui/legacy/summary_moves_effect_fr.png new file mode 100644 index 00000000000..9d65c920176 Binary files /dev/null and b/public/images/ui/legacy/summary_moves_effect_fr.png differ diff --git a/public/images/ui/legacy/summary_moves_effect_it.png b/public/images/ui/legacy/summary_moves_effect_it.png new file mode 100644 index 00000000000..8d6ef024cf3 Binary files /dev/null and b/public/images/ui/legacy/summary_moves_effect_it.png differ diff --git a/public/images/ui/legacy/summary_moves_effect_pt_BR.png b/public/images/ui/legacy/summary_moves_effect_pt_BR.png new file mode 100644 index 00000000000..f5a0c2ea736 Binary files /dev/null and b/public/images/ui/legacy/summary_moves_effect_pt_BR.png differ diff --git a/public/images/ui/legacy/summary_moves_effect_zh_CN.png b/public/images/ui/legacy/summary_moves_effect_zh_CN.png new file mode 100644 index 00000000000..8d6ef024cf3 Binary files /dev/null and b/public/images/ui/legacy/summary_moves_effect_zh_CN.png differ diff --git a/src/battle.ts b/src/battle.ts index 580bad9a508..601cbeb9cb6 100644 --- a/src/battle.ts +++ b/src/battle.ts @@ -11,6 +11,7 @@ import { BattleSpec } from "./enums/battle-spec"; import { PlayerGender } from "./system/game-data"; import { MoneyMultiplierModifier, PokemonHeldItemModifier } from "./modifier/modifier"; import { MoneyAchv } from "./system/achv"; +import { PokeballType } from "./data/pokeball"; export enum BattleType { WILD, @@ -61,6 +62,7 @@ export default class Battle { public battleSeed: string; private battleSeedState: string; public moneyScattered: number; + public lastUsedPokeball: PokeballType; private rngCounter: integer = 0; @@ -86,6 +88,7 @@ export default class Battle { this.battleSeed = Utils.randomString(16, true); this.battleSeedState = null; this.moneyScattered = 0; + this.lastUsedPokeball = null; } private initBattleSpec(): void { diff --git a/src/data/ability.ts b/src/data/ability.ts index a257525efd0..c44357cc3c6 100644 --- a/src/data/ability.ts +++ b/src/data/ability.ts @@ -9,7 +9,7 @@ import { BattlerTag } from "./battler-tags"; import { BattlerTagType } from "./enums/battler-tag-type"; import { StatusEffect, getStatusEffectDescriptor, getStatusEffectHealText } from "./status-effect"; import { Gender } from "./gender"; -import Move, { AttackMove, MoveCategory, MoveFlags, MoveTarget, RecoilAttr, StatusMoveTypeImmunityAttr, FlinchAttr, OneHitKOAttr, HitHealAttr, StrengthSapHealAttr, allMoves, StatusMove, VariablePowerAttr, applyMoveAttrs } from "./move"; +import Move, { AttackMove, MoveCategory, MoveFlags, MoveTarget, RecoilAttr, StatusMoveTypeImmunityAttr, FlinchAttr, OneHitKOAttr, HitHealAttr, StrengthSapHealAttr, allMoves, StatusMove, VariablePowerAttr, applyMoveAttrs, IncrementMovePriorityAttr } from "./move"; import { ArenaTagSide, ArenaTrapTag } from "./arena-tag"; import { ArenaTagType } from "./enums/arena-tag-type"; import { Stat } from "./pokemon-stat"; @@ -22,6 +22,7 @@ import i18next, { Localizable } from "#app/plugins/i18n.js"; import { Command } from "../ui/command-ui-handler"; import Battle from "#app/battle.js"; import { ability } from "#app/locales/en/ability.js"; +import { PokeballType, getPokeballName } from "./pokeball"; export class Ability implements Localizable { public id: Abilities; @@ -490,8 +491,13 @@ export class PostDefendFormChangeAbAttr extends PostDefendAbAttr { export class FieldPriorityMoveImmunityAbAttr extends PreDefendAbAttr { applyPreDefend(pokemon: Pokemon, passive: boolean, attacker: Pokemon, move: PokemonMove, cancelled: Utils.BooleanHolder, args: any[]): boolean { const attackPriority = new Utils.IntegerHolder(move.getMove().priority); + applyMoveAttrs(IncrementMovePriorityAttr,attacker,null,move.getMove(),attackPriority); applyAbAttrs(IncrementMovePriorityAbAttr, attacker, null, move.getMove(), attackPriority); + if(move.getMove().moveTarget===MoveTarget.USER) { + return false; + } + if(attackPriority.value > 0 && !move.getMove().isMultiTarget()) { cancelled.value = true; return true; @@ -1822,6 +1828,36 @@ export class MultCritAbAttr extends AbAttr { } } +/** + * Guarantees a critical hit according to the given condition, except if target prevents critical hits. ie. Merciless + * @extends AbAttr + * @see {@linkcode apply} + */ +export class ConditionalCritAbAttr extends AbAttr { + private condition: PokemonAttackCondition; + + constructor(condition: PokemonAttackCondition, checkUser?: Boolean) { + super(); + + this.condition = condition; + } + + /** + * @param pokemon {@linkcode Pokemon} user. + * @param args [0] {@linkcode Utils.BooleanHolder} If true critical hit is guaranteed. + * [1] {@linkcode Pokemon} Target. + * [2] {@linkcode Move} used by ability user. + */ + apply(pokemon: Pokemon, passive: boolean, cancelled: Utils.BooleanHolder, args: any[]): boolean { + const target = (args[1] as Pokemon); + const move = (args[2] as Move); + if(!this.condition(pokemon,target,move)) + return false; + + (args[0] as Utils.BooleanHolder).value = true; + return true; + } +} export class BlockNonDirectDamageAbAttr extends AbAttr { apply(pokemon: Pokemon, passive: boolean, cancelled: Utils.BooleanHolder, args: any[]): boolean { @@ -2246,6 +2282,33 @@ export class PostTurnFormChangeAbAttr extends PostTurnAbAttr { } } +/** + * Grabs the last failed Pokeball used + * @extends PostTurnAbAttr + * @see {@linkcode applyPostTurn} */ +export class FetchBallAbAttr extends PostTurnAbAttr { + constructor() { + super(); + } + /** + * Adds the last used Pokeball back into the player's inventory + * @param pokemon {@linkcode Pokemon} with this ability + * @param passive N/A + * @param args N/A + * @returns true if player has used a pokeball and this pokemon is owned by the player + */ + applyPostTurn(pokemon: Pokemon, passive: boolean, args: any[]): boolean { + let lastUsed = pokemon.scene.currentBattle.lastUsedPokeball; + if(lastUsed != null && pokemon.isPlayer) { + pokemon.scene.pokeballCounts[lastUsed]++; + pokemon.scene.currentBattle.lastUsedPokeball = null; + pokemon.scene.queueMessage(getPokemonMessage(pokemon, ` found a\n${getPokeballName(lastUsed)}!`)); + return true; + } + return false; + } +} + export class PostBiomeChangeAbAttr extends AbAttr { } export class PostBiomeChangeWeatherChangeAbAttr extends PostBiomeChangeAbAttr { @@ -2338,18 +2401,42 @@ export class RunSuccessAbAttr extends AbAttr { } } +/** + * Base class for checking if a Pokemon is trapped by arena trap + * @extends AbAttr + * @see {@linkcode applyCheckTrapped} + */ export class CheckTrappedAbAttr extends AbAttr { constructor() { super(false); } - - applyCheckTrapped(pokemon: Pokemon, passive: boolean, trapped: Utils.BooleanHolder, args: any[]): boolean | Promise { + + applyCheckTrapped(pokemon: Pokemon, passive: boolean, trapped: Utils.BooleanHolder, otherPokemon: Pokemon, args: any[]): boolean | Promise { return false; } } +/** + * Determines whether a Pokemon is blocked from switching/running away + * because of a trapping ability or move. + * @extends CheckTrappedAbAttr + * @see {@linkcode applyCheckTrapped} + */ export class ArenaTrapAbAttr extends CheckTrappedAbAttr { - applyCheckTrapped(pokemon: Pokemon, passive: boolean, trapped: Utils.BooleanHolder, args: any[]): boolean { + /** + * Checks if enemy Pokemon is trapped by an Arena Trap-esque ability + * @param pokemon The {@link Pokemon} with this {@link AbAttr} + * @param passive N/A + * @param trapped {@link Utils.BooleanHolder} indicating whether the other Pokemon is trapped or not + * @param otherPokemon The {@link Pokemon} that is affected by an Arena Trap ability + * @param args N/A + * @returns if enemy Pokemon is trapped or not + */ + applyCheckTrapped(pokemon: Pokemon, passive: boolean, trapped: Utils.BooleanHolder, otherPokemon: Pokemon, args: any[]): boolean { + if (otherPokemon.getTypes().includes(Type.GHOST)){ + trapped.value = false; + return false; + } trapped.value = true; return true; } @@ -2614,7 +2701,6 @@ export class SuppressFieldAbilitiesAbAttr extends AbAttr { } } - export class AlwaysHitAbAttr extends AbAttr { } export class UncopiableAbilityAbAttr extends AbAttr { @@ -2859,8 +2945,8 @@ export function applyPostTerrainChangeAbAttrs(attrType: { new(...args: any[]): P } export function applyCheckTrappedAbAttrs(attrType: { new(...args: any[]): CheckTrappedAbAttr }, - pokemon: Pokemon, trapped: Utils.BooleanHolder, ...args: any[]): Promise { - return applyAbAttrsInternal(attrType, pokemon, (attr, passive) => attr.applyCheckTrapped(pokemon, passive, trapped, args), args, true); + pokemon: Pokemon, trapped: Utils.BooleanHolder, otherPokemon: Pokemon, ...args: any[]): Promise { + return applyAbAttrsInternal(attrType, pokemon, (attr, passive) => attr.applyCheckTrapped(pokemon, passive, trapped, otherPokemon, args), args, true); } export function applyPostBattleAbAttrs(attrType: { new(...args: any[]): PostBattleAbAttr }, @@ -3442,7 +3528,7 @@ export function initAbilities() { new Ability(Abilities.WATER_COMPACTION, 7) .attr(PostDefendStatChangeAbAttr, (target, user, move) => move.type === Type.WATER && move.category !== MoveCategory.STATUS, BattleStat.DEF, 2), new Ability(Abilities.MERCILESS, 7) - .unimplemented(), + .attr(ConditionalCritAbAttr, (user, target, move) => target.status?.effect === StatusEffect.TOXIC || target.status?.effect === StatusEffect.POISON), new Ability(Abilities.SHIELDS_DOWN, 7) .attr(PostBattleInitFormChangeAbAttr, p => p.formIndex % 7 + (p.getHpRatio() <= 0.5 ? 7 : 0)) .attr(PostSummonFormChangeAbAttr, p => p.formIndex % 7 + (p.getHpRatio() <= 0.5 ? 7 : 0)) @@ -3597,7 +3683,8 @@ export function initAbilities() { new Ability(Abilities.LIBERO, 8) .unimplemented(), new Ability(Abilities.BALL_FETCH, 8) - .unimplemented(), + .attr(FetchBallAbAttr) + .condition(getOncePerBattleCondition(Abilities.BALL_FETCH)), new Ability(Abilities.COTTON_DOWN, 8) .attr(PostDefendStatChangeAbAttr, (target, user, move) => move.category !== MoveCategory.STATUS, BattleStat.SPD, -1, false, true) .bypassFaint(), diff --git a/src/data/battler-tags.ts b/src/data/battler-tags.ts index 4c3f09cab30..849128517d2 100644 --- a/src/data/battler-tags.ts +++ b/src/data/battler-tags.ts @@ -235,7 +235,7 @@ export class ConfusedTag extends BattlerTag { pokemon.scene.queueMessage(getPokemonMessage(pokemon, ' is\nconfused!')); pokemon.scene.unshiftPhase(new CommonAnimPhase(pokemon.scene, pokemon.getBattlerIndex(), undefined, CommonAnim.CONFUSION)); - if (pokemon.randSeedInt(2)) { + if (pokemon.randSeedInt(3)) { const atk = pokemon.getBattleStat(Stat.ATK); const def = pokemon.getBattleStat(Stat.DEF); const damage = Math.ceil(((((2 * pokemon.level / 5 + 2) * 40 * atk / def) / 50) + 2) * (pokemon.randSeedInt(15, 85) / 100)); diff --git a/src/data/berry.ts b/src/data/berry.ts index 1521f3488ef..e13d4532b3e 100644 --- a/src/data/berry.ts +++ b/src/data/berry.ts @@ -130,9 +130,11 @@ export function getBerryEffectFunc(berryType: BerryType): BerryEffectFunc { return (pokemon: Pokemon) => { if (pokemon.battleData) pokemon.battleData.berriesEaten.push(berryType); - const ppRestoreMove = pokemon.getMoveset().find(m => !m.getPpRatio()); - ppRestoreMove.ppUsed = Math.max(ppRestoreMove.ppUsed - 10, 0); - pokemon.scene.queueMessage(getPokemonMessage(pokemon, ` restored PP to its move ${ppRestoreMove.getName()}\nusing its ${getBerryName(berryType)}!`)); + const ppRestoreMove = pokemon.getMoveset().find(m => !m.getPpRatio()) ? pokemon.getMoveset().find(m => !m.getPpRatio()) : pokemon.getMoveset().find(m => m.getPpRatio() < 1); + if(ppRestoreMove !== undefined){ + ppRestoreMove.ppUsed = Math.max(ppRestoreMove.ppUsed - 10, 0); + pokemon.scene.queueMessage(getPokemonMessage(pokemon, ` restored PP to its move ${ppRestoreMove.getName()}\nusing its ${getBerryName(berryType)}!`)); + } }; } } \ No newline at end of file diff --git a/src/data/move.ts b/src/data/move.ts index 6849a0fe7ce..2d27afcbe47 100644 --- a/src/data/move.ts +++ b/src/data/move.ts @@ -1,6 +1,6 @@ import { Moves } from "./enums/moves"; import { ChargeAnim, MoveChargeAnim, initMoveAnim, loadMoveAnimAssets } from "./battle-anims"; -import { BattleEndPhase, MoveEffectPhase, MovePhase, NewBattlePhase, PartyStatusCurePhase, PokemonHealPhase, StatChangePhase, SwitchSummonPhase } from "../phases"; +import { BattleEndPhase, MoveEffectPhase, MovePhase, NewBattlePhase, PartyStatusCurePhase, PokemonHealPhase, StatChangePhase, SwitchSummonPhase, ToggleDoublePositionPhase } from "../phases"; import { BattleStat, getBattleStatName } from "./battle-stat"; import { EncoreTag } from "./battler-tags"; import { BattlerTagType } from "./enums/battler-tag-type"; @@ -12,10 +12,10 @@ import * as Utils from "../utils"; import { WeatherType } from "./weather"; import { ArenaTagSide, ArenaTrapTag } from "./arena-tag"; import { ArenaTagType } from "./enums/arena-tag-type"; -import { UnswappableAbilityAbAttr, UncopiableAbilityAbAttr, UnsuppressableAbilityAbAttr, NoTransformAbilityAbAttr, BlockRecoilDamageAttr, BlockOneHitKOAbAttr, IgnoreContactAbAttr, MaxMultiHitAbAttr, applyAbAttrs, BlockNonDirectDamageAbAttr, applyPreSwitchOutAbAttrs, PreSwitchOutAbAttr, applyPostDefendAbAttrs, PostDefendContactApplyStatusEffectAbAttr, MoveAbilityBypassAbAttr, ReverseDrainAbAttr, FieldPreventExplosiveMovesAbAttr, ForceSwitchOutImmunityAbAttr } from "./ability"; +import { UnswappableAbilityAbAttr, UncopiableAbilityAbAttr, UnsuppressableAbilityAbAttr, NoTransformAbilityAbAttr, BlockRecoilDamageAttr, BlockOneHitKOAbAttr, IgnoreContactAbAttr, MaxMultiHitAbAttr, applyAbAttrs, BlockNonDirectDamageAbAttr, applyPreSwitchOutAbAttrs, PreSwitchOutAbAttr, applyPostDefendAbAttrs, PostDefendContactApplyStatusEffectAbAttr, MoveAbilityBypassAbAttr, ReverseDrainAbAttr, FieldPreventExplosiveMovesAbAttr, ForceSwitchOutImmunityAbAttr, PreventBerryUseAbAttr, BlockItemTheftAbAttr } from "./ability"; import { Abilities } from "./enums/abilities"; import { allAbilities } from './ability'; -import { PokemonHeldItemModifier } from "../modifier/modifier"; +import { PokemonHeldItemModifier, BerryModifier, PreserveBerryModifier } from "../modifier/modifier"; import { BattlerIndex } from "../battle"; import { Stat } from "./pokemon-stat"; import { TerrainType } from "./terrain"; @@ -25,6 +25,7 @@ import { ModifierPoolType } from "#app/modifier/modifier-type"; import { Command } from "../ui/command-ui-handler"; import { Biome } from "./enums/biome"; import i18next, { Localizable } from '../plugins/i18n'; +import { BerryType, BerryEffectFunc, getBerryEffectFunc } from './berry'; export enum MoveCategory { PHYSICAL, @@ -58,7 +59,8 @@ export enum MoveTarget { /** {@link https://bulbapedia.bulbagarden.net/wiki/Category:Entry_hazard-creating_moves Entry hazard-creating moves} */ ENEMY_SIDE, BOTH_SIDES, - PARTY + PARTY, + CURSE } export enum MoveFlags { @@ -780,8 +782,8 @@ export class RecoilAttr extends MoveEffectAttr { if (cancelled.value) return false; - const recoilDamage = Math.max(Math.floor((!this.useHp ? user.turnData.damageDealt : user.getMaxHp()) * this.damageRatio), - user.turnData.damageDealt ? 1 : 0); + const recoilDamage = Math.max(Math.floor((!this.useHp ? user.turnData.currDamageDealt : user.getMaxHp()) * this.damageRatio), + user.turnData.currDamageDealt ? 1 : 0); if (!recoilDamage) return false; @@ -916,6 +918,7 @@ export enum MultiHitType { _3, _3_INCR, _1_TO_10, + BEAT_UP, } /** @@ -1166,6 +1169,42 @@ export class StrengthSapHealAttr extends MoveEffectAttr { return true; } } +/** + * Attribute used for moves that change priority in a turn given a condition, + * e.g. Grassy Glide + * Called when move order is calculated in {@linkcode TurnStartPhase}. + * @extends MoveAttr + * @see {@linkcode apply} + */ +export class IncrementMovePriorityAttr extends MoveAttr { + /** The condition for a move's priority being incremented */ + private moveIncrementFunc: (pokemon: Pokemon, target:Pokemon, move: Move) => boolean; + /** The amount to increment priority by, if condition passes. */ + private increaseAmount: integer; + + constructor(moveIncrementFunc: (pokemon: Pokemon, target:Pokemon, move: Move) => boolean, increaseAmount = 1) { + super(); + + this.moveIncrementFunc = moveIncrementFunc; + this.increaseAmount = increaseAmount; + } + + /** + * Increments move priority by set amount if condition passes + * @param user {@linkcode Pokemon} using this move + * @param target {@linkcode Pokemon} target of this move + * @param move {@linkcode Move} being used + * @param args [0] {@linkcode Utils.IntegerHolder} for move priority. + * @returns true if function succeeds + */ + apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean { + if (!this.moveIncrementFunc(user, target, move)) + return false; + + (args[0] as Utils.IntegerHolder).value += this.increaseAmount; + return true; + } +} export class MultiHitAttr extends MoveAttr { private multiHitType: MultiHitType; @@ -1233,6 +1272,11 @@ export class MultiHitAttr extends MoveAttr { hitTimes = 10; } break; + case MultiHitType.BEAT_UP: + // No status means the ally pokemon can contribute to Beat Up + hitTimes = user.scene.getParty().reduce((total, pokemon) => { + return total + (pokemon.id === user.id ? 1 : pokemon?.status && pokemon.status.effect !== StatusEffect.NONE ? 0 : 1) + }, 0); } (args[0] as Utils.IntegerHolder).value = hitTimes; return true; @@ -1436,6 +1480,95 @@ export class RemoveHeldItemAttr extends MoveEffectAttr { } } +/** + * Attribute that causes targets of the move to eat a berry. If chosenBerry is not overriden, a random berry will be picked from the target's inventory. + */ +export class EatBerryAttr extends MoveEffectAttr { + protected chosenBerry: BerryModifier; + constructor() { + super(true, MoveEffectTrigger.HIT); + this.chosenBerry = undefined; + } +/** + * Causes the target to eat a berry. + * @param user {@linkcode Pokemon} Pokemon that used the move + * @param target {@linkcode Pokemon} Pokemon that will eat a berry + * @param move {@linkcode Move} The move being used + * @param args Unused + * @returns {boolean} true if the function succeeds + */ + apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean { + if (!super.apply(user, target, move, args)) + return false; + + if(this.chosenBerry === undefined) { // if no berry has been provided, pick a random berry from their inventory + const heldBerries = this.getTargetHeldBerries(target); + if(heldBerries.length <= 0) + return false; + this.chosenBerry = heldBerries[user.randSeedInt(heldBerries.length)]; + } + + getBerryEffectFunc(this.chosenBerry.berryType)(target); // target eats the berry + + const preserve = new Utils.BooleanHolder(false); + target.scene.applyModifiers(PreserveBerryModifier, target.isPlayer(), target, preserve); + + if (!preserve.value){ // remove the eaten berry if not preserved + if (!--this.chosenBerry.stackCount) + target.scene.removeModifier(this.chosenBerry, !target.isPlayer()); + target.scene.updateModifiers(target.isPlayer()); +} + this.chosenBerry = undefined; + + return true; + } + + getTargetHeldBerries(target: Pokemon): BerryModifier[] { + return target.scene.findModifiers(m => m instanceof BerryModifier + && (m as BerryModifier).pokemonId === target.id, target.isPlayer()) as BerryModifier[]; + } + +} +/** + * Attribute used for moves that steal a random berry from the target. The user then eats the stolen berry. + * Used for Pluck & Bug Bite. + */ +export class StealEatBerryAttr extends EatBerryAttr { + constructor() { + super(); + } +/** + * User steals a random berry from the target and then eats it. + * @param {Pokemon} user Pokemon that used the move and will eat the stolen berry + * @param {Pokemon} target Pokemon that will have its berry stolen + * @param {Move} move Move being used + * @param {any[]} args Unused + * @returns {boolean} true if the function succeeds + */ + apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean { + + const cancelled = new Utils.BooleanHolder(false); + applyAbAttrs(BlockItemTheftAbAttr, target, cancelled); // check for abilities that block item theft + if(cancelled.value == true) + return false; + + const heldBerries = this.getTargetHeldBerries(target).filter(i => i.getTransferrable(false)); + + if (heldBerries.length) { // if the target has berries, pick a random berry and steal it + this.chosenBerry = heldBerries[user.randSeedInt(heldBerries.length)]; + + if (this.chosenBerry.stackCount == 1) // remove modifier if its the last berry + target.scene.removeModifier(this.chosenBerry, !target.isPlayer()); + target.scene.updateModifiers(target.isPlayer()); + + user.scene.queueMessage(getPokemonMessage(user, ` stole and ate\n${target.name}'s ${this.chosenBerry.type.name}!`)); + return super.apply(user, user, move, args); + } + + return false; + } +} + export class HealStatusEffectAttr extends MoveEffectAttr { private effects: StatusEffect[]; @@ -2034,6 +2167,46 @@ export class VariablePowerAttr extends MoveAttr { } } +export class LessPPMorePowerAttr extends VariablePowerAttr { + /** + * Power up moves when less PP user has + * @param user {@linkcode Pokemon} using this move + * @param target {@linkcode Pokemon} target of this move + * @param move {@linkcode Move} being used + * @param args [0] {@linkcode Utils.NumberHolder} of power + * @returns true if the function succeeds + */ + apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean { + const ppMax = move.pp; + let ppUsed = user.moveset.find((m) => m.moveId === move.id).ppUsed; + + let ppRemains = ppMax - ppUsed; + /** Reduce to 0 to avoid negative numbers if user has 1PP before attack and target has Ability.PRESSURE */ + if(ppRemains < 0) ppRemains = 0; + + const power = args[0] as Utils.NumberHolder; + + switch (ppRemains) { + case 0: + power.value = 200; + break; + case 1: + power.value = 80; + break; + case 2: + power.value = 60; + break; + case 3: + power.value = 50; + break; + default: + power.value = 40; + break; + } + return true; + } +} + export class MovePowerMultiplierAttr extends VariablePowerAttr { private powerMultiplierFunc: (user: Pokemon, target: Pokemon, move: Move) => number; @@ -2051,6 +2224,45 @@ export class MovePowerMultiplierAttr extends VariablePowerAttr { } } +/** + * Helper function to calculate the the base power of an ally's hit when using Beat Up. + * @param user The Pokemon that used Beat Up. + * @param allyIndex The party position of the ally contributing to Beat Up. + * @returns The base power of the Beat Up hit. + */ +const beatUpFunc = (user: Pokemon, allyIndex: number): number => { + const party = user.scene.getParty(); + + for (let i = allyIndex; i < party.length; i++) { + const pokemon = party[i]; + + // The user contributes to Beat Up regardless of status condition. + // Allies can contribute only if they do not have a non-volatile status condition. + if (pokemon.id !== user.id && pokemon?.status && pokemon.status.effect !== StatusEffect.NONE) { + continue; + } + return (pokemon.species.getBaseStat(Stat.ATK) / 10) + 5; + } +} + +export class BeatUpAttr extends VariablePowerAttr { + + /** + * Gets the next party member to contribute to a Beat Up hit, and calculates the base power for it. + * @param user Pokemon that used the move + * @param _target N/A + * @param _move Move with this attribute + * @param args N/A + * @returns true if the function succeeds + */ + apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean { + const power = args[0] as Utils.NumberHolder; + const allyIndex = user.turnData.hitCount - user.turnData.hitsLeft; + power.value = beatUpFunc(user, allyIndex); + return true; + } +} + const doublePowerChanceMessageFunc = (user: Pokemon, target: Pokemon, move: Move) => { let message: string = null; user.scene.executeWithSeedOffset(() => { @@ -2778,6 +2990,47 @@ export class WeatherBallTypeAttr extends VariableMoveTypeAttr { } } +/** + * Changes the move's type to match the current terrain. + * Has no effect if the user is not grounded. + * @extends VariableMoveTypeAttr + * @see {@linkcode apply} + */ +export class TerrainPulseTypeAttr extends VariableMoveTypeAttr { + /** + * @param user {@linkcode Pokemon} using this move + * @param target N/A + * @param move N/A + * @param args [0] {@linkcode Utils.IntegerHolder} The move's type to be modified + * @returns true if the function succeeds + */ + apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean { + if(!user.isGrounded) + return false; + + const currentTerrain = user.scene.arena.getTerrainType(); + const type = (args[0] as Utils.IntegerHolder); + + switch (currentTerrain) { + case TerrainType.MISTY: + type.value = Type.FAIRY; + break; + case TerrainType.ELECTRIC: + type.value = Type.ELECTRIC; + break; + case TerrainType.GRASSY: + type.value = Type.GRASS; + break; + case TerrainType.PSYCHIC: + type.value = Type.PSYCHIC; + break; + default: + return false; + } + return true; + } +} + export class HiddenPowerTypeAttr extends VariableMoveTypeAttr { apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean { const type = (args[0] as Utils.IntegerHolder); @@ -3441,6 +3694,67 @@ export class RemoveScreensAttr extends MoveEffectAttr { } } +/** + * Attribute used for Revival Blessing. + * @extends MoveEffectAttr + * @see {@linkcode apply} + */ +export class RevivalBlessingAttr extends MoveEffectAttr { + constructor(user?: boolean) { + super(true); + } + + /** + * + * @param user {@linkcode Pokemon} using this move + * @param target {@linkcode Pokemon} target of this move + * @param move {@linkcode Move} being used + * @param args N/A + * @returns Promise, true if function succeeds. + */ + apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): Promise { + return new Promise(resolve => { + // If user is player, checks if the user has fainted pokemon + if(user instanceof PlayerPokemon + && user.scene.getParty().findIndex(p => p.isFainted())>-1) { + (user as PlayerPokemon).revivalBlessing().then(() => { + resolve(true) + }); + // If user is enemy, checks that it is a trainer, and it has fainted non-boss pokemon in party + } else if(user instanceof EnemyPokemon + && user.hasTrainer() + && user.scene.getEnemyParty().findIndex(p => p.isFainted() && !p.isBoss()) > -1) { + // Selects a random fainted pokemon + const faintedPokemon = user.scene.getEnemyParty().filter(p => p.isFainted() && !p.isBoss()); + const pokemon = faintedPokemon[user.randSeedInt(faintedPokemon.length)]; + const slotIndex = user.scene.getEnemyParty().findIndex(p => pokemon.id === p.id); + pokemon.resetStatus(); + pokemon.heal(Math.min(Math.max(Math.ceil(Math.floor(0.5 * pokemon.getMaxHp())), 1), pokemon.getMaxHp())); + user.scene.queueMessage(`${pokemon.name} was revived!`,0,true); + + if(user.scene.currentBattle.double && user.scene.getEnemyParty().length > 1) { + const allyPokemon = user.getAlly(); + if(slotIndex<=1) { + user.scene.unshiftPhase(new SwitchSummonPhase(user.scene, pokemon.getFieldIndex(), slotIndex, false, false, false)); + } else if(allyPokemon.isFainted()){ + user.scene.unshiftPhase(new SwitchSummonPhase(user.scene, allyPokemon.getFieldIndex(), slotIndex, false, false,false)); + } + } + resolve(true); + } else { + user.scene.queueMessage(`But it failed!`); + resolve(false); + } + }) + } + + getUserBenefitScore(user: Pokemon, target: Pokemon, move: Move): integer { + if(user.hasTrainer() && user.scene.getEnemyParty().findIndex(p => p.isFainted() && !p.isBoss()) > -1) + return 20; + + return -20; + } +} export class ForceSwitchOutAttr extends MoveEffectAttr { private user: boolean; @@ -4375,7 +4689,7 @@ export function getMoveTargets(user: Pokemon, move: Moves): MoveTargetSet { switch (moveTarget) { case MoveTarget.USER: case MoveTarget.PARTY: - set = [ user]; + set = [ user ]; break; case MoveTarget.NEAR_OTHER: case MoveTarget.OTHER: @@ -4411,6 +4725,9 @@ export function getMoveTargets(user: Pokemon, move: Moves): MoveTargetSet { set = [ user, user.getAlly() ].concat(opponents); multiple = true; break; + case MoveTarget.CURSE: + set = user.getTypes(true).includes(Type.GHOST) ? (opponents.concat([ user.getAlly() ])) : [ user ]; + break; } return { targets: set.filter(p => p?.isActive(true)).map(p => p.getBattlerIndex()).filter(t => t !== undefined), multiple }; @@ -4897,7 +5214,8 @@ export function initMoves() { .soundBased(), new StatusMove(Moves.CURSE, Type.GHOST, -1, 10, -1, 0, 2) .attr(CurseAttr) - .ignoresProtect(true), + .ignoresProtect(true) + .target(MoveTarget.CURSE), new AttackMove(Moves.FLAIL, Type.NORMAL, MoveCategory.PHYSICAL, -1, 100, 15, -1, 0, 2) .attr(LowHpPowerAttr), new StatusMove(Moves.CONVERSION_2, Type.NORMAL, -1, 30, -1, 0, 2) @@ -5115,8 +5433,9 @@ export function initMoves() { .attr(TrapAttr, BattlerTagType.WHIRLPOOL) .attr(HitsTagAttr, BattlerTagType.UNDERWATER, true), new AttackMove(Moves.BEAT_UP, Type.DARK, MoveCategory.PHYSICAL, -1, 100, 10, -1, 0, 2) - .makesContact(false) - .unimplemented(), + .attr(MultiHitAttr, MultiHitType.BEAT_UP) + .attr(BeatUpAttr) + .makesContact(false), new AttackMove(Moves.FAKE_OUT, Type.NORMAL, MoveCategory.PHYSICAL, 40, 100, 10, 100, 3, 3) .attr(FlinchAttr) .condition(new FirstMoveCondition()), @@ -5424,7 +5743,7 @@ export function initMoves() { .makesContact(false) .ignoresProtect(), new AttackMove(Moves.PLUCK, Type.FLYING, MoveCategory.PHYSICAL, 60, 100, 20, -1, 0, 4) - .partial(), + .attr(StealEatBerryAttr), new StatusMove(Moves.TAILWIND, Type.FLYING, -1, 15, -1, 0, 4) .windMove() .attr(AddArenaTagAttr, ArenaTagType.TAILWIND, 4, true) @@ -5460,7 +5779,7 @@ export function initMoves() { ), new AttackMove(Moves.TRUMP_CARD, Type.NORMAL, MoveCategory.SPECIAL, -1, -1, 5, -1, 0, 4) .makesContact() - .unimplemented(), + .attr(LessPPMorePowerAttr), new StatusMove(Moves.HEAL_BLOCK, Type.PSYCHIC, 100, 15, -1, 0, 4) .target(MoveTarget.ALL_NEAR_ENEMIES) .unimplemented(), @@ -5661,7 +5980,7 @@ export function initMoves() { new AttackMove(Moves.JUDGMENT, Type.NORMAL, MoveCategory.SPECIAL, 100, 100, 10, -1, 0, 4) .partial(), new AttackMove(Moves.BUG_BITE, Type.BUG, MoveCategory.PHYSICAL, 60, 100, 20, -1, 0, 4) - .partial(), + .attr(StealEatBerryAttr), new AttackMove(Moves.CHARGE_BEAM, Type.ELECTRIC, MoveCategory.SPECIAL, 50, 90, 10, 70, 0, 4) .attr(StatChangeAttr, BattleStat.SPATK, 1, true), new AttackMove(Moves.WOOD_HAMMER, Type.GRASS, MoveCategory.PHYSICAL, 120, 100, 15, -1, 0, 4) @@ -6523,8 +6842,8 @@ export function initMoves() { .makesContact(false) .partial(), new StatusMove(Moves.TEATIME, Type.NORMAL, -1, 10, -1, 0, 8) - .target(MoveTarget.ALL) - .unimplemented(), + .attr(EatBerryAttr) + .target(MoveTarget.ALL), new StatusMove(Moves.OCTOLOCK, Type.FIGHTING, 100, 15, -1, 0, 8) .attr(AddBattlerTagAttr, BattlerTagType.TRAPPED, false, true, 1) .partial(), @@ -6691,14 +7010,16 @@ export function initMoves() { .attr(SacrificialAttr) .target(MoveTarget.ALL_NEAR_OTHERS) .attr(MovePowerMultiplierAttr, (user, target, move) => user.scene.arena.getTerrainType() === TerrainType.MISTY && user.isGrounded() ? 1.5 : 1) - .condition(failIfDampCondition), + .condition(failIfDampCondition) + .makesContact(false), new AttackMove(Moves.GRASSY_GLIDE, Type.GRASS, MoveCategory.PHYSICAL, 55, 100, 20, -1, 0, 8) - .partial(), + .attr(IncrementMovePriorityAttr,(user,target,move) =>user.scene.arena.getTerrainType()===TerrainType.GRASSY&&user.isGrounded()), new AttackMove(Moves.RISING_VOLTAGE, Type.ELECTRIC, MoveCategory.SPECIAL, 70, 100, 20, -1, 0, 8) .attr(MovePowerMultiplierAttr, (user, target, move) => user.scene.arena.getTerrainType() === TerrainType.ELECTRIC && target.isGrounded() ? 2 : 1), new AttackMove(Moves.TERRAIN_PULSE, Type.NORMAL, MoveCategory.SPECIAL, 50, 100, 10, -1, 0, 8) - .pulseMove() - .partial(), + .attr(TerrainPulseTypeAttr) + .attr(MovePowerMultiplierAttr, (user, target, move) => user.scene.arena.getTerrainType() !== TerrainType.NONE && user.isGrounded() ? 2 : 1) + .pulseMove(), new AttackMove(Moves.SKITTER_SMACK, Type.BUG, MoveCategory.PHYSICAL, 70, 90, 10, 100, 0, 8) .attr(StatChangeAttr, BattleStat.SPATK, -1), new AttackMove(Moves.BURNING_JEALOUSY, Type.FIRE, MoveCategory.SPECIAL, 70, 100, 5, 100, 0, 8) @@ -6975,7 +7296,8 @@ export function initMoves() { .partial(), new StatusMove(Moves.REVIVAL_BLESSING, Type.NORMAL, -1, 1, -1, 0, 9) .triageMove() - .unimplemented(), + .attr(RevivalBlessingAttr) + .target(MoveTarget.USER), new AttackMove(Moves.SALT_CURE, Type.ROCK, MoveCategory.PHYSICAL, 40, 100, 15, -1, 0, 9) .attr(AddBattlerTagAttr, BattlerTagType.SALT_CURED) .makesContact(false), @@ -7158,7 +7480,10 @@ export function initMoves() { new AttackMove(Moves.PSYCHIC_NOISE, Type.PSYCHIC, MoveCategory.SPECIAL, 75, 100, 10, -1, 0, 9) .soundBased() .partial(), - new AttackMove(Moves.UPPER_HAND, Type.FIGHTING, MoveCategory.PHYSICAL, 65, 100, 15, -1, 3, 9) + new AttackMove(Moves.UPPER_HAND, Type.FIGHTING, MoveCategory.PHYSICAL, 65, 100, 15, 100, 3, 9) + .attr(FlinchAttr) + .condition((user, target, move) => user.scene.currentBattle.turnCommands[target.getBattlerIndex()].command === Command.FIGHT && !target.turnData.acted && allMoves[user.scene.currentBattle.turnCommands[target.getBattlerIndex()].move.move].category !== MoveCategory.STATUS && allMoves[user.scene.currentBattle.turnCommands[target.getBattlerIndex()].move.move].priority > 0 ) + //TODO: Should also apply when target move priority increased by ability ex. gale wings .partial(), new AttackMove(Moves.MALIGNANT_CHAIN, Type.POISON, MoveCategory.SPECIAL, 100, 100, 5, 50, 0, 9) .attr(StatusEffectAttr, StatusEffect.TOXIC) diff --git a/src/data/pokemon-species.ts b/src/data/pokemon-species.ts index 218423d3232..5032bd0dfbc 100644 --- a/src/data/pokemon-species.ts +++ b/src/data/pokemon-species.ts @@ -16,6 +16,7 @@ import { GameMode } from '../game-mode'; import { QuantizerCelebi, argbFromRgba, rgbaFromArgb } from "@material/material-color-utilities"; import { VariantSet } from './variant'; import i18next, { Localizable } from '../plugins/i18n'; +import { Stat } from "./pokemon-stat"; export enum Region { NORMAL, @@ -192,6 +193,15 @@ export abstract class PokemonSpeciesForm { return false; } + /** + * Gets the species' base stat amount for the given stat. + * @param stat The desired stat. + * @returns The species' base stat amount. + */ + getBaseStat(stat: Stat): integer { + return this.baseStats[stat] + } + getBaseExp(): integer { let ret = this.baseExp; switch (this.getFormSpriteKey()) { diff --git a/src/data/tms.ts b/src/data/tms.ts index eeccd9310a3..0b2c2c93bc8 100644 --- a/src/data/tms.ts +++ b/src/data/tms.ts @@ -20889,7 +20889,6 @@ export const tmSpecies: TmSpecies = { Species.BAGON, Species.SHELGON, Species.SALAMENCE, - Species.METANG, Species.METAGROSS, Species.REGIROCK, Species.REGICE, @@ -32522,6 +32521,8 @@ export const tmSpecies: TmSpecies = { Species.DUSCLOPS, Species.CHIMECHO, Species.ABSOL, + Species.METANG, + Species.METAGROSS, Species.LATIAS, Species.LATIOS, Species.JIRACHI, @@ -35468,6 +35469,8 @@ export const tmSpecies: TmSpecies = { Species.ZANGOOSE, Species.KECLEON, Species.DUSCLOPS, + Species.METANG, + Species.METAGROSS, Species.REGIROCK, Species.REGICE, Species.REGISTEEL, @@ -37725,6 +37728,7 @@ export const tmSpecies: TmSpecies = { Species.BANETTE, Species.CHIMECHO, Species.ABSOL, + Species.METAGROSS, [ Species.DEOXYS, '', @@ -43758,6 +43762,7 @@ export const tmSpecies: TmSpecies = { Species.TAUROS, Species.MEW, Species.SNUBBULL, + Species.GRANBULL, Species.SCIZOR, Species.HERACROSS, Species.TEDDIURSA, @@ -43781,11 +43786,14 @@ export const tmSpecies: TmSpecies = { Species.LUCARIO, Species.TOXICROAK, Species.GALLADE, + Species.PIGNITE, + Species.EMBOAR, Species.TIMBURR, Species.GURDURR, Species.CONKELDURR, Species.SAWK, Species.KROOKODILE, + Species.SCRAGGY, Species.SCRAFTY, Species.ESCAVALIER, Species.EELEKTROSS, @@ -47702,6 +47710,7 @@ export const tmSpecies: TmSpecies = { Species.GOREBYSS, Species.RELICANTH, Species.SALAMENCE, + Species.METANG, Species.METAGROSS, Species.REGIROCK, Species.REGICE, @@ -48471,6 +48480,7 @@ export const tmSpecies: TmSpecies = { Species.BAGON, Species.SHELGON, Species.SALAMENCE, + Species.METAGROSS, Species.REGISTEEL, Species.LATIAS, Species.LATIOS, @@ -50632,6 +50642,7 @@ export const tmSpecies: TmSpecies = { Species.ABSOL, Species.RELICANTH, Species.SALAMENCE, + Species.METAGROSS, Species.REGIROCK, Species.GROUDON, Species.RAYQUAZA, @@ -52586,6 +52597,8 @@ export const tmSpecies: TmSpecies = { Species.CAMERUPT, Species.TORKOAL, Species.WALREIN, + Species.METANG, + Species.METAGROSS, Species.REGIROCK, Species.REGICE, Species.REGISTEEL, @@ -62371,6 +62384,7 @@ export const tmSpecies: TmSpecies = { Species.BAGON, Species.SHELGON, Species.SALAMENCE, + Species.BELDUM, Species.METANG, Species.METAGROSS, Species.REGIROCK, @@ -63367,6 +63381,8 @@ export const tmSpecies: TmSpecies = { Species.TROPIUS, Species.SNORUNT, Species.GLALIE, + Species.METANG, + Species.METAGROSS, Species.TURTWIG, Species.GROTLE, Species.TORTERRA, diff --git a/src/data/trainer-config.ts b/src/data/trainer-config.ts index 84fb4ffc15c..0abd153ff25 100644 --- a/src/data/trainer-config.ts +++ b/src/data/trainer-config.ts @@ -235,11 +235,10 @@ export class TrainerConfig { if (!getIsInitialized()) { initI18n(); } + // This is only the male name, because the female name is handled in a different function (setHasGenders) if (name === 'Finn') { name = i18next.t('trainerNames:rival'); } - - } this.name = name; return this; @@ -254,6 +253,7 @@ export class TrainerConfig { // Make the title lowercase and replace spaces with underscores title = title.toLowerCase().replace(/\s/g, '_'); + // Get the title from the i18n file this.title = i18next.t(`titles:${title}`); @@ -281,21 +281,40 @@ export class TrainerConfig { return trainerType; } + /** + * Sets the configuration for trainers with genders, including the female name and encounter background music (BGM). + * @param {string} [nameFemale] - The name of the female trainer. If 'Ivy', a localized name will be assigned. + * @param {TrainerType | string} [femaleEncounterBgm] - The encounter BGM for the female trainer, which can be a TrainerType or a string. + * @returns {TrainerConfig} - The updated TrainerConfig instance. + **/ setHasGenders(nameFemale?: string, femaleEncounterBgm?: TrainerType | string): TrainerConfig { + // If the female name is 'Ivy' (the rival), assign a localized name. if (nameFemale === 'Ivy') { - // Give the rival a localized name - // First check if i18n is initialized + // Check if the internationalization (i18n) system is initialized. if (!getIsInitialized()) { + // Initialize the i18n system if it is not already initialized. initI18n(); } - this.nameFemale = i18next.t('trainerNames:rival_female'); - } else { + // Set the localized name for the female rival. + this.nameFemale = i18next.t('trainerNames:rival_female'); + } else { + // Otherwise, assign the provided female name. this.nameFemale = nameFemale; } + // Indicate that this trainer configuration includes genders. this.hasGenders = true; - if (femaleEncounterBgm) - this.femaleEncounterBgm = typeof femaleEncounterBgm === 'number' ? TrainerType[femaleEncounterBgm].toString().replace(/\_/g, ' ').toLowerCase() : femaleEncounterBgm; + + // If a female encounter BGM is provided. + if (femaleEncounterBgm) { + // If the BGM is a TrainerType (number), convert it to a string, replace underscores with spaces, and convert to lowercase. + // Otherwise, assign the provided string as the BGM. + this.femaleEncounterBgm = typeof femaleEncounterBgm === 'number' + ? TrainerType[femaleEncounterBgm].toString().replace(/_/g, ' ').toLowerCase() + : femaleEncounterBgm; + } + + // Return the updated TrainerConfig instance. return this; } @@ -398,29 +417,44 @@ export class TrainerConfig { return this; } + /** + * Initializes the trainer configuration for a Gym Leader. + * @param {Species | Species[]} signatureSpecies - The signature species for the Gym Leader. + * @param {Type[]} specialtyTypes - The specialty types for the Gym Leader. + * @returns {TrainerConfig} - The updated TrainerConfig instance. + * **/ initForGymLeader(signatureSpecies: (Species | Species[])[], ...specialtyTypes: Type[]): TrainerConfig { + // Check if the internationalization (i18n) system is initialized. if (!getIsInitialized()) { initI18n(); } + // Set the function to generate the Gym Leader's party template. this.setPartyTemplateFunc(getGymLeaderPartyTemplate); + + // Set up party members with their corresponding species. signatureSpecies.forEach((speciesPool, s) => { + // Ensure speciesPool is an array. if (!Array.isArray(speciesPool)) speciesPool = [speciesPool]; + // Set a function to get a random party member from the species pool. this.setPartyMemberFunc(-(s + 1), getRandomPartyMemberFunc(speciesPool)); }); + + // If specialty types are provided, set species filter and specialty types. if (specialtyTypes.length) { this.setSpeciesFilter(p => specialtyTypes.find(t => p.isOfType(t)) !== undefined); this.setSpecialtyTypes(...specialtyTypes); } - // Handle name by checking this.name - making it lowercase and replacing spaces with underscores and then calling i18next.t with the name + // Localize the trainer's name by converting it to lowercase and replacing spaces with underscores. const nameForCall = this.name.toLowerCase().replace(/\s/g, '_'); this.name = i18next.t(`trainerNames:${nameForCall}`); + // Set the title to "gym_leader". (this is the key in the i18n file) + this.setTitle('gym_leader'); - - this.setTitle("gym_leader"); + // Configure various properties for the Gym Leader. this.setMoneyMultiplier(2.5); this.setBoss(); this.setStaticParty(); @@ -430,82 +464,132 @@ export class TrainerConfig { const waveIndex = party[0].scene.currentBattle.waveIndex; return getRandomTeraModifiers(party, waveIndex >= 100 ? 1 : 0, specialtyTypes.length ? specialtyTypes : null); }); + return this; } + /** + * Initializes the trainer configuration for an Elite Four member. + * @param {Species | Species[]} signatureSpecies - The signature species for the Elite Four member. + * @param {Type[]} specialtyTypes - The specialty types for the Elite Four member. + * @returns {TrainerConfig} - The updated TrainerConfig instance. + **/ initForEliteFour(signatureSpecies: (Species | Species[])[], ...specialtyTypes: Type[]): TrainerConfig { + // Check if the internationalization (i18n) system is initialized. if (!getIsInitialized()) { initI18n(); } + // Set the party templates for the Elite Four. this.setPartyTemplates(trainerPartyTemplates.ELITE_FOUR); + + // Set up party members with their corresponding species. signatureSpecies.forEach((speciesPool, s) => { + // Ensure speciesPool is an array. if (!Array.isArray(speciesPool)) speciesPool = [speciesPool]; + // Set a function to get a random party member from the species pool. this.setPartyMemberFunc(-(s + 1), getRandomPartyMemberFunc(speciesPool)); }); + + // Set species filter and specialty types if provided, otherwise filter by base total. if (specialtyTypes.length) { this.setSpeciesFilter(p => specialtyTypes.find(t => p.isOfType(t)) && p.baseTotal >= 450); this.setSpecialtyTypes(...specialtyTypes); - } else + } else { this.setSpeciesFilter(p => p.baseTotal >= 450); - // Handle name by checking this.name - making it lowercase and replacing spaces with underscores and then calling i18next.t with the name + } + + // Localize the trainer's name by converting it to lowercase and replacing spaces with underscores. const nameForCall = this.name.toLowerCase().replace(/\s/g, '_'); this.name = i18next.t(`trainerNames:${nameForCall}`); - this.setTitle("elite_four"); + // Set the title to "elite_four". (this is the key in the i18n file) + this.setTitle('elite_four'); + + // Configure various properties for the Elite Four member. this.setMoneyMultiplier(3.25); this.setBoss(); this.setStaticParty(); this.setBattleBgm('battle_elite'); this.setVictoryBgm('victory_gym'); this.setGenModifiersFunc(party => getRandomTeraModifiers(party, 2, specialtyTypes.length ? specialtyTypes : null)); + return this; } + /** + * Initializes the trainer configuration for a Champion. + * @param {Species | Species[]} signatureSpecies - The signature species for the Champion. + * @returns {TrainerConfig} - The updated TrainerConfig instance. + **/ initForChampion(signatureSpecies: (Species | Species[])[]): TrainerConfig { + // Check if the internationalization (i18n) system is initialized. if (!getIsInitialized()) { initI18n(); } + + // Set the party templates for the Champion. this.setPartyTemplates(trainerPartyTemplates.CHAMPION); + + // Set up party members with their corresponding species. signatureSpecies.forEach((speciesPool, s) => { + // Ensure speciesPool is an array. if (!Array.isArray(speciesPool)) speciesPool = [speciesPool]; + // Set a function to get a random party member from the species pool. this.setPartyMemberFunc(-(s + 1), getRandomPartyMemberFunc(speciesPool)); }); + + // Set species filter to only include species with a base total of 470 or higher. this.setSpeciesFilter(p => p.baseTotal >= 470); - // Handle name by checking this.name - making it lowercase and replacing spaces with underscores and then calling i18next.t with the name + + // Localize the trainer's name by converting it to lowercase and replacing spaces with underscores. const nameForCall = this.name.toLowerCase().replace(/\s/g, '_'); this.name = i18next.t(`trainerNames:${nameForCall}`); - this.setTitle("champion"); + + // Set the title to "champion". (this is the key in the i18n file) + this.setTitle('champion'); + + // Configure various properties for the Champion. this.setMoneyMultiplier(10); this.setBoss(); this.setStaticParty(); this.setBattleBgm('battle_champion_alder'); this.setVictoryBgm('victory_champion'); this.setGenModifiersFunc(party => getRandomTeraModifiers(party, 3)); + return this; } + /** + * Retrieves the title for the trainer based on the provided trainer slot and variant. + * @param {TrainerSlot} trainerSlot - The slot to determine which title to use. Defaults to TrainerSlot.NONE. + * @param {TrainerVariant} variant - The variant of the trainer to determine the specific title. + * @returns {string} - The title of the trainer. + **/ getTitle(trainerSlot: TrainerSlot = TrainerSlot.NONE, variant: TrainerVariant): string { let ret = this.name; + // Check if the variant is double and the name for double exists if (!trainerSlot && variant === TrainerVariant.DOUBLE && this.nameDouble) return this.nameDouble; + // Female variant if (this.hasGenders) { + // If the name is already set if (this.nameFemale) { + // Check if the variant is either female or this is for the partner in a double battle if (variant === TrainerVariant.FEMALE || (variant === TrainerVariant.DOUBLE && trainerSlot === TrainerSlot.TRAINER_PARTNER)) return this.nameFemale; } else - // Check if !variant is true, if so return the name, else return the name with _female appended if (variant) { if (!getIsInitialized()) { initI18n(); } // Check if the female version exists in the i18n file - if (i18next.exists(`trainerClasses:${this.name.toLowerCase().replace}`)) { + if (i18next.exists(`trainerClasses:${this.name.toLowerCase().replace()}`)) { // If it does, return return ret + "_female"; } else { @@ -603,12 +687,12 @@ function getRandomTeraModifiers(party: EnemyPokemon[], count: integer, types?: T export const trainerConfigs: TrainerConfigs = { [TrainerType.UNKNOWN]: new TrainerConfig(0).setHasGenders(), - [TrainerType.ACE_TRAINER]: new TrainerConfig(++t).setHasGenders().setHasDouble('Ace Duo').setMoneyMultiplier(2.25).setEncounterBgm(TrainerType.ACE_TRAINER) + [TrainerType.ACE_TRAINER]: new TrainerConfig(++t).setHasGenders('Ace Trainer Female').setHasDouble('Ace Duo').setMoneyMultiplier(2.25).setEncounterBgm(TrainerType.ACE_TRAINER) .setPartyTemplateFunc(scene => getWavePartyTemplate(scene, trainerPartyTemplates.THREE_WEAK_BALANCED, trainerPartyTemplates.FOUR_WEAK_BALANCED, trainerPartyTemplates.FIVE_WEAK_BALANCED, trainerPartyTemplates.SIX_WEAK_BALANCED)), [TrainerType.ARTIST]: new TrainerConfig(++t).setEncounterBgm(TrainerType.RICH).setPartyTemplates(trainerPartyTemplates.ONE_STRONG, trainerPartyTemplates.TWO_AVG, trainerPartyTemplates.THREE_AVG) .setSpeciesPools([ Species.SMEARGLE ]), - [TrainerType.BACKERS]: new TrainerConfig(++t).setHasGenders().setDoubleOnly().setEncounterBgm(TrainerType.CYCLIST), - [TrainerType.BACKPACKER]: new TrainerConfig(++t).setHasGenders().setHasDouble('Backpackers').setSpeciesFilter(s => s.isOfType(Type.FLYING) || s.isOfType(Type.ROCK)).setEncounterBgm(TrainerType.BACKPACKER) + [TrainerType.BACKERS]: new TrainerConfig(++t).setHasGenders("Backers").setDoubleOnly().setEncounterBgm(TrainerType.CYCLIST), + [TrainerType.BACKPACKER]: new TrainerConfig(++t).setHasGenders("Backpacker Female").setHasDouble('Backpackers').setSpeciesFilter(s => s.isOfType(Type.FLYING) || s.isOfType(Type.ROCK)).setEncounterBgm(TrainerType.BACKPACKER) .setPartyTemplates(trainerPartyTemplates.ONE_STRONG, trainerPartyTemplates.ONE_WEAK_ONE_STRONG, trainerPartyTemplates.ONE_AVG_ONE_STRONG) .setSpeciesPools({ [TrainerPoolTier.COMMON]: [ Species.RHYHORN, Species.AIPOM, Species.MAKUHITA, Species.MAWILE, Species.NUMEL, Species.LILLIPUP, Species.SANDILE, Species.WOOLOO ], @@ -628,17 +712,17 @@ export const trainerConfigs: TrainerConfigs = { [TrainerPoolTier.SUPER_RARE]: [ Species.HITMONTOP, Species.INFERNAPE, Species.GALLADE, Species.HAWLUCHA, Species.HAKAMO_O ], [TrainerPoolTier.ULTRA_RARE]: [ Species.KUBFU ] }), - [TrainerType.BREEDER]: new TrainerConfig(++t).setMoneyMultiplier(1.325).setEncounterBgm(TrainerType.POKEFAN).setHasGenders().setHasDouble('Breeders') + [TrainerType.BREEDER]: new TrainerConfig(++t).setMoneyMultiplier(1.325).setEncounterBgm(TrainerType.POKEFAN).setHasGenders("Breeder Female").setHasDouble('Breeders') .setPartyTemplateFunc(scene => getWavePartyTemplate(scene, trainerPartyTemplates.FOUR_WEAKER, trainerPartyTemplates.FIVE_WEAKER, trainerPartyTemplates.SIX_WEAKER)) .setSpeciesFilter(s => s.baseTotal < 450), - [TrainerType.CLERK]: new TrainerConfig(++t).setHasGenders().setHasDouble('Colleagues').setEncounterBgm(TrainerType.CLERK) + [TrainerType.CLERK]: new TrainerConfig(++t).setHasGenders("Clerk Female").setHasDouble('Colleagues').setEncounterBgm(TrainerType.CLERK) .setPartyTemplates(trainerPartyTemplates.TWO_WEAK, trainerPartyTemplates.THREE_WEAK, trainerPartyTemplates.ONE_AVG, trainerPartyTemplates.TWO_AVG, trainerPartyTemplates.TWO_WEAK_ONE_AVG) .setSpeciesPools({ [TrainerPoolTier.COMMON]: [ Species.MEOWTH, Species.PSYDUCK, Species.BUDEW, Species.PIDOVE, Species.CINCCINO, Species.LITLEO ], [TrainerPoolTier.UNCOMMON]: [ Species.JIGGLYPUFF, Species.MAGNEMITE, Species.MARILL, Species.COTTONEE, Species.SKIDDO ], [TrainerPoolTier.RARE]: [ Species.BUIZEL, Species.SNEASEL, Species.KLEFKI, Species.INDEEDEE ] }), - [TrainerType.CYCLIST]: new TrainerConfig(++t).setMoneyMultiplier(1.3).setHasGenders().setHasDouble('Cyclists').setEncounterBgm(TrainerType.CYCLIST) + [TrainerType.CYCLIST]: new TrainerConfig(++t).setMoneyMultiplier(1.3).setHasGenders("Cyclist Female").setHasDouble('Cyclists').setEncounterBgm(TrainerType.CYCLIST) .setPartyTemplates(trainerPartyTemplates.TWO_WEAK, trainerPartyTemplates.ONE_AVG) .setSpeciesPools({ [TrainerPoolTier.COMMON]: [ Species.PICHU, Species.STARLY, Species.TAILLOW, Species.BOLTUND ], @@ -697,9 +781,9 @@ export const trainerConfigs: TrainerConfigs = { }), [TrainerType.PARASOL_LADY]: new TrainerConfig(++t).setMoneyMultiplier(1.55).setEncounterBgm(TrainerType.PARASOL_LADY).setSpeciesFilter(s => s.isOfType(Type.WATER)), [TrainerType.PILOT]: new TrainerConfig(++t).setEncounterBgm(TrainerType.CLERK).setSpeciesFilter(s => tmSpecies[Moves.FLY].indexOf(s.speciesId) > -1), - [TrainerType.POKEFAN]: new TrainerConfig(++t).setMoneyMultiplier(1.4).setName('Poké Fan').setHasGenders().setHasDouble('Poké Fan Family').setEncounterBgm(TrainerType.POKEFAN) + [TrainerType.POKEFAN]: new TrainerConfig(++t).setMoneyMultiplier(1.4).setName('PokéFan').setHasGenders("PokéFan Female").setHasDouble('PokéFan Family').setEncounterBgm(TrainerType.POKEFAN) .setPartyTemplates(trainerPartyTemplates.SIX_WEAKER, trainerPartyTemplates.FOUR_WEAK, trainerPartyTemplates.TWO_AVG, trainerPartyTemplates.ONE_STRONG, trainerPartyTemplates.FOUR_WEAK_SAME, trainerPartyTemplates.FIVE_WEAK, trainerPartyTemplates.SIX_WEAKER_SAME), - [TrainerType.PRESCHOOLER]: new TrainerConfig(++t).setMoneyMultiplier(0.2).setEncounterBgm(TrainerType.YOUNGSTER).setHasGenders(undefined, 'lass').setHasDouble('Preschoolers') + [TrainerType.PRESCHOOLER]: new TrainerConfig(++t).setMoneyMultiplier(0.2).setEncounterBgm(TrainerType.YOUNGSTER).setHasGenders("Preschooler Female", 'lass').setHasDouble('Preschoolers') .setPartyTemplates(trainerPartyTemplates.THREE_WEAK, trainerPartyTemplates.FOUR_WEAKER, trainerPartyTemplates.TWO_WEAK_SAME_ONE_AVG, trainerPartyTemplates.FIVE_WEAKER) .setSpeciesPools({ [TrainerPoolTier.COMMON]: [ Species.CATERPIE, Species.PICHU, Species.SANDSHREW, Species.LEDYBA, Species.BUDEW, Species.BURMY, Species.WOOLOO, Species.PAWMI, Species.SMOLIV ], @@ -707,7 +791,7 @@ export const trainerConfigs: TrainerConfigs = { [TrainerPoolTier.RARE]: [ Species.RALTS, Species.RIOLU, Species.JOLTIK, Species.TANDEMAUS ], [TrainerPoolTier.SUPER_RARE]: [ Species.DARUMAKA, Species.TINKATINK ], }), - [TrainerType.PSYCHIC]: new TrainerConfig(++t).setHasGenders().setHasDouble('Psychics').setMoneyMultiplier(1.4).setEncounterBgm(TrainerType.PSYCHIC) + [TrainerType.PSYCHIC]: new TrainerConfig(++t).setHasGenders("Psychic Female").setHasDouble('Psychics').setMoneyMultiplier(1.4).setEncounterBgm(TrainerType.PSYCHIC) .setPartyTemplates(trainerPartyTemplates.TWO_WEAK, trainerPartyTemplates.TWO_AVG, trainerPartyTemplates.TWO_WEAK_SAME_ONE_AVG, trainerPartyTemplates.TWO_WEAK_SAME_TWO_WEAK_SAME, trainerPartyTemplates.ONE_STRONGER) .setSpeciesPools({ [TrainerPoolTier.COMMON]: [ Species.ABRA, Species.DROWZEE, Species.RALTS, Species.SPOINK, Species.GOTHITA, Species.SOLOSIS, Species.BLIPBUG, Species.ESPURR, Species.HATENNA ], @@ -715,7 +799,7 @@ export const trainerConfigs: TrainerConfigs = { [TrainerPoolTier.RARE]: [ Species.ELGYEM, Species.SIGILYPH, Species.BALTOY, Species.GIRAFARIG, Species.MEOWSTIC ], [TrainerPoolTier.SUPER_RARE]: [ Species.BELDUM, Species.ESPEON, Species.STANTLER ], }), - [TrainerType.RANGER]: new TrainerConfig(++t).setMoneyMultiplier(1.4).setName('Pokémon Ranger').setEncounterBgm(TrainerType.BACKPACKER).setHasGenders().setHasDouble('Pokémon Rangers') + [TrainerType.RANGER]: new TrainerConfig(++t).setMoneyMultiplier(1.4).setName('Pokémon Ranger').setEncounterBgm(TrainerType.BACKPACKER).setHasGenders("Pokémon Ranger Female").setHasDouble('Pokémon Rangers') .setSpeciesPools({ [TrainerPoolTier.COMMON]: [ Species.PICHU, Species.GROWLITHE, Species.PONYTA, Species.ZIGZAGOON, Species.SEEDOT, Species.BIDOOF, Species.RIOLU, Species.SEWADDLE, Species.SKIDDO, Species.SALANDIT, Species.YAMPER ], [TrainerPoolTier.UNCOMMON]: [ Species.AZURILL, Species.TAUROS, Species.MAREEP, Species.FARFETCHD, Species.TEDDIURSA, Species.SHROOMISH, Species.ELECTRIKE, Species.BUDEW, Species.BUIZEL, Species.MUDBRAY, Species.STUFFUL ], @@ -725,7 +809,7 @@ export const trainerConfigs: TrainerConfigs = { [TrainerType.RICH]: new TrainerConfig(++t).setMoneyMultiplier(5).setName('Gentleman').setHasGenders('Madame').setHasDouble('Rich Couple'), [TrainerType.RICH_KID]: new TrainerConfig(++t).setMoneyMultiplier(3.75).setName('Rich Boy').setHasGenders('Lady').setHasDouble('Rich Kids').setEncounterBgm(TrainerType.RICH), [TrainerType.ROUGHNECK]: new TrainerConfig(++t).setMoneyMultiplier(1.4).setEncounterBgm(TrainerType.ROUGHNECK).setSpeciesFilter(s => s.isOfType(Type.DARK)), - [TrainerType.SCIENTIST]: new TrainerConfig(++t).setHasGenders().setHasDouble('Scientists').setMoneyMultiplier(1.7).setEncounterBgm(TrainerType.SCIENTIST) + [TrainerType.SCIENTIST]: new TrainerConfig(++t).setHasGenders("Scientist Female").setHasDouble('Scientists').setMoneyMultiplier(1.7).setEncounterBgm(TrainerType.SCIENTIST) .setSpeciesPools({ [TrainerPoolTier.COMMON]: [ Species.MAGNEMITE, Species.GRIMER, Species.DROWZEE, Species.VOLTORB, Species.KOFFING ], [TrainerPoolTier.UNCOMMON]: [ Species.BALTOY, Species.BRONZOR, Species.FERROSEED, Species.KLINK, Species.CHARJABUG, Species.BLIPBUG, Species.HELIOPTILE ], @@ -734,29 +818,29 @@ export const trainerConfigs: TrainerConfigs = { [TrainerPoolTier.ULTRA_RARE]: [ Species.ROTOM, Species.MELTAN ] }), [TrainerType.SMASHER]: new TrainerConfig(++t).setMoneyMultiplier(1.2).setEncounterBgm(TrainerType.CYCLIST), - [TrainerType.SNOW_WORKER]: new TrainerConfig(++t).setName('Worker').setHasGenders().setHasDouble('Workers').setMoneyMultiplier(1.7).setEncounterBgm(TrainerType.CLERK).setSpeciesFilter(s => s.isOfType(Type.ICE) || s.isOfType(Type.STEEL)), + [TrainerType.SNOW_WORKER]: new TrainerConfig(++t).setName('Worker').setHasGenders("Worker Female").setHasDouble('Workers').setMoneyMultiplier(1.7).setEncounterBgm(TrainerType.CLERK).setSpeciesFilter(s => s.isOfType(Type.ICE) || s.isOfType(Type.STEEL)), [TrainerType.STRIKER]: new TrainerConfig(++t).setMoneyMultiplier(1.2).setEncounterBgm(TrainerType.CYCLIST), - [TrainerType.SCHOOL_KID]: new TrainerConfig(++t).setMoneyMultiplier(0.75).setEncounterBgm(TrainerType.YOUNGSTER).setHasGenders(undefined, 'lass').setHasDouble('School Kids') + [TrainerType.SCHOOL_KID]: new TrainerConfig(++t).setMoneyMultiplier(0.75).setEncounterBgm(TrainerType.YOUNGSTER).setHasGenders("School Kid Female", 'lass').setHasDouble('School Kids') .setSpeciesPools({ [TrainerPoolTier.COMMON]: [ Species.ODDISH, Species.EXEGGCUTE, Species.TEDDIURSA, Species.WURMPLE, Species.RALTS, Species.SHROOMISH, Species.FLETCHLING ], [TrainerPoolTier.UNCOMMON]: [ Species.VOLTORB, Species.WHISMUR, Species.MEDITITE, Species.MIME_JR, Species.NYMBLE ], [TrainerPoolTier.RARE]: [ Species.TANGELA, Species.EEVEE, Species.YANMA ], [TrainerPoolTier.SUPER_RARE]: [ Species.TADBULB ] }), - [TrainerType.SWIMMER]: new TrainerConfig(++t).setMoneyMultiplier(1.3).setEncounterBgm(TrainerType.PARASOL_LADY).setHasGenders().setHasDouble('Swimmers').setSpecialtyTypes(Type.WATER).setSpeciesFilter(s => s.isOfType(Type.WATER)), + [TrainerType.SWIMMER]: new TrainerConfig(++t).setMoneyMultiplier(1.3).setEncounterBgm(TrainerType.PARASOL_LADY).setHasGenders("Swimmer Female").setHasDouble('Swimmers').setSpecialtyTypes(Type.WATER).setSpeciesFilter(s => s.isOfType(Type.WATER)), [TrainerType.TWINS]: new TrainerConfig(++t).setDoubleOnly().setMoneyMultiplier(0.65).setUseSameSeedForAllMembers() .setPartyTemplateFunc(scene => getWavePartyTemplate(scene, trainerPartyTemplates.TWO_WEAK, trainerPartyTemplates.TWO_AVG, trainerPartyTemplates.TWO_STRONG)) .setPartyMemberFunc(0, getRandomPartyMemberFunc([ Species.PLUSLE, Species.VOLBEAT, Species.PACHIRISU, Species.SILCOON, Species.METAPOD, Species.IGGLYBUFF, Species.PETILIL, Species.EEVEE ])) .setPartyMemberFunc(1, getRandomPartyMemberFunc([ Species.MINUN, Species.ILLUMISE, Species.EMOLGA, Species.CASCOON, Species.KAKUNA, Species.CLEFFA, Species.COTTONEE, Species.EEVEE ], TrainerSlot.TRAINER_PARTNER)) .setEncounterBgm(TrainerType.TWINS), - [TrainerType.VETERAN]: new TrainerConfig(++t).setHasGenders().setHasDouble('Veteran Duo').setMoneyMultiplier(2.5).setEncounterBgm(TrainerType.ACE_TRAINER).setSpeciesFilter(s => s.isOfType(Type.DRAGON)), + [TrainerType.VETERAN]: new TrainerConfig(++t).setHasGenders("Veteran Female").setHasDouble('Veteran Duo').setMoneyMultiplier(2.5).setEncounterBgm(TrainerType.ACE_TRAINER).setSpeciesFilter(s => s.isOfType(Type.DRAGON)), [TrainerType.WAITER]: new TrainerConfig(++t).setHasGenders('Waitress').setHasDouble('Restaurant Staff').setMoneyMultiplier(1.5).setEncounterBgm(TrainerType.CLERK) .setSpeciesPools({ [TrainerPoolTier.COMMON]: [ Species.CLEFFA, Species.CHATOT, Species.PANSAGE, Species.PANSEAR, Species.PANPOUR, Species.MINCCINO ], [TrainerPoolTier.UNCOMMON]: [ Species.TROPIUS, Species.PETILIL, Species.BOUNSWEET, Species.INDEEDEE ], [TrainerPoolTier.RARE]: [ Species.APPLIN, Species.SINISTEA, Species.POLTCHAGEIST ] }), - [TrainerType.WORKER]: new TrainerConfig(++t).setHasGenders().setHasDouble('Workers').setEncounterBgm(TrainerType.CLERK).setMoneyMultiplier(1.7).setSpeciesFilter(s => s.isOfType(Type.ROCK) || s.isOfType(Type.STEEL)), + [TrainerType.WORKER]: new TrainerConfig(++t).setHasGenders("Worker Female").setHasDouble('Workers').setEncounterBgm(TrainerType.CLERK).setMoneyMultiplier(1.7).setSpeciesFilter(s => s.isOfType(Type.ROCK) || s.isOfType(Type.STEEL)), [TrainerType.YOUNGSTER]: new TrainerConfig(++t).setMoneyMultiplier(0.5).setEncounterBgm(TrainerType.YOUNGSTER).setHasGenders('Lass', 'lass').setHasDouble('Beginners').setPartyTemplates(trainerPartyTemplates.TWO_WEAKER) .setSpeciesPools( [ Species.CATERPIE, Species.WEEDLE, Species.RATTATA, Species.SENTRET, Species.POOCHYENA, Species.ZIGZAGOON, Species.WURMPLE, Species.BIDOOF, Species.PATRAT, Species.LILLIPUP ] diff --git a/src/field/pokemon.ts b/src/field/pokemon.ts index 0a5e0a6a991..8e56d163141 100644 --- a/src/field/pokemon.ts +++ b/src/field/pokemon.ts @@ -17,7 +17,7 @@ import { initMoveAnim, loadMoveAnimAssets } from '../data/battle-anims'; import { Status, StatusEffect, getRandomStatus } from '../data/status-effect'; import { pokemonEvolutions, pokemonPrevolutions, SpeciesFormEvolution, SpeciesEvolutionCondition, FusionSpeciesFormEvolution } from '../data/pokemon-evolutions'; import { reverseCompatibleTms, tmSpecies, tmPoolTiers } from '../data/tms'; -import { DamagePhase, FaintPhase, LearnMovePhase, ObtainStatusEffectPhase, StatChangePhase, SwitchSummonPhase } from '../phases'; +import { DamagePhase, FaintPhase, LearnMovePhase, ObtainStatusEffectPhase, StatChangePhase, SwitchPhase, SwitchSummonPhase, ToggleDoublePositionPhase } from '../phases'; import { BattleStat } from '../data/battle-stat'; import { BattlerTag, BattlerTagLapseType, EncoreTag, HelpingHandTag, HighestStatBoostTag, TypeBoostTag, getBattlerTag } from '../data/battler-tags'; import { BattlerTagType } from "../data/enums/battler-tag-type"; @@ -27,7 +27,7 @@ import { TempBattleStat } from '../data/temp-battle-stat'; import { ArenaTagSide, WeakenMoveScreenTag, WeakenMoveTypeTag } from '../data/arena-tag'; import { ArenaTagType } from "../data/enums/arena-tag-type"; import { Biome } from "../data/enums/biome"; -import { Ability, AbAttr, BattleStatMultiplierAbAttr, BlockCritAbAttr, BonusCritAbAttr, BypassBurnDamageReductionAbAttr, FieldPriorityMoveImmunityAbAttr, FieldVariableMovePowerAbAttr, IgnoreOpponentStatChangesAbAttr, MoveImmunityAbAttr, MoveTypeChangeAttr, NonSuperEffectiveImmunityAbAttr, PreApplyBattlerTagAbAttr, PreDefendFullHpEndureAbAttr, ReceivedMoveDamageMultiplierAbAttr, ReduceStatusEffectDurationAbAttr, StabBoostAbAttr, StatusEffectImmunityAbAttr, TypeImmunityAbAttr, VariableMovePowerAbAttr, VariableMoveTypeAbAttr, WeightMultiplierAbAttr, allAbilities, applyAbAttrs, applyBattleStatMultiplierAbAttrs, applyPostDefendAbAttrs, applyPreApplyBattlerTagAbAttrs, applyPreAttackAbAttrs, applyPreDefendAbAttrs, applyPreSetStatusAbAttrs, UnsuppressableAbilityAbAttr, SuppressFieldAbilitiesAbAttr, NoFusionAbilityAbAttr, MultCritAbAttr, IgnoreTypeImmunityAbAttr, DamageBoostAbAttr, IgnoreTypeStatusEffectImmunityAbAttr } from '../data/ability'; +import { Ability, AbAttr, BattleStatMultiplierAbAttr, BlockCritAbAttr, BonusCritAbAttr, BypassBurnDamageReductionAbAttr, FieldPriorityMoveImmunityAbAttr, FieldVariableMovePowerAbAttr, IgnoreOpponentStatChangesAbAttr, MoveImmunityAbAttr, MoveTypeChangeAttr, NonSuperEffectiveImmunityAbAttr, PreApplyBattlerTagAbAttr, PreDefendFullHpEndureAbAttr, ReceivedMoveDamageMultiplierAbAttr, ReduceStatusEffectDurationAbAttr, StabBoostAbAttr, StatusEffectImmunityAbAttr, TypeImmunityAbAttr, VariableMovePowerAbAttr, VariableMoveTypeAbAttr, WeightMultiplierAbAttr, allAbilities, applyAbAttrs, applyBattleStatMultiplierAbAttrs, applyPostDefendAbAttrs, applyPreApplyBattlerTagAbAttrs, applyPreAttackAbAttrs, applyPreDefendAbAttrs, applyPreSetStatusAbAttrs, UnsuppressableAbilityAbAttr, SuppressFieldAbilitiesAbAttr, NoFusionAbilityAbAttr, MultCritAbAttr, IgnoreTypeImmunityAbAttr, DamageBoostAbAttr, IgnoreTypeStatusEffectImmunityAbAttr, ConditionalCritAbAttr } from '../data/ability'; import { Abilities } from "#app/data/enums/abilities"; import PokemonData from '../system/pokemon-data'; import Battle, { BattlerIndex } from '../battle'; @@ -329,9 +329,17 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { if (variantSet && variantSet[this.variant] === 1) { if (variantColorCache.hasOwnProperty(key)) return resolve(); - this.scene.cachedFetch(`./images/pokemon/variant/${useExpSprite ? 'exp/' : ''}${battleSpritePath}.json`).then(res => res.json()).then(c => { - variantColorCache[key] = c; - resolve(); + this.scene.cachedFetch(`./images/pokemon/variant/${useExpSprite ? 'exp/' : ''}${battleSpritePath}.json`). + then(res => { + // Prevent the JSON from processing if it failed to load + if (!res.ok) { + console.error(`Could not load ${res.url}!`); + return; + } + res.json() + }).then(c => { + variantColorCache[key] = c; + resolve(); }); } else resolve(); @@ -493,9 +501,31 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { this.shinySparkle = shinySparkle; } + /** + * Attempts to animate a given {@linkcode Phaser.GameObjects.Sprite} + * @see {@linkcode Phaser.GameObjects.Sprite.play} + * @param sprite {@linkcode Phaser.GameObjects.Sprite} to animate + * @param tintSprite {@linkcode Phaser.GameObjects.Sprite} placed on top of the sprite to add a color tint + * @param animConfig {@linkcode String} to pass to {@linkcode Phaser.GameObjects.Sprite.play} + * @returns true if the sprite was able to be animated + */ + tryPlaySprite(sprite: Phaser.GameObjects.Sprite, tintSprite: Phaser.GameObjects.Sprite, key: string): boolean { + // Catch errors when trying to play an animation that doesn't exist + try { + sprite.play(key); + tintSprite.play(key); + } + catch(error: unknown) { + console.error(`Couldn't play animation for '${key}'!\nIs the image for this Pokemon missing?\n`, error); + + return false; + } + + return true; + } + playAnim(): void { - this.getSprite().play(this.getBattleSpriteKey()); - this.getTintSprite().play(this.getBattleSpriteKey()); + this.tryPlaySprite(this.getSprite(), this.getTintSprite(), this.getBattleSpriteKey()); } getFieldPositionOffset(): [ number, number ] { @@ -1493,6 +1523,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { const critOnly = new Utils.BooleanHolder(false); const critAlways = source.getTag(BattlerTagType.ALWAYS_CRIT); applyMoveAttrs(CritOnlyAttr, source, this, move, critOnly); + applyAbAttrs(ConditionalCritAbAttr, source, null, critOnly, this, move); if (critOnly.value || critAlways) isCritical = true; else { @@ -1508,12 +1539,12 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { critLevel.value += 2; const critChance = [24, 8, 2, 1][Math.max(0, Math.min(critLevel.value, 3))]; isCritical = !source.getTag(BattlerTagType.NO_CRIT) && (critChance === 1 || !this.scene.randBattleSeedInt(critChance)); - if (isCritical) { - const blockCrit = new Utils.BooleanHolder(false); - applyAbAttrs(BlockCritAbAttr, this, null, blockCrit); - if (blockCrit.value) - isCritical = false; - } + } + if (isCritical) { + const blockCrit = new Utils.BooleanHolder(false); + applyAbAttrs(BlockCritAbAttr, this, null, blockCrit); + if (blockCrit.value) + isCritical = false; } const sourceAtk = new Utils.IntegerHolder(source.getBattleStat(isPhysical ? Stat.ATK : Stat.SPATK, this, null, isCritical)); const targetDef = new Utils.IntegerHolder(this.getBattleStat(isPhysical ? Stat.DEF : Stat.SPDEF, source, move, isCritical)); @@ -1628,6 +1659,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { this.scene.gameData.gameStats.highestDamage = damage.value; } source.turnData.damageDealt += damage.value; + source.turnData.currDamageDealt = damage.value; this.battleData.hitCount++; const attackResult = { move: move.id, result: result as DamageResult, damage: damage.value, critical: isCritical, sourceId: source.id }; this.turnData.attacksReceived.unshift(attackResult); @@ -2649,6 +2681,42 @@ export class PlayerPokemon extends Pokemon { sd.friendship = Math.max((sd.friendship || 0) + starterAmount.value, 0); } } + /** + * Handles Revival Blessing when used by player. + * @returns Promise to revive a pokemon. + * @see {@linkcode RevivalBlessingAttr} + */ + revivalBlessing(): Promise { + return new Promise(resolve => { + this.scene.ui.setMode(Mode.PARTY, PartyUiMode.REVIVAL_BLESSING, this.getFieldIndex(), (slotIndex:integer, option: PartyOption) => { + if(slotIndex >= 0 && slotIndex<6) { + const pokemon = this.scene.getParty()[slotIndex]; + if(!pokemon || !pokemon.isFainted()) + resolve(); + + pokemon.resetTurnData(); + pokemon.resetStatus(); + pokemon.heal(Math.min(Math.max(Math.ceil(Math.floor(0.5 * pokemon.getMaxHp())), 1), pokemon.getMaxHp())); + this.scene.queueMessage(`${pokemon.name} was revived!`,0,true); + + if(this.scene.currentBattle.double && this.scene.getParty().length > 1) { + const allyPokemon = this.getAlly(); + if(slotIndex<=1) { + // Revived ally pokemon + this.scene.unshiftPhase(new SwitchSummonPhase(this.scene, pokemon.getFieldIndex(), slotIndex, false, false, true)); + this.scene.unshiftPhase(new ToggleDoublePositionPhase(this.scene, true)); + } else if(allyPokemon.isFainted()) { + // Revived party pokemon, and ally pokemon is fainted + this.scene.unshiftPhase(new SwitchSummonPhase(this.scene, allyPokemon.getFieldIndex(), slotIndex, false, false, true)); + this.scene.unshiftPhase(new ToggleDoublePositionPhase(this.scene, true)); + } + } + + } + this.scene.ui.setMode(Mode.MESSAGE).then(() => resolve()); + }, PartyUiHandler.FilterFainted) + }) + } getPossibleEvolution(evolution: SpeciesFormEvolution): Promise { return new Promise(resolve => { @@ -3350,6 +3418,7 @@ export class PokemonTurnData { public hitCount: integer; public hitsLeft: integer; public damageDealt: integer = 0; + public currDamageDealt: integer = 0; public damageTaken: integer = 0; public attacksReceived: AttackMoveResult[] = []; } diff --git a/src/field/trainer.ts b/src/field/trainer.ts index 60497239488..8cd06cac12f 100644 --- a/src/field/trainer.ts +++ b/src/field/trainer.ts @@ -96,30 +96,54 @@ export default class Trainer extends Phaser.GameObjects.Container { return this.config.getSpriteKey(this.variant === TrainerVariant.FEMALE || forceFemale); } + /** + * Returns the name of the trainer based on the provided trainer slot and the option to include a title. + * @param {TrainerSlot} trainerSlot - The slot to determine which name to use. Defaults to TrainerSlot.NONE. + * @param {boolean} includeTitle - Whether to include the title in the returned name. Defaults to false. + * @returns {string} - The formatted name of the trainer. + **/ getName(trainerSlot: TrainerSlot = TrainerSlot.NONE, includeTitle: boolean = false): string { + // Get the base title based on the trainer slot and variant. let name = this.config.getTitle(trainerSlot, this.variant); + + // Determine the title to include based on the configuration and includeTitle flag. let title = includeTitle && this.config.title ? this.config.title : null; - + // If the trainer has a name (not null or undefined). if (this.name) { - if (includeTitle) - - // Check if i18n is initialized + // If the title should be included. + if (includeTitle) { + // Check if the internationalization (i18n) system is initialized. if (!getIsInitialized()) { - initI18n() + // Initialize the i18n system if it is not already initialized. + initI18n(); } + // Get the localized trainer class name from the i18n file and set it as the title. + // This is used for trainer class names, not titles like "Elite Four, Champion, etc." title = i18next.t(`trainerClasses:${name.toLowerCase().replace(/\s/g, '_')}`); + } + + // If no specific trainer slot is set. if (!trainerSlot) { + // Use the trainer's name. name = this.name; - if (this.partnerName) + // If there is a partner name, concatenate it with the trainer's name using "&". + if (this.partnerName) { name = `${name} & ${this.partnerName}`; - } else + } + } else { + // Assign the name based on the trainer slot: + // Use 'this.name' if 'trainerSlot' is TRAINER. + // Otherwise, use 'this.partnerName' if it exists, or 'this.name' if it doesn't. name = trainerSlot === TrainerSlot.TRAINER ? this.name : this.partnerName || this.name; + } } + // Return the formatted name, including the title if it is set. return title ? `${title} ${name}` : name; } + isDouble(): boolean { return this.config.doubleOnly || this.variant === TrainerVariant.DOUBLE; } diff --git a/src/locales/de/config.ts b/src/locales/de/config.ts index af52d8bc51b..3580d74876d 100644 --- a/src/locales/de/config.ts +++ b/src/locales/de/config.ts @@ -20,6 +20,7 @@ import { tutorial } from "./tutorial"; import { weather } from "./weather"; import { battleMessageUiHandler } from "./battle-message-ui-handler"; import { berry } from "./berry"; +import { voucher } from "./voucher"; export const deConfig = { ability: ability, @@ -46,4 +47,5 @@ export const deConfig = { weather: weather, battleMessageUiHandler: battleMessageUiHandler, berry: berry, -} \ No newline at end of file + voucher: voucher, +} diff --git a/src/locales/de/trainers.ts b/src/locales/de/trainers.ts index 11e8d914842..93eb04cca67 100644 --- a/src/locales/de/trainers.ts +++ b/src/locales/de/trainers.ts @@ -68,8 +68,9 @@ export const trainerClasses: SimpleTranslationEntries = { "officer": "Polizist", "parasol_lady": "Schirmdame", "pilot": "Pilot", - "pokefan": "Pokéfan", - "pokefan_family": "Pokéfan-Pärchen", + "pokéfan": "Pokéfan", + "pokéfan_female": "Pokéfan", + "pokéfan_family": "Pokéfan-Pärchen", "preschooler": "Vorschüler", "preschooler_female": "Vorschülerin", "preschoolers": "Vorschüler", @@ -77,6 +78,7 @@ export const trainerClasses: SimpleTranslationEntries = { "psychic_female": "Seherin", "psychics": "Seher", "pokémon_ranger": "Pokémon-Ranger", + "pokémon_ranger_female": "Pokémon-Ranger", "pokémon_rangers": "Pokémon-Ranger", "ranger": "Ranger", "restaurant_staff": "Restaurant Angestellte", diff --git a/src/locales/de/voucher.ts b/src/locales/de/voucher.ts new file mode 100644 index 00000000000..7af569e88cb --- /dev/null +++ b/src/locales/de/voucher.ts @@ -0,0 +1,11 @@ +import { SimpleTranslationEntries } from "#app/plugins/i18n"; + +export const voucher: SimpleTranslationEntries = { + "vouchers": "Vouchers", + "eggVoucher": "Egg Voucher", + "eggVoucherPlus": "Egg Voucher Plus", + "eggVoucherPremium": "Egg Voucher Premium", + "eggVoucherGold": "Egg Voucher Gold", + "locked": "Locked", + "defeatTrainer": "Defeat {{trainerName}}" +} as const; \ No newline at end of file diff --git a/src/locales/en/config.ts b/src/locales/en/config.ts index 984b0fa239f..f25c0b5e278 100644 --- a/src/locales/en/config.ts +++ b/src/locales/en/config.ts @@ -20,6 +20,7 @@ import { tutorial } from "./tutorial"; import { weather } from "./weather"; import { battleMessageUiHandler } from "./battle-message-ui-handler"; import { berry } from "./berry"; +import { voucher } from "./voucher"; export const enConfig = { ability: ability, @@ -46,4 +47,5 @@ export const enConfig = { weather: weather, battleMessageUiHandler: battleMessageUiHandler, berry: berry, -} \ No newline at end of file + voucher: voucher, +} diff --git a/src/locales/en/trainers.ts b/src/locales/en/trainers.ts index 03c3e22c12c..1eff742e23a 100644 --- a/src/locales/en/trainers.ts +++ b/src/locales/en/trainers.ts @@ -68,8 +68,9 @@ export const trainerClasses: SimpleTranslationEntries = { "officer": "Officer", "parasol_lady": "Parasol Lady", "pilot": "Pilot", - "pokefan": "Poké Fan", - "pokefan_family": "Poké Fan Family", + "pokéfan": "Poké Fan", + "pokéfan_female": "Poké Fan", + "pokéfan_family": "Poké Fan Family", "preschooler": "Preschooler", "preschooler_female": "Preschooler", "preschoolers": "Preschoolers", @@ -77,6 +78,7 @@ export const trainerClasses: SimpleTranslationEntries = { "psychic_female": "Psychic", "psychics": "Psychics", "pokémon_ranger": "Pokémon Ranger", + "pokémon_ranger_female": "Pokémon Ranger", "pokémon_rangers": "Pokémon Ranger", "ranger": "Ranger", "restaurant_staff": "Restaurant Staff", diff --git a/src/locales/en/voucher.ts b/src/locales/en/voucher.ts new file mode 100644 index 00000000000..7af569e88cb --- /dev/null +++ b/src/locales/en/voucher.ts @@ -0,0 +1,11 @@ +import { SimpleTranslationEntries } from "#app/plugins/i18n"; + +export const voucher: SimpleTranslationEntries = { + "vouchers": "Vouchers", + "eggVoucher": "Egg Voucher", + "eggVoucherPlus": "Egg Voucher Plus", + "eggVoucherPremium": "Egg Voucher Premium", + "eggVoucherGold": "Egg Voucher Gold", + "locked": "Locked", + "defeatTrainer": "Defeat {{trainerName}}" +} as const; \ No newline at end of file diff --git a/src/locales/es/config.ts b/src/locales/es/config.ts index 92349028899..2d0a8a536b2 100644 --- a/src/locales/es/config.ts +++ b/src/locales/es/config.ts @@ -20,6 +20,7 @@ import { tutorial } from "./tutorial"; import { weather } from "./weather"; import { battleMessageUiHandler } from "./battle-message-ui-handler"; import { berry } from "./berry"; +import { voucher } from "./voucher"; export const esConfig = { ability: ability, @@ -46,4 +47,5 @@ export const esConfig = { weather: weather, battleMessageUiHandler: battleMessageUiHandler, berry: berry, -} \ No newline at end of file + voucher: voucher, +} diff --git a/src/locales/es/trainers.ts b/src/locales/es/trainers.ts index 916ef8fb838..e0af5aac1c4 100644 --- a/src/locales/es/trainers.ts +++ b/src/locales/es/trainers.ts @@ -68,8 +68,9 @@ export const trainerClasses: SimpleTranslationEntries = { "officer": "Officer", "parasol_lady": "Parasol Lady", "pilot": "Pilot", - "pokefan": "Poké Fan", - "pokefan_family": "Poké Fan Family", + "pokéfan": "Poké Fan", + "pokéfan_female": "Poké Fan", + "pokéfan_family": "Poké Fan Family", "preschooler": "Preschooler", "preschooler_female": "Preschooler", "preschoolers": "Preschoolers", diff --git a/src/locales/es/voucher.ts b/src/locales/es/voucher.ts new file mode 100644 index 00000000000..7af569e88cb --- /dev/null +++ b/src/locales/es/voucher.ts @@ -0,0 +1,11 @@ +import { SimpleTranslationEntries } from "#app/plugins/i18n"; + +export const voucher: SimpleTranslationEntries = { + "vouchers": "Vouchers", + "eggVoucher": "Egg Voucher", + "eggVoucherPlus": "Egg Voucher Plus", + "eggVoucherPremium": "Egg Voucher Premium", + "eggVoucherGold": "Egg Voucher Gold", + "locked": "Locked", + "defeatTrainer": "Defeat {{trainerName}}" +} as const; \ No newline at end of file diff --git a/src/locales/fr/config.ts b/src/locales/fr/config.ts index ecec8de6cb0..a6bdfe5cd59 100644 --- a/src/locales/fr/config.ts +++ b/src/locales/fr/config.ts @@ -20,6 +20,7 @@ import { tutorial } from "./tutorial"; import { weather } from "./weather"; import { battleMessageUiHandler } from "./battle-message-ui-handler"; import { berry } from "./berry"; +import { voucher } from "./voucher"; export const frConfig = { ability: ability, @@ -46,4 +47,5 @@ export const frConfig = { weather: weather, battleMessageUiHandler: battleMessageUiHandler, berry: berry, -} \ No newline at end of file + voucher: voucher, +} diff --git a/src/locales/fr/modifier-type.ts b/src/locales/fr/modifier-type.ts index f8697c04259..4c3725117a2 100644 --- a/src/locales/fr/modifier-type.ts +++ b/src/locales/fr/modifier-type.ts @@ -52,16 +52,16 @@ export const modifierType: ModifierTypeTranslationEntries = { description: "Double les chances de tomber sur un combat double pendant {{battleCount}} combats", }, "TempBattleStatBoosterModifierType": { - description: "Augmente d’1 cran {{tempBattleStatName}} pour toute l’équipe pendant 5 combats", + description: "Augmente d’un cran {{tempBattleStatName}} pour toute l’équipe pendant 5 combats", }, "AttackTypeBoosterModifierType": { description: "Augmente de 20% la puissance des capacités de type {{moveType}} d’un Pokémon", }, "PokemonLevelIncrementModifierType": { - description: "Fait monter un Pokémon d’1 niveau", + description: "Fait monter un Pokémon d’un niveau", }, "AllPokemonLevelIncrementModifierType": { - description: "Fait monter toute l’équipe d’1 niveau", + description: "Fait monter toute l’équipe d’un niveau", }, "PokemonBaseStatBoosterModifierType": { description: "Augmente de 10% {{statName}} de base de son porteur. Plus les IV sont hauts, plus il peut en porter.", @@ -214,13 +214,13 @@ export const modifierType: ModifierTypeTranslationEntries = { "SHINY_CHARM": { name: "Charme Chroma", description: "Augmente énormément les chances de rencontrer un Pokémon sauvage chromatique" }, "ABILITY_CHARM": { name: "Charme Talent", description: "Augmente énormément les chances de rencontrer un Pokémon sauvage avec un Talent Caché" }, - "IV_SCANNER": { name: "Scanner d’IV", description: "Scanne les IV d’un Pokémon sauvage. 2 IV sont révélés par Scanner. Les meilleurs sont montrés en 1er." }, + "IV_SCANNER": { name: "Scanner d’IV", description: "Révèle la qualité de deux IV d’un Pokémon sauvage par scanner possédé. Les meilleurs IV sont révélés en priorité." }, "DNA_SPLICERS": { name: "Pointeau ADN" }, "MINI_BLACK_HOLE": { name: "Mini Trou Noir" }, - "GOLDEN_POKEBALL": { name: "Poké Ball Dorée", description: "Ajoute 1 choix d’objet à la fin de chaque combat" }, + "GOLDEN_POKEBALL": { name: "Poké Ball Dorée", description: "Ajoute un choix d’objet à la fin de chaque combat" }, "ENEMY_DAMAGE_BOOSTER": { name: "Jeton Dégâts", description: "Augmente les dégâts de 5%" }, "ENEMY_DAMAGE_REDUCTION": { name: "Jeton Protection", description: "Diminue les dégâts reçus de 2,5%" }, diff --git a/src/locales/fr/trainers.ts b/src/locales/fr/trainers.ts index 3d22b00f89e..bfc77b5a8cf 100644 --- a/src/locales/fr/trainers.ts +++ b/src/locales/fr/trainers.ts @@ -68,8 +68,9 @@ export const trainerClasses: SimpleTranslationEntries = { "officer": "Policier", "parasol_lady": "Sœur Parasol", "pilot": "Pilote", - "pokefan": "Poké Fan", - "pokefan_family": "Couple de Pokéfans", + "pokéfan": "Poké Fan", + "pokéfan_female": "Poké Fan", + "pokéfan_family": "Couple de Pokéfans", "preschooler": "Petit", "preschooler_female": "Petite", "preschoolers": "Petits", @@ -77,6 +78,7 @@ export const trainerClasses: SimpleTranslationEntries = { "psychic_female": "Kinésiste", "psychics": "Kinésistes", "pokémon_ranger": "Pokémon Ranger", + "pokémon_ranger_female": "Pokémon Ranger", "pokémon_rangers": "Pokémon Rangers", "ranger": "Ranger", "restaurant_staff": "Serveurs", diff --git a/src/locales/fr/voucher.ts b/src/locales/fr/voucher.ts new file mode 100644 index 00000000000..a432cfed53f --- /dev/null +++ b/src/locales/fr/voucher.ts @@ -0,0 +1,11 @@ +import { SimpleTranslationEntries } from "#app/plugins/i18n"; + +export const voucher: SimpleTranslationEntries = { + "vouchers": "Coupons", + "eggVoucher": "Coupon Œuf", + "eggVoucherPlus": "Coupon Œuf +", + "eggVoucherPremium": "Coupon Œuf Premium", + "eggVoucherGold": "Coupon Œuf Or", + "locked": "Verrouillé", + "defeatTrainer": "Vaincre {{trainerName}}" +} as const; \ No newline at end of file diff --git a/src/locales/it/config.ts b/src/locales/it/config.ts index a9c80dc673d..807d136040c 100644 --- a/src/locales/it/config.ts +++ b/src/locales/it/config.ts @@ -20,6 +20,7 @@ import { tutorial } from "./tutorial"; import { weather } from "./weather"; import { battleMessageUiHandler } from "./battle-message-ui-handler"; import { berry } from "./berry"; +import { voucher } from "./voucher"; export const itConfig = { ability: ability, @@ -46,4 +47,5 @@ export const itConfig = { weather: weather, battleMessageUiHandler: battleMessageUiHandler, berry: berry, -} \ No newline at end of file + voucher: voucher, +} diff --git a/src/locales/it/modifier-type.ts b/src/locales/it/modifier-type.ts index 87deece71fe..70303dd7acd 100644 --- a/src/locales/it/modifier-type.ts +++ b/src/locales/it/modifier-type.ts @@ -19,8 +19,8 @@ export const modifierType: ModifierTypeTranslationEntries = { "PokemonHpRestoreModifierType": { description: "Restituisce {{restorePoints}} PS o {{restorePercent}}% PS ad un Pokémon, a seconda del valore più alto", extra: { - "fully": "Restituisce tutti gli PS ad un Pokémon", - "fullyWithStatus": "Restituisce tutti gli PS ad un Pokémon e lo cura da ogni stato", + "fully": "Restituisce tutti i PS ad un Pokémon", + "fullyWithStatus": "Restituisce tutti i PS ad un Pokémon e lo cura da ogni stato", } }, "PokemonReviveModifierType": { @@ -67,7 +67,7 @@ export const modifierType: ModifierTypeTranslationEntries = { description: "Aumenta {{statName}} di base del possessore del 10%", }, "AllPokemonFullHpRestoreModifierType": { - description: "Recupera il 100% degli PS per tutti i Pokémon", + description: "Recupera il 100% dei PS per tutti i Pokémon", }, "AllPokemonFullReviveModifierType": { description: "Rianima tutti i Pokémon esausti restituendogli tutti i PS", @@ -195,7 +195,7 @@ export const modifierType: ModifierTypeTranslationEntries = { "MULTI_LENS": { name: "Multilente" }, - "HEALING_CHARM": { name: "Curamuleto", description: "Aumenta del 10% l'efficacia delle mosse e degli oggetti che ripristinano gli PS (escluse le rianimazioni)" }, + "HEALING_CHARM": { name: "Curamuleto", description: "Aumenta del 10% l'efficacia delle mosse e degli oggetti che ripristinano i PS (escluse le rianimazioni)" }, "CANDY_JAR": { name: "Barattolo di caramelle", description: "Aumenta di 1 il numero di livelli aggiunti dalle Caramelle Rare" }, "BERRY_POUCH": { name: "Porta Bacche", description: "Aggiunge il 25% di possibilità che una bacca usata non venga consumata" }, diff --git a/src/locales/it/trainers.ts b/src/locales/it/trainers.ts index 24c40acdac4..6fcd157a0f1 100644 --- a/src/locales/it/trainers.ts +++ b/src/locales/it/trainers.ts @@ -68,8 +68,9 @@ export const trainerClasses: SimpleTranslationEntries = { "officer": "Officer", "parasol_lady": "Parasol Lady", "pilot": "Pilot", - "pokefan": "Poké Fan", - "pokefan_family": "Poké Fan Family", + "pokéfan": "Poké Fan", + "pokéfan_female": "Poké Fan", + "pokéfan_family": "Poké Fan Family", "preschooler": "Preschooler", "preschooler_female": "Preschooler", "preschoolers": "Preschoolers", @@ -77,6 +78,7 @@ export const trainerClasses: SimpleTranslationEntries = { "psychic_female": "Psychic", "psychics": "Psychics", "pokémon_ranger": "Pokémon Ranger", + "pokémon_ranger_female": "Pokémon Ranger", "pokémon_rangers": "Pokémon Ranger", "ranger": "Ranger", "restaurant_staff": "Restaurant Staff", diff --git a/src/locales/it/voucher.ts b/src/locales/it/voucher.ts new file mode 100644 index 00000000000..7af569e88cb --- /dev/null +++ b/src/locales/it/voucher.ts @@ -0,0 +1,11 @@ +import { SimpleTranslationEntries } from "#app/plugins/i18n"; + +export const voucher: SimpleTranslationEntries = { + "vouchers": "Vouchers", + "eggVoucher": "Egg Voucher", + "eggVoucherPlus": "Egg Voucher Plus", + "eggVoucherPremium": "Egg Voucher Premium", + "eggVoucherGold": "Egg Voucher Gold", + "locked": "Locked", + "defeatTrainer": "Defeat {{trainerName}}" +} as const; \ No newline at end of file diff --git a/src/locales/pt_BR/config.ts b/src/locales/pt_BR/config.ts index 457fc4c125a..a9244f5e9db 100644 --- a/src/locales/pt_BR/config.ts +++ b/src/locales/pt_BR/config.ts @@ -19,6 +19,7 @@ import { titles, trainerClasses, trainerNames } from "./trainers"; import { tutorial } from "./tutorial"; import { weather } from "./weather"; import { berry } from "./berry"; +import { voucher } from "./voucher"; export const ptBrConfig = { @@ -45,4 +46,5 @@ export const ptBrConfig = { weather: weather, modifierType: modifierType, berry: berry, + voucher: voucher, } diff --git a/src/locales/pt_BR/modifier-type.ts b/src/locales/pt_BR/modifier-type.ts index 1ffc6d3187f..faf10fbab2b 100644 --- a/src/locales/pt_BR/modifier-type.ts +++ b/src/locales/pt_BR/modifier-type.ts @@ -45,7 +45,7 @@ export const modifierType: ModifierTypeTranslationEntries = { description: "Aumenta permanentemente os PP para o movimento de um Pokémon em {{upPoints}} para cada 5 PP máximos (máximo 3)", }, "PokemonNatureChangeModifierType": { - name: "{{natureName}} Mint", + name: "Hortelã {{natureName}}", description: "Muda a natureza de um Pokémon para {{natureName}} e a desbloqueia permanentemente para seu inicial", }, "DoubleBattleChanceBoosterModifierType": { diff --git a/src/locales/pt_BR/trainers.ts b/src/locales/pt_BR/trainers.ts index bc79f98b41b..96dc7d1934e 100644 --- a/src/locales/pt_BR/trainers.ts +++ b/src/locales/pt_BR/trainers.ts @@ -68,8 +68,9 @@ export const trainerClasses: SimpleTranslationEntries = { "officer": "Policial", "parasol_lady": "Moça de Sombrinha", "pilot": "Piloto", - "poké_fan": "Pokefã", - "poké_fan_family": "Família Pokefã", + "pokéfan": "Pokefã", + "pokéfan_female": "Pokéfã", + "pokéfan_family": "Família Pokefã", "preschooler": "Menino do Prezinho", "preschooler_female": "Menina do Prezinho", "preschoolers": "Alunos do Prezinho", @@ -77,6 +78,7 @@ export const trainerClasses: SimpleTranslationEntries = { "psychic_female": "Médium", "psychics": "Médiuns", "pokémon_ranger": "Guarda Pokémon", + "pokémon_ranger_female": "Guarda Pokémon", "pokémon_rangers": "Guardas Pokémon", "ranger": "Guarda", "restaurant_staff": "Equipe do Restaurante", diff --git a/src/locales/pt_BR/voucher.ts b/src/locales/pt_BR/voucher.ts new file mode 100644 index 00000000000..7af569e88cb --- /dev/null +++ b/src/locales/pt_BR/voucher.ts @@ -0,0 +1,11 @@ +import { SimpleTranslationEntries } from "#app/plugins/i18n"; + +export const voucher: SimpleTranslationEntries = { + "vouchers": "Vouchers", + "eggVoucher": "Egg Voucher", + "eggVoucherPlus": "Egg Voucher Plus", + "eggVoucherPremium": "Egg Voucher Premium", + "eggVoucherGold": "Egg Voucher Gold", + "locked": "Locked", + "defeatTrainer": "Defeat {{trainerName}}" +} as const; \ No newline at end of file diff --git a/src/locales/zh_CN/battle.ts b/src/locales/zh_CN/battle.ts index cf58add1d6d..f698fcc32ab 100644 --- a/src/locales/zh_CN/battle.ts +++ b/src/locales/zh_CN/battle.ts @@ -2,23 +2,23 @@ import { SimpleTranslationEntries } from "#app/plugins/i18n"; export const battle: SimpleTranslationEntries = { "bossAppeared": "{{bossName}} 出现了。", - "trainerAppeared": "{{trainerName}}\n想要和你对战!", - "trainerAppearedDouble": "{{trainerName}}\nwould like to battle!", - "singleWildAppeared": "一只野生 {{pokemonName}} 出现了。!", - "multiWildAppeared": "野生的 {{pokemonName1}}\n和 {{pokemonName2}} 出现了。!", - "playerComeBack": "回来吧, {{pokemonName}}!", - "trainerComeBack": "{{trainerName}} 收回了 {{pokemonName}}!", - "playerGo": "去吧! {{pokemonName}}!", - "trainerGo": "{{trainerName}} 派出了 {{pokemonName}}!", - "switchQuestion": "要更换\n{{pokemonName}}吗?", - "trainerDefeated": `你击败了\n{{trainerName}}!`, - "pokemonCaught": "{{pokemonName}} 被抓住了!", + "trainerAppeared": "{{trainerName}}\n想要和你对战!", + "trainerAppearedDouble": "{{trainerName}}\n想要和你对战!", + "singleWildAppeared": "一只野生 {{pokemonName}} 出现了!", + "multiWildAppeared": "野生的 {{pokemonName1}}\n和 {{pokemonName2}} 出现了!", + "playerComeBack": "回来吧, {{pokemonName}}!", + "trainerComeBack": "{{trainerName}} 收回了 {{pokemonName}}!", + "playerGo": "去吧! {{pokemonName}}!", + "trainerGo": "{{trainerName}} 派出了 {{pokemonName}}!", + "switchQuestion": "要更换\n{{pokemonName}}吗?", + "trainerDefeated": `你击败了\n{{trainerName}}!`, + "pokemonCaught": "{{pokemonName}} 被抓住了!", "pokemon": "宝可梦", - "sendOutPokemon": "上吧! {{pokemonName}}!", + "sendOutPokemon": "上吧! {{pokemonName}}!", "hitResultCriticalHit": "击中了要害!", "hitResultSuperEffective": "效果拔群!", "hitResultNotVeryEffective": "收效甚微…", - "hitResultNoEffect": "对 {{pokemonName}} 没有效果!!", + "hitResultNoEffect": "对 {{pokemonName}} 没有效果!!", "hitResultOneHitKO": "一击必杀!", "attackFailed": "但是失败了!", "attackHitsCount": `击中 {{count}} 次!`, @@ -32,7 +32,7 @@ export const battle: SimpleTranslationEntries = { "learnMoveNotLearned": "{{pokemonName}} 没有学会 {{moveName}}。", "learnMoveForgetQuestion": "要忘记哪个技能?", "learnMoveForgetSuccess": "{{pokemonName}} 忘记了\n如何使用 {{moveName}}。", - "countdownPoof": "@d{32}1, @d{15}2, @d{15}和@d{15}… @d{15}… @d{15}… @d{15}@s{pb_bounce_1}噗!", + "countdownPoof": "@d{32}1, @d{15}2, @d{15}和@d{15}… @d{15}… @d{15}… @d{15}@s{pb_bounce_1}噗!", "learnMoveAnd": "然后...", "levelCapUp": "等级上限提升到 {{levelCap}}!", "moveNotImplemented": "{{moveName}} 尚未实装,无法选择。", diff --git a/src/locales/zh_CN/command-ui-handler.ts b/src/locales/zh_CN/command-ui-handler.ts index 50f94864cc2..3c17efffd8a 100644 --- a/src/locales/zh_CN/command-ui-handler.ts +++ b/src/locales/zh_CN/command-ui-handler.ts @@ -5,5 +5,5 @@ export const commandUiHandler: SimpleTranslationEntries = { "ball": "精灵球", "pokemon": "宝可梦", "run": "逃跑", - "actionMessage": "要让\n{{pokemonName}} 做什么?", + "actionMessage": "要让\n{{pokemonName}} 做什么?", } as const; \ No newline at end of file diff --git a/src/locales/zh_CN/config.ts b/src/locales/zh_CN/config.ts index 10fe2bc884e..2a01460b855 100644 --- a/src/locales/zh_CN/config.ts +++ b/src/locales/zh_CN/config.ts @@ -2,7 +2,7 @@ import { ability } from "./ability"; import { abilityTriggers } from "./ability-trigger"; import { battle } from "./battle"; import { commandUiHandler } from "./command-ui-handler"; -// import { egg } from "./egg"; +import { egg } from "./egg"; import { fightUiHandler } from "./fight-ui-handler"; import { growth } from "./growth"; import { menu } from "./menu"; @@ -20,6 +20,7 @@ import { tutorial } from "./tutorial"; import { weather } from "./weather"; import { battleMessageUiHandler } from "./battle-message-ui-handler"; import { berry } from "./berry"; +import { voucher } from "./voucher"; export const zhCnConfig = { @@ -27,7 +28,7 @@ export const zhCnConfig = { abilityTriggers: abilityTriggers, battle: battle, commandUiHandler: commandUiHandler, - // egg: egg, + egg: egg, fightUiHandler: fightUiHandler, growth: growth, menu: menu, @@ -47,4 +48,5 @@ export const zhCnConfig = { weather: weather, battleMessageUiHandler: battleMessageUiHandler, berry: berry, -} \ No newline at end of file + voucher: voucher, +} diff --git a/src/locales/zh_CN/egg.ts b/src/locales/zh_CN/egg.ts new file mode 100644 index 00000000000..99916ab0778 --- /dev/null +++ b/src/locales/zh_CN/egg.ts @@ -0,0 +1,21 @@ +import { SimpleTranslationEntries } from "#app/plugins/i18n"; + +export const egg: SimpleTranslationEntries = { + "egg": "蛋", + "greatTier": "稀有", + "ultraTier": "史诗", + "masterTier": "传说", + "defaultTier": "普通", + "hatchWavesMessageSoon": "里面传来声音!\n似乎快要孵化了!", + "hatchWavesMessageClose": "有时好像会动一下。\n就快孵化了吧?", + "hatchWavesMessageNotClose": "会孵化出什么呢?\n看来还需要很长时\n间才能孵化。", + "hatchWavesMessageLongTime": "这个蛋需要很长时间\n才能孵化。", + "gachaTypeLegendary": "传说概率上升", + "gachaTypeMove": "稀有概率上升", + "gachaTypeShiny": "闪光概率上升", + "selectMachine": "选择一个机器。", + "notEnoughVouchers": "你没有足够的兑换券!", + "tooManyEggs": "你的蛋太多啦!", + "pull": "次", + "pulls": "次" +} as const; diff --git a/src/locales/zh_CN/menu.ts b/src/locales/zh_CN/menu.ts index 14bba6f5e6e..c80f55eac61 100644 --- a/src/locales/zh_CN/menu.ts +++ b/src/locales/zh_CN/menu.ts @@ -35,11 +35,11 @@ export const menu: SimpleTranslationEntries = { "boyOrGirl": "你是男孩还是女孩?", "boy": "男孩", "girl": "女孩", - "evolving": "咦?\n{{pokemonName}} 开始进化了!", - "stoppedEvolving": "{{pokemonName}} 停止了进化.", - "pauseEvolutionsQuestion": "你确定要停止 {{pokemonName}} 的进化吗?\n你可以在队伍界面中重新进化.", - "evolutionsPaused": "{{pokemonName}} 的进化停止了.", - "evolutionDone": "恭喜!\n你的 {{pokemonName}} 进化成了 {{evolvedPokemonName}}!", + "evolving": "咦?\n{{pokemonName}} 开始进化了!", + "stoppedEvolving": "{{pokemonName}} 停止了进化。", + "pauseEvolutionsQuestion": "你确定要停止 {{pokemonName}} 的进化吗?\n你可以在队伍界面中重新进化。", + "evolutionsPaused": "{{pokemonName}} 的进化停止了。", + "evolutionDone": "恭喜!\n你的 {{pokemonName}} 进化成了 {{evolvedPokemonName}}!", "dailyRankings": "每日排名", "weeklyRankings": "每周排名", "noRankings": "无排名", diff --git a/src/locales/zh_CN/trainers.ts b/src/locales/zh_CN/trainers.ts index e7ca1093268..7fa16d87fad 100644 --- a/src/locales/zh_CN/trainers.ts +++ b/src/locales/zh_CN/trainers.ts @@ -68,8 +68,9 @@ export const trainerClasses: SimpleTranslationEntries = { "officer": "警察", "parasol_lady": "阳伞姐姐", "pilot": "飞行员", - "pokefan": "发烧友俱乐部", - "pokefan_family": "同好夫妇", + "pokéfan": "发烧友俱乐部", + "pokéfan_female": "发烧友俱乐部", + "pokéfan_family": "同好夫妇", "preschooler": "幼儿园小朋友", "preschooler_female": "幼儿园小朋友", "preschoolers": "幼儿园小朋友组合", @@ -77,6 +78,7 @@ export const trainerClasses: SimpleTranslationEntries = { "psychic_female": "超能力者", "psychics": "超能力者组合", "pokémon_ranger": "宝可梦巡护员", + "pokémon_ranger_female": "宝可梦巡护员", "pokémon_rangers": "宝可梦巡护员组合", "ranger": "巡护员", "restaurant_staff": "服务生组合", diff --git a/src/locales/zh_CN/voucher.ts b/src/locales/zh_CN/voucher.ts new file mode 100644 index 00000000000..7d0f8d2b2dd --- /dev/null +++ b/src/locales/zh_CN/voucher.ts @@ -0,0 +1,11 @@ +import { SimpleTranslationEntries } from "#app/plugins/i18n"; + +export const voucher: SimpleTranslationEntries = { + "vouchers": "兑换券", + "eggVoucher": "初级扭蛋券", + "eggVoucherPlus": "中级扭蛋券", + "eggVoucherPremium": "高级扭蛋券", + "eggVoucherGold": "黄金扭蛋券", + "locked": "锁定", + "defeatTrainer": "你打败了{{trainerName}}" +} as const; \ No newline at end of file diff --git a/src/locales/zh_CN/weather.ts b/src/locales/zh_CN/weather.ts index 5d88ac351bc..f78de2339c0 100644 --- a/src/locales/zh_CN/weather.ts +++ b/src/locales/zh_CN/weather.ts @@ -4,7 +4,7 @@ import { SimpleTranslationEntries } from "#app/plugins/i18n"; * The weather namespace holds text displayed when weather is active during a battle */ export const weather: SimpleTranslationEntries = { - "sunnyStartMessage": "日照变强了!", + "sunnyStartMessage": "日照变强了!", "sunnyLapseMessage": "日照很强。", "sunnyClearMessage": "日照复原了。", @@ -15,22 +15,22 @@ export const weather: SimpleTranslationEntries = { "sandstormStartMessage": "开始刮沙暴了!", "sandstormLapseMessage": "沙暴肆虐。", "sandstormClearMessage": "沙暴停止了!", - "sandstormDamageMessage": "沙暴袭击了{{pokemonPrefix}}{{pokemonName}}!", + "sandstormDamageMessage": "沙暴袭击了{{pokemonPrefix}}{{pokemonName}}!", - "hailStartMessage": "开始下冰雹了!", + "hailStartMessage": "开始下冰雹了!", "hailLapseMessage": "冰雹继续肆虐。", "hailClearMessage": "冰雹不再下了。", - "hailDamageMessage": "冰雹袭击了{{pokemonPrefix}}{{pokemonName}}!", + "hailDamageMessage": "冰雹袭击了{{pokemonPrefix}}{{pokemonName}}!", - "snowStartMessage": "开始下雪了!", + "snowStartMessage": "开始下雪了!", "snowLapseMessage": "雪继续下。", "snowClearMessage": "雪停了。", - "fogStartMessage": "起雾了!", + "fogStartMessage": "起雾了!", "fogLapseMessage": "雾很浓。", "fogClearMessage": "雾散了。", - "heavyRainStartMessage": "开始下起了暴雨!", + "heavyRainStartMessage": "开始下起了暴雨!", "heavyRainLapseMessage": "暴雨势头不减。", "heavyRainClearMessage": "暴雨停了。", @@ -38,7 +38,7 @@ export const weather: SimpleTranslationEntries = { "harshSunLapseMessage": "强日照势头不减。", "harshSunClearMessage": "日照复原了。", - "strongWindsStartMessage": "吹起了神秘的乱流!", + "strongWindsStartMessage": "吹起了神秘的乱流!", "strongWindsLapseMessage": "神秘的乱流势头不减。", "strongWindsClearMessage": "神秘的乱流停止了。" } \ No newline at end of file diff --git a/src/phases.ts b/src/phases.ts index f70fe9e857a..de40e1abe6b 100644 --- a/src/phases.ts +++ b/src/phases.ts @@ -2,7 +2,7 @@ import BattleScene, { AnySound, bypassLogin, startingWave } from "./battle-scene import { default as Pokemon, PlayerPokemon, EnemyPokemon, PokemonMove, MoveResult, DamageResult, FieldPosition, HitResult, TurnMove } from "./field/pokemon"; import * as Utils from './utils'; import { Moves } from "./data/enums/moves"; -import { allMoves, applyMoveAttrs, BypassSleepAttr, ChargeAttr, applyFilteredMoveAttrs, HitsTagAttr, MissEffectAttr, MoveAttr, MoveEffectAttr, MoveFlags, MultiHitAttr, OverrideMoveEffectAttr, VariableAccuracyAttr, MoveTarget, OneHitKOAttr, getMoveTargets, MoveTargetSet, MoveEffectTrigger, CopyMoveAttr, AttackMove, SelfStatusMove, DelayedAttackAttr, RechargeAttr, PreMoveMessageAttr, HealStatusEffectAttr, IgnoreOpponentStatChangesAttr, NoEffectAttr, BypassRedirectAttr, FixedDamageAttr, PostVictoryStatChangeAttr, OneHitKOAccuracyAttr, ForceSwitchOutAttr, VariableTargetAttr, SacrificialAttr } from "./data/move"; +import { allMoves, applyMoveAttrs, BypassSleepAttr, ChargeAttr, applyFilteredMoveAttrs, HitsTagAttr, MissEffectAttr, MoveAttr, MoveEffectAttr, MoveFlags, MultiHitAttr, OverrideMoveEffectAttr, VariableAccuracyAttr, MoveTarget, OneHitKOAttr, getMoveTargets, MoveTargetSet, MoveEffectTrigger, CopyMoveAttr, AttackMove, SelfStatusMove, DelayedAttackAttr, RechargeAttr, PreMoveMessageAttr, HealStatusEffectAttr, IgnoreOpponentStatChangesAttr, NoEffectAttr, BypassRedirectAttr, FixedDamageAttr, PostVictoryStatChangeAttr, OneHitKOAccuracyAttr, ForceSwitchOutAttr, VariableTargetAttr, SacrificialAttr, IncrementMovePriorityAttr } from "./data/move"; import { Mode } from './ui/ui'; import { Command } from "./ui/command-ui-handler"; import { Stat } from "./data/pokemon-stat"; @@ -906,7 +906,7 @@ export class EncounterPhase extends BattlePhase { const showDialogueAndSummon = () => { let message: string; this.scene.executeWithSeedOffset(() => message = Utils.randSeedItem(encounterMessages), this.scene.currentBattle.waveIndex); - this.scene.ui.showDialogue(message, trainer.getName(), null, () => { + this.scene.ui.showDialogue(message, trainer.getName(TrainerSlot.NONE,true), null, () => { this.scene.charSprite.hide().then(() => this.scene.hideFieldOverlay(250).then(() => doSummon())); }); }; @@ -1809,7 +1809,7 @@ export class CommandPhase extends FieldPhase { const trapped = new Utils.BooleanHolder(false); const batonPass = isSwitch && args[0] as boolean; if (!batonPass) - enemyField.forEach(enemyPokemon => applyCheckTrappedAbAttrs(CheckTrappedAbAttr, enemyPokemon, trapped)); + enemyField.forEach(enemyPokemon => applyCheckTrappedAbAttrs(CheckTrappedAbAttr, enemyPokemon, trapped, playerPokemon)); if (batonPass || (!trapTag && !trapped.value)) { this.scene.currentBattle.turnCommands[this.fieldIndex] = isSwitch ? { command: Command.POKEMON, cursor: cursor, args: args } @@ -1914,7 +1914,7 @@ export class EnemyCommandPhase extends FieldPhase { const trapTag = enemyPokemon.findTag(t => t instanceof TrappedTag) as TrappedTag; const trapped = new Utils.BooleanHolder(false); - opponents.forEach(playerPokemon => applyCheckTrappedAbAttrs(CheckTrappedAbAttr, playerPokemon, trapped)); + opponents.forEach(playerPokemon => applyCheckTrappedAbAttrs(CheckTrappedAbAttr, playerPokemon, trapped, enemyPokemon)); if (!trapTag && !trapped.value) { const partyMemberScores = trainer.getPartyMemberMatchupScores(enemyPokemon.trainerSlot, true); @@ -2012,6 +2012,9 @@ export class TurnStartPhase extends FieldPhase { const aPriority = new Utils.IntegerHolder(aMove.priority); const bPriority = new Utils.IntegerHolder(bMove.priority); + applyMoveAttrs(IncrementMovePriorityAttr,this.scene.getField().find(p => p?.isActive() && p.getBattlerIndex() === a),null,aMove,aPriority); + applyMoveAttrs(IncrementMovePriorityAttr,this.scene.getField().find(p => p?.isActive() && p.getBattlerIndex() === b),null,bMove,bPriority); + applyAbAttrs(IncrementMovePriorityAbAttr, this.scene.getField().find(p => p?.isActive() && p.getBattlerIndex() === a), null, aMove, aPriority); applyAbAttrs(IncrementMovePriorityAbAttr, this.scene.getField().find(p => p?.isActive() && p.getBattlerIndex() === b), null, bMove, bPriority); @@ -3045,7 +3048,8 @@ export class PostTurnStatusEffectPhase extends PokemonPhase { break; } if (damage) { - this.scene.damageNumberHandler.add(this.getPokemon(), pokemon.damage(damage)); + // Set preventEndure flag to avoid pokemon surviving thanks to focus band, sturdy, endure ... + this.scene.damageNumberHandler.add(this.getPokemon(), pokemon.damage(damage, false, true)); pokemon.updateInfo(); } new CommonBattleAnim(CommonAnim.POISON + (pokemon.status.effect - 1), pokemon).play(this.scene, () => this.end()); @@ -3840,6 +3844,10 @@ export class SwitchPhase extends BattlePhase { if (this.isModal && !this.scene.getParty().filter(p => !p.isFainted() && !p.isActive(true)).length) return super.end(); + // Check if there is any space still in field + if (this.isModal && this.scene.getPlayerField().filter(p => !p.isFainted() && p.isActive(true)).length >= this.scene.currentBattle.getBattlerCount()) + return super.end(); + // Override field index to 0 in case of double battle where 2/3 remaining party members fainted at once const fieldIndex = this.scene.currentBattle.getBattlerCount() === 1 || this.scene.getParty().filter(p => !p.isFainted()).length > 1 ? this.fieldIndex : 0; @@ -4349,6 +4357,7 @@ export class AttemptCapturePhase extends PokemonPhase { scale: 1 }); + this.scene.currentBattle.lastUsedPokeball = this.pokeballType; this.removePb(); this.end(); } diff --git a/src/plugins/i18n.ts b/src/plugins/i18n.ts index 790a3c729c8..29e28f60f39 100644 --- a/src/plugins/i18n.ts +++ b/src/plugins/i18n.ts @@ -153,6 +153,7 @@ declare module 'i18next' { modifierType: ModifierTypeTranslationEntries; battleMessageUiHandler: SimpleTranslationEntries; berry: BerryTranslationEntries; + voucher: SimpleTranslationEntries; }; } } diff --git a/src/system/settings.ts b/src/system/settings.ts index 15c1f19aa04..aa2f4f5c682 100644 --- a/src/system/settings.ts +++ b/src/system/settings.ts @@ -178,11 +178,17 @@ export function setSetting(scene: BattleScene, setting: Setting, value: integer) scene.ui.revertMode(); (scene.ui.getHandler() as SettingsUiHandler).setOptionCursor(Object.values(Setting).indexOf(Setting.Language), 0, true); }; - const changeLocaleHandler = (locale: string) => { - i18next.changeLanguage(locale); - localStorage.setItem('prLang', locale); - cancelHandler(); - scene.reset(true, false, true); + const changeLocaleHandler = (locale: string): boolean => { + try { + i18next.changeLanguage(locale); + localStorage.setItem('prLang', locale); + cancelHandler(); + scene.reset(true, false, true); + return true; + } catch (error) { + console.error('Error changing locale:', error); + return false; + } }; scene.ui.setOverlayMode(Mode.OPTION_SELECT, { options: [ diff --git a/src/system/voucher.ts b/src/system/voucher.ts index 276e74eeb0d..507c14b5bfe 100644 --- a/src/system/voucher.ts +++ b/src/system/voucher.ts @@ -2,6 +2,7 @@ import BattleScene from "../battle-scene"; import { TrainerType } from "../data/enums/trainer-type"; import { ModifierTier } from "../modifier/modifier-tier"; import { Achv, AchvTier, achvs } from "./achv"; +import i18next from '../plugins/i18n'; export enum VoucherType { REGULAR, @@ -52,13 +53,13 @@ export class Voucher { export function getVoucherTypeName(voucherType: VoucherType): string { switch (voucherType) { case VoucherType.REGULAR: - return 'Egg Voucher'; + return i18next.t("voucher:eggVoucher"); case VoucherType.PLUS: - return 'Egg Voucher Plus'; + return i18next.t("voucher:eggVoucherPlus"); case VoucherType.PREMIUM: - return 'Egg Voucher Premium'; + return i18next.t("voucher:eggVoucherPremium"); case VoucherType.GOLDEN: - return 'Egg Voucher Gold'; + return i18next.t("voucher:eggVoucherGold"); } } @@ -75,9 +76,8 @@ export function getVoucherTypeIcon(voucherType: VoucherType): string { } } - export interface Vouchers { - [key: string]: Voucher + [key: string]: Voucher; } export const vouchers: Vouchers = {}; @@ -87,6 +87,8 @@ const voucherAchvs: Achv[] = [ achvs.CLASSIC_VICTORY ]; { (function() { import('../data/trainer-config').then(tc => { + const trainerConfigs = tc.trainerConfigs; + for (let achv of voucherAchvs) { const voucherType = achv.score >= 150 ? VoucherType.GOLDEN @@ -98,7 +100,6 @@ const voucherAchvs: Achv[] = [ achvs.CLASSIC_VICTORY ]; vouchers[achv.id] = new Voucher(voucherType, achv.description); } - const trainerConfigs = tc.trainerConfigs; const bossTrainerTypes = Object.keys(trainerConfigs) .filter(tt => trainerConfigs[tt].isBoss && trainerConfigs[tt].getDerivedType() !== TrainerType.RIVAL); @@ -107,12 +108,17 @@ const voucherAchvs: Achv[] = [ achvs.CLASSIC_VICTORY ]; ? VoucherType.PLUS : VoucherType.PREMIUM; const key = TrainerType[trainerType]; - vouchers[key] = new Voucher(voucherType, `Defeat ${trainerConfigs[trainerType].name}`); + const trainerName = trainerConfigs[trainerType].name; + vouchers[key] = new Voucher( + voucherType, + i18next.t("voucher:defeatTrainer", { trainerName }) + ); } const voucherKeys = Object.keys(vouchers); - for (let k of voucherKeys) + for (let k of voucherKeys) { vouchers[k].id = k; + } }); })(); -} \ No newline at end of file +} diff --git a/src/ui/daily-run-scoreboard.ts b/src/ui/daily-run-scoreboard.ts index 8b258b3a702..139a6d60cd7 100644 --- a/src/ui/daily-run-scoreboard.ts +++ b/src/ui/daily-run-scoreboard.ts @@ -30,13 +30,34 @@ export class DailyRunScoreboard extends Phaser.GameObjects.Container { private pageCount: integer; private page: integer; private category: ScoreboardCategory; + + private _isUpdating: boolean; constructor(scene: BattleScene, x: number, y: number) { super(scene, x, y); + this._isUpdating = false; this.setup(); } + /** + * Sets the updating state and updates button states accordingly. + * If value is true (updating), disables the buttons; if false, enables the buttons. + * @param {boolean} value - The new updating state. + */ + set isUpdating(value) { + this._isUpdating = value; + this.setButtonsState(!value); + } + + /** + * Gets the current updating state. + * @returns {boolean} - The current updating state. + */ + get isUpdating() { + return this._isUpdating; + } + setup() { const titleWindow = addWindow(this.scene, 0, 0, 114, 18, false, false, null, null, WindowVariant.THIN); this.add(titleWindow); @@ -140,7 +161,24 @@ export class DailyRunScoreboard extends Phaser.GameObjects.Container { }); } + /** + * Updates the scoreboard rankings based on the selected category and page. + * + * If the update process is already ongoing, the method exits early. Otherwise, it begins the update process by clearing + * the current rankings and showing a loading label. If the category changes, the page is reset to 1. + * + * The method fetches the total page count if necessary, followed by fetching the rankings for the specified category + * and page. It updates the UI with the fetched rankings or shows an appropriate message if no rankings are found. + * + * @param {ScoreboardCategory} [category=this.category] - The category to fetch rankings for. Defaults to the current category. + * @param {number} [page=this.page] - The page number to fetch. Defaults to the current page. + */ update(category: ScoreboardCategory = this.category, page: integer = this.page) { + if (this.isUpdating) { + return; + } + + this.isUpdating = true; this.rankingsContainer.removeAll(true); this.loadingLabel.setText(i18next.t('menu:loading')); @@ -150,7 +188,7 @@ export class DailyRunScoreboard extends Phaser.GameObjects.Container { this.page = page = 1; Utils.executeIf(category !== this.category || this.pageCount === undefined, - () => Utils.apiFetch(`daily/rankingpagecount?category=${category}`).then(response => response.json()).then(count => this.pageCount = count) + () => Utils.apiFetch(`daily/rankingpagecount?category=${category}`).then(response => response.json()).then(count => this.pageCount = count) ).then(() => { Utils.apiFetch(`daily/rankings?category=${category}&page=${page}`) .then(response => response.json()) @@ -158,16 +196,40 @@ export class DailyRunScoreboard extends Phaser.GameObjects.Container { this.page = page; this.category = category; this.titleLabel.setText(`${i18next.t(`menu:${ScoreboardCategory[category].toLowerCase()}Rankings`)}`); - this.prevPageButton.setAlpha(page > 1 ? 1 : 0.5); - this.nextPageButton.setAlpha(page < this.pageCount ? 1 : 0.5); this.pageNumberLabel.setText(page.toString()); if (jsonResponse) { this.loadingLabel.setVisible(false); this.updateRankings(jsonResponse); } else this.loadingLabel.setText(i18next.t('menu:noRankings')); + }).finally(() => { + this.isUpdating = false; }); - }).catch(err => { console.error("Failed to load daily rankings:\n", err) }); + }).catch(err => { + console.error("Failed to load daily rankings:\n", err) + }) + } + + /** + * Sets the state of the navigation buttons. + * @param {boolean} [enabled=true] - Whether the buttons should be enabled or disabled. + */ + setButtonsState(enabled: boolean = true) { + const buttons = [ + { button: this.prevPageButton, alphaValue: enabled ? (this.page > 1 ? 1 : 0.5) : 0.5 }, + { button: this.nextPageButton, alphaValue: enabled ? (this.page < this.pageCount ? 1 : 0.5) : 0.5 }, + { button: this.nextCategoryButton, alphaValue: enabled ? 1 : 0.5 }, + { button: this.prevCategoryButton, alphaValue: enabled ? 1 : 0.5 } + ]; + + buttons.forEach(({ button, alphaValue }) => { + if (enabled) { + button.setInteractive(); + } else { + button.disableInteractive(); + } + button.setAlpha(alphaValue); + }); } } diff --git a/src/ui/party-ui-handler.ts b/src/ui/party-ui-handler.ts index 8b497655a17..253ed8b4b72 100644 --- a/src/ui/party-ui-handler.ts +++ b/src/ui/party-ui-handler.ts @@ -24,6 +24,7 @@ export enum PartyUiMode { SWITCH, FAINT_SWITCH, POST_BATTLE_SWITCH, + REVIVAL_BLESSING, MODIFIER, MOVE_MODIFIER, TM_MODIFIER, @@ -37,6 +38,7 @@ export enum PartyOption { CANCEL = -1, SEND_OUT, PASS_BATON, + REVIVE, APPLY, TEACH, TRANSFER, @@ -103,6 +105,12 @@ export default class PartyUiHandler extends MessageUiHandler { return null; }; + public static FilterFainted = (pokemon: PlayerPokemon) => { + if(!pokemon.isFainted()) + return `${pokemon.name} still has energy\nto battle!`; + return null; + } + private static FilterAllMoves = (_pokemonMove: PokemonMove) => null; public static FilterItemMaxStacks = (pokemon: PlayerPokemon, modifier: PokemonHeldItemModifier) => { @@ -361,7 +369,7 @@ export default class PartyUiHandler extends MessageUiHandler { if (this.cursor < 6) { this.showOptions(); ui.playSelect(); - } else if (this.partyUiMode === PartyUiMode.FAINT_SWITCH) + } else if (this.partyUiMode === PartyUiMode.FAINT_SWITCH || this.partyUiMode === PartyUiMode.REVIVAL_BLESSING) ui.playError(); else return this.processInput(Button.CANCEL); @@ -370,7 +378,7 @@ export default class PartyUiHandler extends MessageUiHandler { if ((this.partyUiMode === PartyUiMode.MODIFIER_TRANSFER || this.partyUiMode === PartyUiMode.SPLICE) && this.transferMode) { this.clearTransfer(); ui.playSelect(); - } else if (this.partyUiMode !== PartyUiMode.FAINT_SWITCH) { + } else if (this.partyUiMode !== PartyUiMode.FAINT_SWITCH && this.partyUiMode !== PartyUiMode.REVIVAL_BLESSING) { if (this.selectCallback) { const selectCallback = this.selectCallback; this.selectCallback = null; @@ -580,6 +588,9 @@ export default class PartyUiHandler extends MessageUiHandler { this.options.push(PartyOption.FORM_CHANGE_ITEM + i); } break; + case PartyUiMode.REVIVAL_BLESSING: + this.options.push(PartyOption.REVIVE); + break; case PartyUiMode.MODIFIER: this.options.push(PartyOption.APPLY); break; diff --git a/src/ui/starter-select-ui-handler.ts b/src/ui/starter-select-ui-handler.ts index a20f3a3647f..b0321946e9b 100644 --- a/src/ui/starter-select-ui-handler.ts +++ b/src/ui/starter-select-ui-handler.ts @@ -42,48 +42,65 @@ export interface Starter { pokerus: boolean; } +interface LanguageSetting { + starterInfoTextSize: string, + instructionTextSize: string, + starterInfoXPos?: integer, + starterInfoYOffset?: integer +} + +const languageSettings: { [key: string]: LanguageSetting } = { + "en":{ + starterInfoTextSize: '56px', + instructionTextSize: '42px', + }, + "de":{ + starterInfoTextSize: '56px', + instructionTextSize: '35px', + }, + "es":{ + starterInfoTextSize: '56px', + instructionTextSize: '35px', + }, + "it":{ + starterInfoTextSize: '56px', + instructionTextSize: '38px', + }, + "fr":{ + starterInfoTextSize: '54px', + instructionTextSize: '42px', + }, + "zh_CN":{ + starterInfoTextSize: '40px', + instructionTextSize: '42px', + starterInfoYOffset: 2 + }, + "pt_BR":{ + starterInfoTextSize: '47px', + instructionTextSize: '38px', + starterInfoXPos: 32, + }, +} + +const starterCandyCosts: { passive: integer, costReduction: [integer, integer] }[] = [ + { passive: 50, costReduction: [30, 75] }, // 1 + { passive: 45, costReduction: [25, 60] }, // 2 + { passive: 30, costReduction: [20, 50] }, // 3 + { passive: 25, costReduction: [15, 40] }, // 4 + { passive: 20, costReduction: [12, 35] }, // 5 + { passive: 15, costReduction: [10, 30] }, // 6 + { passive: 10, costReduction: [8, 20] }, // 7 + { passive: 10, costReduction: [5, 15] }, // 8 + { passive: 10, costReduction: [3, 10] }, // 9 + { passive: 10, costReduction: [3, 10] }, // 10 +] + function getPassiveCandyCount(baseValue: integer): integer { - switch (baseValue) { - case 1: - return 50; - case 2: - return 45; - case 3: - return 40; - case 4: - return 30; - case 5: - return 25; - case 6: - return 20; - case 7: - return 15; - default: - return 10; - } + return starterCandyCosts[baseValue - 1].passive; } function getValueReductionCandyCounts(baseValue: integer): [integer, integer] { - switch (baseValue) { - case 1: - return [ 30, 75]; - case 2: - return [ 25, 60 ]; - case 3: - return [ 20, 50 ]; - case 4: - return [ 15, 40 ]; - case 5: - return [ 12, 35 ]; - case 6: - return [ 10, 30 ]; - case 7: - return [ 8, 20 ]; - case 8: - return [ 5, 15 ]; - default: - return [ 3, 10 ]; - } + return starterCandyCosts[baseValue - 1].costReduction; } const gens = [ @@ -199,6 +216,8 @@ export default class StarterSelectUiHandler extends MessageUiHandler { setup() { const ui = this.getUi(); + const currentLanguage = i18next.language; + const textSettings = languageSettings[currentLanguage]; this.starterSelectContainer = this.scene.add.container(0, -this.scene.game.canvas.height / 6); this.starterSelectContainer.setVisible(false); @@ -255,54 +274,38 @@ export default class StarterSelectUiHandler extends MessageUiHandler { this.pokemonUncaughtText.setOrigin(0, 0); this.starterSelectContainer.add(this.pokemonUncaughtText); - let starterInfoXPosition = 31; // Only text + // The position should be set per language - const currentLanguage = i18next.language; - switch (currentLanguage) { - case 'pt_BR': - starterInfoXPosition = 32; - break; - default: - starterInfoXPosition = 31; - break - } + let starterInfoXPos = textSettings?.starterInfoXPos || 31; + let starterInfoYOffset = textSettings?.starterInfoYOffset || 0; - let starterInfoTextSize = '56px'; // Labels and text // The font size should be set per language - // currentLanguage is already defined - switch (currentLanguage) { - case 'pt_BR': - starterInfoTextSize = '47px'; - break; - default: - starterInfoTextSize = '56px'; - break - } + let starterInfoTextSize = textSettings.starterInfoTextSize; - this.pokemonAbilityLabelText = addTextObject(this.scene, 6, 127, i18next.t("starterSelectUiHandler:ability"), TextStyle.SUMMARY_ALT, { fontSize: starterInfoTextSize }); + this.pokemonAbilityLabelText = addTextObject(this.scene, 6, 127 + starterInfoYOffset, i18next.t("starterSelectUiHandler:ability"), TextStyle.SUMMARY_ALT, { fontSize: starterInfoTextSize }); this.pokemonAbilityLabelText.setOrigin(0, 0); this.pokemonAbilityLabelText.setVisible(false); this.starterSelectContainer.add(this.pokemonAbilityLabelText); - this.pokemonAbilityText = addTextObject(this.scene, starterInfoXPosition, 127, '', TextStyle.SUMMARY_ALT, { fontSize: starterInfoTextSize }); + this.pokemonAbilityText = addTextObject(this.scene, starterInfoXPos, 127 + starterInfoYOffset, '', TextStyle.SUMMARY_ALT, { fontSize: starterInfoTextSize }); this.pokemonAbilityText.setOrigin(0, 0); this.starterSelectContainer.add(this.pokemonAbilityText); - this.pokemonPassiveLabelText = addTextObject(this.scene, 6, 136, i18next.t("starterSelectUiHandler:passive"), TextStyle.SUMMARY_ALT, { fontSize: starterInfoTextSize }); + this.pokemonPassiveLabelText = addTextObject(this.scene, 6, 136 + starterInfoYOffset, i18next.t("starterSelectUiHandler:passive"), TextStyle.SUMMARY_ALT, { fontSize: starterInfoTextSize }); this.pokemonPassiveLabelText.setOrigin(0, 0); this.pokemonPassiveLabelText.setVisible(false); this.starterSelectContainer.add(this.pokemonPassiveLabelText); - this.pokemonPassiveText = addTextObject(this.scene, starterInfoXPosition, 136, '', TextStyle.SUMMARY_ALT, { fontSize: starterInfoTextSize }); + this.pokemonPassiveText = addTextObject(this.scene, starterInfoXPos, 136 + starterInfoYOffset, '', TextStyle.SUMMARY_ALT, { fontSize: starterInfoTextSize }); this.pokemonPassiveText.setOrigin(0, 0); this.starterSelectContainer.add(this.pokemonPassiveText); - this.pokemonNatureLabelText = addTextObject(this.scene, 6, 145, i18next.t("starterSelectUiHandler:nature"), TextStyle.SUMMARY_ALT, { fontSize: starterInfoTextSize }); + this.pokemonNatureLabelText = addTextObject(this.scene, 6, 145 + starterInfoYOffset, i18next.t("starterSelectUiHandler:nature"), TextStyle.SUMMARY_ALT, { fontSize: starterInfoTextSize }); this.pokemonNatureLabelText.setOrigin(0, 0); this.pokemonNatureLabelText.setVisible(false); this.starterSelectContainer.add(this.pokemonNatureLabelText); - this.pokemonNatureText = addBBCodeTextObject(this.scene, starterInfoXPosition, 145, '', TextStyle.SUMMARY_ALT, { fontSize: starterInfoTextSize }); + this.pokemonNatureText = addBBCodeTextObject(this.scene, starterInfoXPos, 145 + starterInfoYOffset, '', TextStyle.SUMMARY_ALT, { fontSize: starterInfoTextSize }); this.pokemonNatureText.setOrigin(0, 0); this.starterSelectContainer.add(this.pokemonNatureText); @@ -586,36 +589,8 @@ export default class StarterSelectUiHandler extends MessageUiHandler { this.starterSelectContainer.add(this.pokemonEggMovesContainer); - - - let instructionTextSize = '42px'; // The font size should be set per language - // currentLanguage is already defined in the previous code block - switch (currentLanguage) { - case 'de': - instructionTextSize = '35px'; - break; - case 'en': - instructionTextSize = '42px'; - break; - case 'es': - instructionTextSize = '35px'; - break; - case 'fr': - instructionTextSize = '42px'; - break; - case 'it': - instructionTextSize = '38px'; - break; - case 'pt_BR': - instructionTextSize = '38px'; - break; - case 'zh_CN': - instructionTextSize = '42px'; - break; - - } - + let instructionTextSize = textSettings.instructionTextSize; this.instructionsText = addTextObject(this.scene, 4, 156, '', TextStyle.PARTY, { fontSize: instructionTextSize }); this.starterSelectContainer.add(this.instructionsText); diff --git a/src/ui/summary-ui-handler.ts b/src/ui/summary-ui-handler.ts index 943679cae39..0655880d271 100644 --- a/src/ui/summary-ui-handler.ts +++ b/src/ui/summary-ui-handler.ts @@ -494,20 +494,16 @@ export default class SummaryUiHandler extends UiHandler { } break; case Button.LEFT: - if (this.summaryUiMode === SummaryUiMode.LEARN_MOVE) - break; if (this.cursor) success = this.setCursor(this.cursor - 1); break; case Button.RIGHT: - if (this.summaryUiMode === SummaryUiMode.LEARN_MOVE) { - this.setCursor(Page.MOVES); - this.moveSelect = true; - success = true; - break; - } - if (this.cursor < pages.length - 1) + if (this.cursor < pages.length - 1) { success = this.setCursor(this.cursor + 1); + if (this.summaryUiMode === SummaryUiMode.LEARN_MOVE && this.cursor === Page.MOVES) { + this.moveSelect = true; + } + } break; } } @@ -614,13 +610,7 @@ export default class SummaryUiHandler extends UiHandler { onComplete: () => { if (forward){ this.populatePageContainer(this.summaryPageContainer); - if (this.summaryUiMode === SummaryUiMode.LEARN_MOVE) { - this.moveCursorObj = null; - this.extraMoveRowContainer.setVisible(true); - this.setCursor(0, true); - this.showMoveEffect(); - } - else if (this.cursor===Page.MOVES) { + if (this.cursor===Page.MOVES) { this.moveCursorObj = null; this.showMoveSelect(); this.showMoveEffect(); diff --git a/src/ui/text.ts b/src/ui/text.ts index d7ecd3b2526..8be46b1b238 100644 --- a/src/ui/text.ts +++ b/src/ui/text.ts @@ -4,6 +4,7 @@ import { ModifierTier } from "../modifier/modifier-tier"; import { EggTier } from "../data/enums/egg-type"; import BattleScene from "../battle-scene"; import { UiTheme } from "../enums/ui-theme"; +import i18next from "i18next"; export enum TextStyle { MESSAGE, @@ -28,6 +29,25 @@ export enum TextStyle { MOVE_INFO_CONTENT }; +interface LanguageSetting { + summaryFontSize?: string, + battleInfoFontSize?: string, + partyFontSize?: string, + tooltipContentFontSize?: string, + moveInfoFontSize?: string, + textScale?: number +} + +const languageSettings: { [key: string]: LanguageSetting } = { + "en":{}, + "de":{}, + "es":{}, + "it":{}, + "fr":{}, + "zh_CN":{}, + "pt_BR":{}, +} + export function addTextObject(scene: Phaser.Scene, x: number, y: number, content: string, style: TextStyle, extraStyleOptions?: Phaser.Types.GameObjects.Text.TextStyle): Phaser.GameObjects.Text { const [ styleOptions, shadowColor, shadowSize ] = getTextStyleOptions(style, (scene as BattleScene).uiTheme, extraStyleOptions); @@ -64,6 +84,7 @@ export function addTextInputObject(scene: Phaser.Scene, x: number, y: number, wi } function getTextStyleOptions(style: TextStyle, uiTheme: UiTheme, extraStyleOptions?: Phaser.Types.GameObjects.Text.TextStyle): [ Phaser.Types.GameObjects.Text.TextStyle | InputText.IConfig, string, integer ] { + const lang = i18next.language; let shadowColor: string; let shadowSize = 6; @@ -90,25 +111,25 @@ function getTextStyleOptions(style: TextStyle, uiTheme: UiTheme, extraStyleOptio case TextStyle.MESSAGE: case TextStyle.SETTINGS_LABEL: case TextStyle.SETTINGS_SELECTED: - styleOptions.fontSize = '96px'; + styleOptions.fontSize = languageSettings[lang]?.summaryFontSize || '96px'; break; case TextStyle.BATTLE_INFO: case TextStyle.MONEY: case TextStyle.TOOLTIP_TITLE: - styleOptions.fontSize = '72px'; + styleOptions.fontSize = languageSettings[lang]?.battleInfoFontSize || '72px'; shadowSize = 4.5; break; case TextStyle.PARTY: case TextStyle.PARTY_RED: + styleOptions.fontSize = languageSettings[lang]?.partyFontSize || '66px'; styleOptions.fontFamily = 'pkmnems'; - styleOptions.fontSize = '66px'; break; case TextStyle.TOOLTIP_CONTENT: - styleOptions.fontSize = '64px'; + styleOptions.fontSize = languageSettings[lang]?.tooltipContentFontSize || '64px'; shadowSize = 4; break; case TextStyle.MOVE_INFO_CONTENT: - styleOptions.fontSize = '56px'; + styleOptions.fontSize = languageSettings[lang]?.moveInfoFontSize || '56px'; shadowSize = 3; break; } diff --git a/src/ui/vouchers-ui-handler.ts b/src/ui/vouchers-ui-handler.ts index e28e211ee53..55f3ac224aa 100644 --- a/src/ui/vouchers-ui-handler.ts +++ b/src/ui/vouchers-ui-handler.ts @@ -5,6 +5,7 @@ import { TextStyle, addTextObject } from "./text"; import { Mode } from "./ui"; import { addWindow } from "./ui-theme"; import {Button} from "../enums/buttons"; +import i18next from '../plugins/i18n'; const itemRows = 4; const itemCols = 17; @@ -40,7 +41,7 @@ export default class VouchersUiHandler extends MessageUiHandler { const headerBg = addWindow(this.scene, 0, 0, (this.scene.game.canvas.width / 6) - 2, 24); headerBg.setOrigin(0, 0); - const headerText = addTextObject(this.scene, 0, 0, 'Vouchers', TextStyle.SETTINGS_LABEL); + const headerText = addTextObject(this.scene, 0, 0, i18next.t("voucher:vouchers"), TextStyle.SETTINGS_LABEL); headerText.setOrigin(0, 0); headerText.setPositionRelative(headerBg, 8, 4); @@ -127,7 +128,7 @@ export default class VouchersUiHandler extends MessageUiHandler { this.titleText.setText(getVoucherTypeName(voucher.voucherType)); this.showText(voucher.description); - this.unlockText.setText(unlocked ? new Date(voucherUnlocks[voucher.id]).toLocaleDateString() : 'Locked'); + this.unlockText.setText(unlocked ? new Date(voucherUnlocks[voucher.id]).toLocaleDateString() : i18next.t("voucher:locked")); } processInput(button: Button): boolean { @@ -246,4 +247,4 @@ export default class VouchersUiHandler extends MessageUiHandler { this.cursorObj.destroy(); this.cursorObj = null; } -} \ No newline at end of file +}