Compare commits

...

9 Commits

Author SHA1 Message Date
cam
03ba575ee5
[Sprite] Wo-Chien back sprite (#3307)
* [Fix][Sprite] 4083 Galarian Farfetch'd exp

Fixed cropped feet on exp for default & shiny.
Rearranged spritesheet to fit new size.
Both sritesheets have identical sprite framing.
Both json are identical.

* [Fix][Sprite] 1001 Wo-Chien exp fix

cleaned up tips of antlers
slightly improved back sprite
default + shiny. identical json, identical framing
2024-08-02 17:12:06 -04:00
AJ Fontaine
263924feda
[Item] Adjust White Herb weight and add Scope Lens to trainer item pool (#3308) 2024-08-02 17:11:54 -04:00
Frederico Santos
9f68ba8671 null or undefined? who knows. 2024-08-02 21:02:24 +01:00
Frederico Santos
2f83e6e2e1 explicit check for options 2024-08-02 19:28:05 +01:00
Frederico Santos
0d406b1092 hotfix cursor selection 2024-08-02 19:20:17 +01:00
Frederico Santos
3a87c8657f
Disable egg gacha in rewards (#3304)
* chore: Refactor excludedMenus logic in MenuUiHandler

* Refactor excludedMenus logic in MenuUiHandler

* Update src/ui/menu-ui-handler.ts

Co-authored-by: flx-sta <50131232+flx-sta@users.noreply.github.com>

* Refactor excludedMenus logic in MenuUiHandler

* chore: Add setup method to MenuUiHandler

* Refactor excludedMenus logic in MenuUiHandler

---------

Co-authored-by: flx-sta <50131232+flx-sta@users.noreply.github.com>
2024-08-02 18:26:49 +01:00
Tempoanon
52ef92ae78
[Enhancement] Add female and double grunts (#3280)
* Add female and double grunts, add localizations

* Update src/locales/fr/trainers.ts

Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr>

* Update src/locales/it/trainers.ts

Co-authored-by: Niccolò <123510358+NicusPulcis@users.noreply.github.com>

* Update src/locales/ko/trainers.ts

Co-authored-by: Enoch <enoch.jwsong@gmail.com>

* Update src/locales/pt_BR/trainers.ts

Co-authored-by: José Ricardo Fleury Oliveira <josefleury@discente.ufg.br>

* Update trainers.ts

---------

Co-authored-by: Lugiad' <adrien.grivel@hotmail.fr>
Co-authored-by: Niccolò <123510358+NicusPulcis@users.noreply.github.com>
Co-authored-by: Enoch <enoch.jwsong@gmail.com>
Co-authored-by: José Ricardo Fleury Oliveira <josefleury@discente.ufg.br>
2024-08-02 13:03:46 -04:00
Tempoanon
e5f458d2c0
[Bug] Fix affixes appearing when they shouldn't (#3236)
* [Hotfix] Fix interactions of some moves not changing types (#3183)

* [Hotfix] Fix wild spawns not having their HA (#3190)

* Fix some cases of wrong affixes

* There are two trainer send out messages

---------

Co-authored-by: Adrian T. <68144167+torranx@users.noreply.github.com>
Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
2024-08-02 13:02:49 -04:00
Amani H.
302f1e51a0
[Enhancement] Allow Starters to Remember Egg Moves (#2482)
* Allow Starters to Remember Egg Moves

* Adjust Documentation

* Minor NIT
2024-08-02 17:51:20 +01:00
19 changed files with 492 additions and 584 deletions

View File

@ -1,272 +1,140 @@
{
"textures": [
{
"image": "1001.png",
"format": "RGBA8888",
"size": {
"w": 237,
"h": 237
},
"scale": 1,
"frames": [
{
"filename": "0001.png",
"rotated": false,
"trimmed": false,
"sourceSize": {
"w": 79,
"h": 79
},
"spriteSourceSize": {
"x": 0,
"y": 0,
"w": 79,
"h": 79
},
"frame": {
"x": 0,
"y": 0,
"w": 79,
"h": 79
}
},
{
"filename": "0002.png",
"rotated": false,
"trimmed": true,
"sourceSize": {
"w": 79,
"h": 79
},
"spriteSourceSize": {
"x": 0,
"y": 1,
"w": 79,
"h": 78
},
"frame": {
"x": 79,
"y": 0,
"w": 79,
"h": 78
}
},
{
"filename": "0012.png",
"rotated": false,
"trimmed": true,
"sourceSize": {
"w": 79,
"h": 79
},
"spriteSourceSize": {
"x": 0,
"y": 1,
"w": 79,
"h": 78
},
"frame": {
"x": 79,
"y": 0,
"w": 79,
"h": 78
}
},
{
"filename": "0003.png",
"rotated": false,
"trimmed": true,
"sourceSize": {
"w": 79,
"h": 79
},
"spriteSourceSize": {
"x": 0,
"y": 3,
"w": 79,
"h": 76
},
"frame": {
"x": 158,
"y": 0,
"w": 79,
"h": 76
}
},
{
"filename": "0011.png",
"rotated": false,
"trimmed": true,
"sourceSize": {
"w": 79,
"h": 79
},
"spriteSourceSize": {
"x": 0,
"y": 3,
"w": 79,
"h": 76
},
"frame": {
"x": 158,
"y": 0,
"w": 79,
"h": 76
}
},
{
"filename": "0004.png",
"rotated": false,
"trimmed": true,
"sourceSize": {
"w": 79,
"h": 79
},
"spriteSourceSize": {
"x": 0,
"y": 4,
"w": 79,
"h": 75
},
"frame": {
"x": 158,
"y": 76,
"w": 79,
"h": 75
}
},
{
"filename": "0010.png",
"rotated": false,
"trimmed": true,
"sourceSize": {
"w": 79,
"h": 79
},
"spriteSourceSize": {
"x": 0,
"y": 4,
"w": 79,
"h": 75
},
"frame": {
"x": 158,
"y": 76,
"w": 79,
"h": 75
}
},
{
"filename": "0005.png",
"rotated": false,
"trimmed": true,
"sourceSize": {
"w": 79,
"h": 79
},
"spriteSourceSize": {
"x": 0,
"y": 5,
"w": 79,
"h": 74
},
"frame": {
"x": 79,
"y": 78,
"w": 79,
"h": 74
}
},
{
"filename": "0009.png",
"rotated": false,
"trimmed": true,
"sourceSize": {
"w": 79,
"h": 79
},
"spriteSourceSize": {
"x": 0,
"y": 5,
"w": 79,
"h": 74
},
"frame": {
"x": 79,
"y": 78,
"w": 79,
"h": 74
}
},
{
"filename": "0006.png",
"rotated": false,
"trimmed": true,
"sourceSize": {
"w": 79,
"h": 79
},
"spriteSourceSize": {
"x": 0,
"y": 6,
"w": 79,
"h": 73
},
"frame": {
"x": 0,
"y": 79,
"w": 79,
"h": 73
}
},
{
"filename": "0008.png",
"rotated": false,
"trimmed": true,
"sourceSize": {
"w": 79,
"h": 79
},
"spriteSourceSize": {
"x": 0,
"y": 6,
"w": 79,
"h": 73
},
"frame": {
"x": 0,
"y": 79,
"w": 79,
"h": 73
}
},
{
"filename": "0007.png",
"rotated": false,
"trimmed": true,
"sourceSize": {
"w": 79,
"h": 79
},
"spriteSourceSize": {
"x": 0,
"y": 7,
"w": 79,
"h": 72
},
"frame": {
"x": 158,
"y": 151,
"w": 79,
"h": 72
}
}
]
}
],
"meta": {
"app": "https://www.codeandweb.com/texturepacker",
"version": "3.0",
"smartupdate": "$TexturePacker:SmartUpdate:2873276355a5ff8fe57d616764a11cb5:5516cfd39964108d480df461b020785f:c8a3fc07f857e38a4f887e43523aab92$"
"textures":[
{
"image": "1001.png",
"format": "RGBA8888",
"size": { "w": 161, "h": 157 },
"scale": 1,
"frames": [
{
"filename": "0001.png",
"rotated": false,
"trimmed": true,
"sourceSize": { "w": 81, "h": 79 },
"spriteSourceSize": { "x": 0, "y": 0, "w": 79, "h": 79 },
"frame": { "x": 80, "y": 78, "w": 79, "h": 79 }
},
{
"filename": "0002.png",
"rotated": false,
"trimmed": true,
"sourceSize": { "w": 81, "h": 79 },
"spriteSourceSize": { "x": 0, "y": 0, "w": 79, "h": 79 },
"frame": { "x": 80, "y": 78, "w": 79, "h": 79 }
},
{
"filename": "0003.png",
"rotated": false,
"trimmed": true,
"sourceSize": { "w": 81, "h": 79 },
"spriteSourceSize": { "x": 0, "y": 0, "w": 79, "h": 79 },
"frame": { "x": 80, "y": 78, "w": 79, "h": 79 }
},
{
"filename": "0004.png",
"rotated": false,
"trimmed": true,
"sourceSize": { "w": 81, "h": 79 },
"spriteSourceSize": { "x": 0, "y": 0, "w": 79, "h": 79 },
"frame": { "x": 80, "y": 78, "w": 79, "h": 79 }
},
{
"filename": "0005.png",
"rotated": false,
"trimmed": true,
"sourceSize": { "w": 81, "h": 79 },
"spriteSourceSize": { "x": 0, "y": 1, "w": 80, "h": 78 },
"frame": { "x": 0, "y": 79, "w": 80, "h": 78 }
},
{
"filename": "0006.png",
"rotated": false,
"trimmed": true,
"sourceSize": { "w": 81, "h": 79 },
"spriteSourceSize": { "x": 0, "y": 1, "w": 80, "h": 78 },
"frame": { "x": 0, "y": 79, "w": 80, "h": 78 }
},
{
"filename": "0007.png",
"rotated": false,
"trimmed": true,
"sourceSize": { "w": 81, "h": 79 },
"spriteSourceSize": { "x": 0, "y": 1, "w": 80, "h": 78 },
"frame": { "x": 0, "y": 79, "w": 80, "h": 78 }
},
{
"filename": "0008.png",
"rotated": false,
"trimmed": true,
"sourceSize": { "w": 81, "h": 79 },
"spriteSourceSize": { "x": 0, "y": 1, "w": 80, "h": 78 },
"frame": { "x": 0, "y": 79, "w": 80, "h": 78 }
},
{
"filename": "0009.png",
"rotated": false,
"trimmed": true,
"sourceSize": { "w": 81, "h": 79 },
"spriteSourceSize": { "x": 0, "y": 1, "w": 81, "h": 78 },
"frame": { "x": 80, "y": 0, "w": 81, "h": 78 }
},
{
"filename": "0010.png",
"rotated": false,
"trimmed": true,
"sourceSize": { "w": 81, "h": 79 },
"spriteSourceSize": { "x": 0, "y": 1, "w": 81, "h": 78 },
"frame": { "x": 80, "y": 0, "w": 81, "h": 78 }
},
{
"filename": "0011.png",
"rotated": false,
"trimmed": true,
"sourceSize": { "w": 81, "h": 79 },
"spriteSourceSize": { "x": 0, "y": 1, "w": 81, "h": 78 },
"frame": { "x": 80, "y": 0, "w": 81, "h": 78 }
},
{
"filename": "0012.png",
"rotated": false,
"trimmed": true,
"sourceSize": { "w": 81, "h": 79 },
"spriteSourceSize": { "x": 0, "y": 1, "w": 81, "h": 78 },
"frame": { "x": 80, "y": 0, "w": 81, "h": 78 }
},
{
"filename": "0013.png",
"rotated": false,
"trimmed": true,
"sourceSize": { "w": 81, "h": 79 },
"spriteSourceSize": { "x": 0, "y": 0, "w": 80, "h": 79 },
"frame": { "x": 0, "y": 0, "w": 80, "h": 79 }
},
{
"filename": "0014.png",
"rotated": false,
"trimmed": true,
"sourceSize": { "w": 81, "h": 79 },
"spriteSourceSize": { "x": 0, "y": 0, "w": 80, "h": 79 },
"frame": { "x": 0, "y": 0, "w": 80, "h": 79 }
},
{
"filename": "0015.png",
"rotated": false,
"trimmed": true,
"sourceSize": { "w": 81, "h": 79 },
"spriteSourceSize": { "x": 0, "y": 0, "w": 80, "h": 79 },
"frame": { "x": 0, "y": 0, "w": 80, "h": 79 }
},
{
"filename": "0016.png",
"rotated": false,
"trimmed": true,
"sourceSize": { "w": 81, "h": 79 },
"spriteSourceSize": { "x": 0, "y": 0, "w": 80, "h": 79 },
"frame": { "x": 0, "y": 0, "w": 80, "h": 79 }
}
]}],
"meta": {"app": "https://www.aseprite.org/","version": "1.3.7-x64"
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

View File

@ -1,272 +1,140 @@
{
"textures": [
{
"image": "1001.png",
"format": "RGBA8888",
"size": {
"w": 237,
"h": 237
},
"scale": 1,
"frames": [
{
"filename": "0001.png",
"rotated": false,
"trimmed": false,
"sourceSize": {
"w": 79,
"h": 79
},
"spriteSourceSize": {
"x": 0,
"y": 0,
"w": 79,
"h": 79
},
"frame": {
"x": 0,
"y": 0,
"w": 79,
"h": 79
}
},
{
"filename": "0002.png",
"rotated": false,
"trimmed": true,
"sourceSize": {
"w": 79,
"h": 79
},
"spriteSourceSize": {
"x": 0,
"y": 1,
"w": 79,
"h": 78
},
"frame": {
"x": 79,
"y": 0,
"w": 79,
"h": 78
}
},
{
"filename": "0012.png",
"rotated": false,
"trimmed": true,
"sourceSize": {
"w": 79,
"h": 79
},
"spriteSourceSize": {
"x": 0,
"y": 1,
"w": 79,
"h": 78
},
"frame": {
"x": 79,
"y": 0,
"w": 79,
"h": 78
}
},
{
"filename": "0003.png",
"rotated": false,
"trimmed": true,
"sourceSize": {
"w": 79,
"h": 79
},
"spriteSourceSize": {
"x": 0,
"y": 3,
"w": 79,
"h": 76
},
"frame": {
"x": 158,
"y": 0,
"w": 79,
"h": 76
}
},
{
"filename": "0011.png",
"rotated": false,
"trimmed": true,
"sourceSize": {
"w": 79,
"h": 79
},
"spriteSourceSize": {
"x": 0,
"y": 3,
"w": 79,
"h": 76
},
"frame": {
"x": 158,
"y": 0,
"w": 79,
"h": 76
}
},
{
"filename": "0004.png",
"rotated": false,
"trimmed": true,
"sourceSize": {
"w": 79,
"h": 79
},
"spriteSourceSize": {
"x": 0,
"y": 4,
"w": 79,
"h": 75
},
"frame": {
"x": 158,
"y": 76,
"w": 79,
"h": 75
}
},
{
"filename": "0010.png",
"rotated": false,
"trimmed": true,
"sourceSize": {
"w": 79,
"h": 79
},
"spriteSourceSize": {
"x": 0,
"y": 4,
"w": 79,
"h": 75
},
"frame": {
"x": 158,
"y": 76,
"w": 79,
"h": 75
}
},
{
"filename": "0005.png",
"rotated": false,
"trimmed": true,
"sourceSize": {
"w": 79,
"h": 79
},
"spriteSourceSize": {
"x": 0,
"y": 5,
"w": 79,
"h": 74
},
"frame": {
"x": 79,
"y": 78,
"w": 79,
"h": 74
}
},
{
"filename": "0009.png",
"rotated": false,
"trimmed": true,
"sourceSize": {
"w": 79,
"h": 79
},
"spriteSourceSize": {
"x": 0,
"y": 5,
"w": 79,
"h": 74
},
"frame": {
"x": 79,
"y": 78,
"w": 79,
"h": 74
}
},
{
"filename": "0006.png",
"rotated": false,
"trimmed": true,
"sourceSize": {
"w": 79,
"h": 79
},
"spriteSourceSize": {
"x": 0,
"y": 6,
"w": 79,
"h": 73
},
"frame": {
"x": 0,
"y": 79,
"w": 79,
"h": 73
}
},
{
"filename": "0008.png",
"rotated": false,
"trimmed": true,
"sourceSize": {
"w": 79,
"h": 79
},
"spriteSourceSize": {
"x": 0,
"y": 6,
"w": 79,
"h": 73
},
"frame": {
"x": 0,
"y": 79,
"w": 79,
"h": 73
}
},
{
"filename": "0007.png",
"rotated": false,
"trimmed": true,
"sourceSize": {
"w": 79,
"h": 79
},
"spriteSourceSize": {
"x": 0,
"y": 7,
"w": 79,
"h": 72
},
"frame": {
"x": 158,
"y": 151,
"w": 79,
"h": 72
}
}
]
}
],
"meta": {
"app": "https://www.codeandweb.com/texturepacker",
"version": "3.0",
"smartupdate": "$TexturePacker:SmartUpdate:83b74b0673ef1ae8346efab60ae89872:f76c930177bf7a296d3f47eb6294ae4f:c8a3fc07f857e38a4f887e43523aab92$"
"textures":[
{
"image": "1001.png",
"format": "RGBA8888",
"size": { "w": 161, "h": 157 },
"scale": 1,
"frames": [
{
"filename": "0001.png",
"rotated": false,
"trimmed": true,
"sourceSize": { "w": 81, "h": 79 },
"spriteSourceSize": { "x": 0, "y": 0, "w": 79, "h": 79 },
"frame": { "x": 80, "y": 78, "w": 79, "h": 79 }
},
{
"filename": "0002.png",
"rotated": false,
"trimmed": true,
"sourceSize": { "w": 81, "h": 79 },
"spriteSourceSize": { "x": 0, "y": 0, "w": 79, "h": 79 },
"frame": { "x": 80, "y": 78, "w": 79, "h": 79 }
},
{
"filename": "0003.png",
"rotated": false,
"trimmed": true,
"sourceSize": { "w": 81, "h": 79 },
"spriteSourceSize": { "x": 0, "y": 0, "w": 79, "h": 79 },
"frame": { "x": 80, "y": 78, "w": 79, "h": 79 }
},
{
"filename": "0004.png",
"rotated": false,
"trimmed": true,
"sourceSize": { "w": 81, "h": 79 },
"spriteSourceSize": { "x": 0, "y": 0, "w": 79, "h": 79 },
"frame": { "x": 80, "y": 78, "w": 79, "h": 79 }
},
{
"filename": "0005.png",
"rotated": false,
"trimmed": true,
"sourceSize": { "w": 81, "h": 79 },
"spriteSourceSize": { "x": 0, "y": 1, "w": 80, "h": 78 },
"frame": { "x": 0, "y": 79, "w": 80, "h": 78 }
},
{
"filename": "0006.png",
"rotated": false,
"trimmed": true,
"sourceSize": { "w": 81, "h": 79 },
"spriteSourceSize": { "x": 0, "y": 1, "w": 80, "h": 78 },
"frame": { "x": 0, "y": 79, "w": 80, "h": 78 }
},
{
"filename": "0007.png",
"rotated": false,
"trimmed": true,
"sourceSize": { "w": 81, "h": 79 },
"spriteSourceSize": { "x": 0, "y": 1, "w": 80, "h": 78 },
"frame": { "x": 0, "y": 79, "w": 80, "h": 78 }
},
{
"filename": "0008.png",
"rotated": false,
"trimmed": true,
"sourceSize": { "w": 81, "h": 79 },
"spriteSourceSize": { "x": 0, "y": 1, "w": 80, "h": 78 },
"frame": { "x": 0, "y": 79, "w": 80, "h": 78 }
},
{
"filename": "0009.png",
"rotated": false,
"trimmed": true,
"sourceSize": { "w": 81, "h": 79 },
"spriteSourceSize": { "x": 0, "y": 1, "w": 81, "h": 78 },
"frame": { "x": 80, "y": 0, "w": 81, "h": 78 }
},
{
"filename": "0010.png",
"rotated": false,
"trimmed": true,
"sourceSize": { "w": 81, "h": 79 },
"spriteSourceSize": { "x": 0, "y": 1, "w": 81, "h": 78 },
"frame": { "x": 80, "y": 0, "w": 81, "h": 78 }
},
{
"filename": "0011.png",
"rotated": false,
"trimmed": true,
"sourceSize": { "w": 81, "h": 79 },
"spriteSourceSize": { "x": 0, "y": 1, "w": 81, "h": 78 },
"frame": { "x": 80, "y": 0, "w": 81, "h": 78 }
},
{
"filename": "0012.png",
"rotated": false,
"trimmed": true,
"sourceSize": { "w": 81, "h": 79 },
"spriteSourceSize": { "x": 0, "y": 1, "w": 81, "h": 78 },
"frame": { "x": 80, "y": 0, "w": 81, "h": 78 }
},
{
"filename": "0013.png",
"rotated": false,
"trimmed": true,
"sourceSize": { "w": 81, "h": 79 },
"spriteSourceSize": { "x": 0, "y": 0, "w": 80, "h": 79 },
"frame": { "x": 0, "y": 0, "w": 80, "h": 79 }
},
{
"filename": "0014.png",
"rotated": false,
"trimmed": true,
"sourceSize": { "w": 81, "h": 79 },
"spriteSourceSize": { "x": 0, "y": 0, "w": 80, "h": 79 },
"frame": { "x": 0, "y": 0, "w": 80, "h": 79 }
},
{
"filename": "0015.png",
"rotated": false,
"trimmed": true,
"sourceSize": { "w": 81, "h": 79 },
"spriteSourceSize": { "x": 0, "y": 0, "w": 80, "h": 79 },
"frame": { "x": 0, "y": 0, "w": 80, "h": 79 }
},
{
"filename": "0016.png",
"rotated": false,
"trimmed": true,
"sourceSize": { "w": 81, "h": 79 },
"spriteSourceSize": { "x": 0, "y": 0, "w": 80, "h": 79 },
"frame": { "x": 0, "y": 0, "w": 80, "h": 79 }
}
]}],
"meta": {"app": "https://www.aseprite.org/","version": "1.3.7-x64"
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

View File

@ -425,7 +425,13 @@ export class FixedBattleConfig {
}
}
function getRandomTrainerFunc(trainerPool: (TrainerType | TrainerType[])[]): GetTrainerFunc {
/**
* Helper function to generate a random trainer for evil team trainers and the elite 4/champion
* @param trainerPool The TrainerType or list of TrainerTypes that can possibly be generated
* @param randomGender whether or not to randomly (50%) generate a female trainer (for use with evil team grunts)
* @returns the generated trainer
*/
function getRandomTrainerFunc(trainerPool: (TrainerType | TrainerType[])[], randomGender: boolean = false): GetTrainerFunc {
return (scene: BattleScene) => {
const rand = Utils.randSeedInt(trainerPool.length);
const trainerTypes: TrainerType[] = [];
@ -435,11 +441,20 @@ function getRandomTrainerFunc(trainerPool: (TrainerType | TrainerType[])[]): Get
: trainerPoolEntry;
trainerTypes.push(trainerType);
}
// If the trainer type has a double variant, there's a 33% chance of it being a double battle (for now we only allow tate&liza to be double)
if (trainerConfigs[trainerTypes[rand]].trainerTypeDouble && (trainerTypes[rand] === TrainerType.TATE || trainerTypes[rand] === TrainerType.LIZA)) {
return new Trainer(scene, trainerTypes[rand], Utils.randSeedInt(3) ? TrainerVariant.DOUBLE : TrainerVariant.DEFAULT);
let trainerGender = TrainerVariant.DEFAULT;
if (randomGender) {
trainerGender = (Utils.randInt(2) === 0) ? TrainerVariant.FEMALE : TrainerVariant.DEFAULT;
}
return new Trainer(scene, trainerTypes[rand], TrainerVariant.DEFAULT);
/* 1/3 chance for evil team grunts to be double battles */
const evilTeamGrunts = [TrainerType.ROCKET_GRUNT, TrainerType.MAGMA_GRUNT, TrainerType.AQUA_GRUNT, TrainerType.GALACTIC_GRUNT, TrainerType.PLASMA_GRUNT, TrainerType.FLARE_GRUNT];
const isEvilTeamGrunt = evilTeamGrunts.includes(trainerTypes[rand]);
if (trainerConfigs[trainerTypes[rand]].hasDouble && isEvilTeamGrunt) {
return new Trainer(scene, trainerTypes[rand], (Utils.randInt(3) === 0) ? TrainerVariant.DOUBLE : trainerGender);
}
return new Trainer(scene, trainerTypes[rand], trainerGender);
};
}
@ -462,21 +477,21 @@ export const classicFixedBattles: FixedBattleConfigs = {
[25]: new FixedBattleConfig().setBattleType(BattleType.TRAINER)
.setGetTrainerFunc(scene => new Trainer(scene, TrainerType.RIVAL_2, scene.gameData.gender === PlayerGender.MALE ? TrainerVariant.FEMALE : TrainerVariant.DEFAULT)),
[35]: new FixedBattleConfig().setBattleType(BattleType.TRAINER)
.setGetTrainerFunc(getRandomTrainerFunc([ TrainerType.ROCKET_GRUNT, TrainerType.MAGMA_GRUNT, TrainerType.AQUA_GRUNT, TrainerType.GALACTIC_GRUNT, TrainerType.PLASMA_GRUNT, TrainerType.FLARE_GRUNT ])),
.setGetTrainerFunc(getRandomTrainerFunc([ TrainerType.ROCKET_GRUNT, TrainerType.MAGMA_GRUNT, TrainerType.AQUA_GRUNT, TrainerType.GALACTIC_GRUNT, TrainerType.PLASMA_GRUNT, TrainerType.FLARE_GRUNT ], true)),
[55]: new FixedBattleConfig().setBattleType(BattleType.TRAINER)
.setGetTrainerFunc(scene => new Trainer(scene, TrainerType.RIVAL_3, scene.gameData.gender === PlayerGender.MALE ? TrainerVariant.FEMALE : TrainerVariant.DEFAULT)),
[62]: new FixedBattleConfig().setBattleType(BattleType.TRAINER).setSeedOffsetWave(35)
.setGetTrainerFunc(getRandomTrainerFunc([ TrainerType.ROCKET_GRUNT, TrainerType.MAGMA_GRUNT, TrainerType.AQUA_GRUNT, TrainerType.GALACTIC_GRUNT, TrainerType.PLASMA_GRUNT, TrainerType.FLARE_GRUNT ])),
.setGetTrainerFunc(getRandomTrainerFunc([ TrainerType.ROCKET_GRUNT, TrainerType.MAGMA_GRUNT, TrainerType.AQUA_GRUNT, TrainerType.GALACTIC_GRUNT, TrainerType.PLASMA_GRUNT, TrainerType.FLARE_GRUNT ], true)),
[64]: new FixedBattleConfig().setBattleType(BattleType.TRAINER).setSeedOffsetWave(35)
.setGetTrainerFunc(getRandomTrainerFunc([ TrainerType.ROCKET_GRUNT, TrainerType.MAGMA_GRUNT, TrainerType.AQUA_GRUNT, TrainerType.GALACTIC_GRUNT, TrainerType.PLASMA_GRUNT, TrainerType.FLARE_GRUNT ])),
.setGetTrainerFunc(getRandomTrainerFunc([ TrainerType.ROCKET_GRUNT, TrainerType.MAGMA_GRUNT, TrainerType.AQUA_GRUNT, TrainerType.GALACTIC_GRUNT, TrainerType.PLASMA_GRUNT, TrainerType.FLARE_GRUNT ], true)),
[66]: new FixedBattleConfig().setBattleType(BattleType.TRAINER).setSeedOffsetWave(35)
.setGetTrainerFunc(getRandomTrainerFunc([ TrainerType.ROCKET_GRUNT, TrainerType.MAGMA_GRUNT, TrainerType.AQUA_GRUNT, TrainerType.GALACTIC_GRUNT, TrainerType.PLASMA_GRUNT, TrainerType.FLARE_GRUNT ])),
.setGetTrainerFunc(getRandomTrainerFunc([ TrainerType.ROCKET_GRUNT, TrainerType.MAGMA_GRUNT, TrainerType.AQUA_GRUNT, TrainerType.GALACTIC_GRUNT, TrainerType.PLASMA_GRUNT, TrainerType.FLARE_GRUNT ], true)),
[95]: new FixedBattleConfig().setBattleType(BattleType.TRAINER)
.setGetTrainerFunc(scene => new Trainer(scene, TrainerType.RIVAL_4, scene.gameData.gender === PlayerGender.MALE ? TrainerVariant.FEMALE : TrainerVariant.DEFAULT)),
[112]: new FixedBattleConfig().setBattleType(BattleType.TRAINER).setSeedOffsetWave(35)
.setGetTrainerFunc(getRandomTrainerFunc([ TrainerType.ROCKET_GRUNT, TrainerType.MAGMA_GRUNT, TrainerType.AQUA_GRUNT, TrainerType.GALACTIC_GRUNT, TrainerType.PLASMA_GRUNT, TrainerType.FLARE_GRUNT ])),
.setGetTrainerFunc(getRandomTrainerFunc([ TrainerType.ROCKET_GRUNT, TrainerType.MAGMA_GRUNT, TrainerType.AQUA_GRUNT, TrainerType.GALACTIC_GRUNT, TrainerType.PLASMA_GRUNT, TrainerType.FLARE_GRUNT ], true)),
[114]: new FixedBattleConfig().setBattleType(BattleType.TRAINER).setSeedOffsetWave(35)
.setGetTrainerFunc(getRandomTrainerFunc([ TrainerType.ROCKET_GRUNT, TrainerType.MAGMA_GRUNT, TrainerType.AQUA_GRUNT, TrainerType.GALACTIC_GRUNT, TrainerType.PLASMA_GRUNT, TrainerType.FLARE_GRUNT ])),
.setGetTrainerFunc(getRandomTrainerFunc([ TrainerType.ROCKET_GRUNT, TrainerType.MAGMA_GRUNT, TrainerType.AQUA_GRUNT, TrainerType.GALACTIC_GRUNT, TrainerType.PLASMA_GRUNT, TrainerType.FLARE_GRUNT ], true)),
[115]: new FixedBattleConfig().setBattleType(BattleType.TRAINER).setSeedOffsetWave(35)
.setGetTrainerFunc(getRandomTrainerFunc([ TrainerType.ROCKET_BOSS_GIOVANNI_1, TrainerType.MAXIE, TrainerType.ARCHIE, TrainerType.CYRUS, TrainerType.GHETSIS, TrainerType.LYSANDRE ])),
[145]: new FixedBattleConfig().setBattleType(BattleType.TRAINER)

View File

@ -84,6 +84,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
public friendship: integer;
public metLevel: integer;
public metBiome: Biome | -1;
public metSpecies: Species;
public luck: integer;
public pauseEvolutions: boolean;
public pokerus: boolean;
@ -173,6 +174,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
this.metLevel = dataSource.metLevel || 5;
this.luck = dataSource.luck;
this.metBiome = dataSource.metBiome;
this.metSpecies = dataSource.metSpecies ?? (this.metBiome !== -1 ? this.species.speciesId : this.species.getRootSpeciesId(true));
this.pauseEvolutions = dataSource.pauseEvolutions;
this.pokerus = !!dataSource.pokerus;
this.fusionSpecies = dataSource.fusionSpecies instanceof PokemonSpecies ? dataSource.fusionSpecies : getPokemonSpecies(dataSource.fusionSpecies);
@ -213,6 +215,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
this.friendship = species.baseFriendship;
this.metLevel = level;
this.metBiome = scene.currentBattle ? scene.arena.biomeType : -1;
this.metSpecies = species.speciesId;
this.pokerus = false;
if (level > 1) {
@ -885,11 +888,40 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
}
/**
* All moves that could be relearned by this pokemon at this point. Used for memory mushrooms.
* @returns {Moves[]} The valid moves
* Checks which egg moves have been unlocked for the {@linkcode Pokemon} based
* on the species it was met at or by the first {@linkcode Pokemon} in its evolution
* line that can act as a starter and provides those egg moves.
* @returns an array of {@linkcode Moves}, the length of which is determined by how many
* egg moves are unlocked for that species.
*/
getUnlockedEggMoves(): Moves[] {
const moves: Moves[] = [];
const species = this.metSpecies in speciesEggMoves ? this.metSpecies : this.getSpeciesForm(true).getRootSpeciesId(true);
if (species in speciesEggMoves) {
for (let i = 0; i < 4; i++) {
if (this.scene.gameData.starterData[species].eggMoves & (1 << i)) {
moves.push(speciesEggMoves[species][i]);
}
}
}
return moves;
}
/**
* Gets all possible learnable level moves for the {@linkcode Pokemon},
* excluding any moves already known.
*
* Available egg moves are only included if the {@linkcode Pokemon} was
* in the starting party of the run.
* @returns an array of {@linkcode Moves}, the length of which is determined
* by how many learnable moves there are for the {@linkcode Pokemon}.
*/
getLearnableLevelMoves(): Moves[] {
return this.getLevelMoves(1, true, false, true).map(lm => lm[1]).filter(lm => !this.moveset.filter(m => m.moveId === lm).length).filter((move: Moves, i: integer, array: Moves[]) => array.indexOf(move) === i);
let levelMoves = this.getLevelMoves(1, true).map(lm => lm[1]);
if (this.metBiome === -1) {
levelMoves = this.getUnlockedEggMoves().concat(levelMoves);
}
return levelMoves.filter(lm => !this.moveset.some(m => m.moveId === lm));
}
/**
@ -4075,6 +4107,7 @@ export class EnemyPokemon extends Pokemon {
this.pokeball = pokeballType;
this.metLevel = this.level;
this.metBiome = this.scene.arena.biomeType;
this.metSpecies = this.species.speciesId;
const newPokemon = this.scene.addPlayerPokemon(this.species, this.level, this.abilityIndex, this.formIndex, this.gender, this.shiny, this.variant, this.ivs, this.nature, this);
party.push(newPokemon);
ret = newPokemon;

View File

@ -126,17 +126,23 @@ export const trainerClasses: SimpleTranslationEntries = {
"workers": "Workers",
"youngster": "Youngster",
"rocket_grunt": "Rocket Grunt",
"rocket_grunts": "Rocket Grunts",
"rocket_grunt_female": "Rocket Grunt",
"magma_grunt": "Magma Grunt",
"magma_grunt_female": "Magma Grunt",
"magma_grunts": "Magma Grunts",
"aqua_grunt": "Aqua Grunt",
"aqua_grunt_female": "Aqua Grunt",
"aqua_grunts": "Aqua Grunts",
"galactic_grunt": "Galactic Grunt",
"galactic_grunt_female": "Galactic Grunt",
"galactic_grunts": "Galactic Grunts",
"plasma_grunt": "Plasma Grunt",
"plasma_grunt_female": "Plasma Grunt",
"plasma_grunts": "Plasma Grunts",
"flare_grunt": "Flare Grunt",
"flare_grunt_female": "Flare Grunt",
"flare_grunts": "Flare Grunts",
} as const;
// Names of special trainers like gym leaders, elite four, and the champion

View File

@ -117,7 +117,25 @@ export const trainerClasses: SimpleTranslationEntries = {
"worker": "Operario",
"worker_female": "Operaria",
"workers": "Operarios",
"youngster": "Joven"
"youngster": "Joven",
"rocket_grunt": "Rocket Grunt",
"rocket_grunts": "Rocket Grunts",
"rocket_grunt_female": "Rocket Grunt",
"magma_grunt": "Magma Grunt",
"magma_grunt_female": "Magma Grunt",
"magma_grunts": "Magma Grunts",
"aqua_grunt": "Aqua Grunt",
"aqua_grunt_female": "Aqua Grunt",
"aqua_grunts": "Aqua Grunts",
"galactic_grunt": "Galactic Grunt",
"galactic_grunt_female": "Galactic Grunt",
"galactic_grunts": "Galactic Grunts",
"plasma_grunt": "Plasma Grunt",
"plasma_grunt_female": "Plasma Grunt",
"plasma_grunts": "Plasma Grunts",
"flare_grunt": "Flare Grunt",
"flare_grunt_female": "Flare Grunt",
"flare_grunts": "Flare Grunts",
} as const;
// Names of special trainers like gym leaders, elite four, and the champion

View File

@ -127,16 +127,22 @@ export const trainerClasses: SimpleTranslationEntries = {
"youngster": "Gamin",
"rocket_grunt": "Sbire de la Team Rocket",
"rocket_grunt_female": "Sbire de la Team Rocket",
"rocket_grunts": "Sbires de la Team Rocket",
"magma_grunt": "Sbire de la Team Magma",
"magma_grunt_female": "Sbire de la Team Magma",
"magma_grunts": "Sbires de la Team Magma",
"aqua_grunt": "Sbire de la Team Aqua",
"aqua_grunt_female": "Sbire de la Team Aqua",
"aqua_grunts": "Sbires de la Team Aqua",
"galactic_grunt": "Sbire de la Team Galaxie",
"galactic_grunt_female": "Sbire Team Galaxie",
"galactic_grunt_female": "Sbire de la Team Galaxie",
"galactic_grunts": "Sbires de la Team Galaxie",
"plasma_grunt": "Sbire de la Team Plasma",
"plasma_grunt_female": "Sbire de la Team Plasma",
"plasma_grunts": "Sbires de la Team Plasma",
"flare_grunt": "Sbire de la Team Flare",
"flare_grunt_female": "Sbire de la Team Flare",
"flare_grunts": "Sbires de la Team Flare",
} as const;
// Names of special trainers like gym leaders, elite four, and the champion

View File

@ -118,7 +118,25 @@ export const trainerClasses: SimpleTranslationEntries = {
"worker": "Operaio",
"worker_female": "Lavoratrice",
"workers": "Lavoratori",
"youngster": "Bullo"
"youngster": "Bullo",
"rocket_grunt": "Recluta Team Rocket",
"rocket_grunts": "Reclute Team Rocket",
"rocket_grunt_female": "Recluta Team Rocket",
"magma_grunt": "Recluta Team Magma",
"magma_grunt_female": "Recluta Team Magma",
"magma_grunts": "Reclute Team Magma",
"aqua_grunt": "Recluta Team Idro",
"aqua_grunt_female": "Recluta Team Idro",
"aqua_grunts": "Recluta Team Idro",
"galactic_grunt": "Recluta Team Galassia",
"galactic_grunt_female": "Recluta Team Galassia",
"galactic_grunts": "Reclute Team Galassia",
"plasma_grunt": "Seguace Plasma",
"plasma_grunt_female": "Seguace Plasma",
"plasma_grunts": "Seguaci Plasma",
"flare_grunt": "Recluta Team Flare",
"flare_grunt_female": "Recluta Team Flare",
"flare_grunts": "Reclute Team Flare",
} as const;
// Names of special trainers like gym leaders, elite four, and the champion

View File

@ -127,16 +127,22 @@ export const trainerClasses: SimpleTranslationEntries = {
"youngster": "반바지 꼬마",
"rocket_grunt": "로켓단 조무래기",
"rocket_grunt_female": "로켓단 조무래기",
"rocket_grunts": "로켓단 조무래기들",
"magma_grunt": "마그마단 조무래기",
"magma_grunt_female": "마그마단 조무래기",
"magma_grunts": "마그마단 조무래기들",
"aqua_grunt": "아쿠아단 조무래기",
"aqua_grunt_female": "아쿠아단 조무래기",
"aqua_grunts": "아쿠아단 조무래기들",
"galactic_grunt": "갤럭시단 조무래기",
"galactic_grunt_female": "갤럭시단 조무래기",
"galactic_grunts": "갤럭시단 조무래기들",
"plasma_grunt": "플라스마단 조무래기",
"plasma_grunt_female": "플라스마단 조무래기",
"plasma_grunts": "플라스마단 조무래기들",
"flare_grunt": "플레어단 조무래기",
"flare_grunt_female": "플레어단 조무래기",
"flare_grunts": "플레어단 조무래기들",
} as const;
// Names of special trainers like gym leaders, elite four, and the champion

View File

@ -127,16 +127,22 @@ export const trainerClasses: SimpleTranslationEntries = {
"youngster": "Jovem",
"rocket_grunt": "Recruta da Equipe Rocket",
"rocket_grunt_female": "Recruta da Equipe Rocket",
"rocket_grunts": "Recrutas da Equipe Rocket",
"magma_grunt": "Recruta da Equipe Magma",
"magma_grunt_female": "Recruta da Equipe Magma",
"magma_grunts": "Recrutas da Equipe Magma",
"aqua_grunt": "Recruta da Equipe Aqua",
"aqua_grunt_female": "Recruta da Equipe Aqua",
"aqua_grunts": "Recrutas da Equipe Aqua",
"galactic_grunt": "Recruta da Equipe Galáctica",
"galactic_grunt_female": "Recruta da Equipe Galáctica",
"galactic_grunts": "Recrutas da Equipe Galáctica",
"plasma_grunt": "Recruta da Equipe Plasma",
"plasma_grunt_female": "Recruta da Equipe Plasma",
"plasma_grunts": "Recrutas da Equipe Plasma",
"flare_grunt": "Recruta da Equipe Flare",
"flare_grunt_female": "Recruta da Equipe Flare",
"flare_grunts": "Recrutas da Equipe Flare",
} as const;
// Names of special trainers like gym leaders, elite four, and the champion

View File

@ -127,16 +127,22 @@ export const trainerClasses: SimpleTranslationEntries = {
"youngster": "短裤小子",
"rocket_grunt": "火箭队手下",
"rocket_grunt_female": "火箭队手下",
"rocket_grunts": "火箭队手下们",
"magma_grunt": "熔岩队手下",
"magma_grunt_female": "熔岩队手下",
"magma_grunts": "熔岩队手下们",
"aqua_grunt": "海洋队手下",
"aqua_grunt_female": "海洋队手下",
"aqua_grunts": "海洋队手下们",
"galactic_grunt": "银河队手下",
"galactic_grunt_female": "银河队手下",
"galactic_grunts": "银河队手下们",
"plasma_grunt": "等离子队手下",
"plasma_grunt_female": "等离子队手下",
"plasma_grunts": "等离子队手下们",
"flare_grunt": "闪焰队手下",
"flare_grunt_female": "闪焰队手下",
"flare_grunts": "闪焰队手下们",
} as const;
// Names of special trainers like gym leaders, elite four, and the champion

View File

@ -118,7 +118,23 @@ export const trainerClasses: SimpleTranslationEntries = {
"worker": "工人",
"worker_female": "工人",
"workers": "工人組合",
"youngster": "短褲小子"
"youngster": "短褲小子",
"rocket_grunts": "火箭队手下們",
"magma_grunt": "熔岩队手下",
"magma_grunt_female": "熔岩队手下",
"magma_grunts": "熔岩队手下們",
"aqua_grunt": "海洋队手下",
"aqua_grunt_female": "海洋队手下",
"aqua_grunts": "海洋队手下們",
"galactic_grunt": "银河队手下",
"galactic_grunt_female": "银河队手下",
"galactic_grunts": "银河队手下們",
"plasma_grunt": "等离子队手下",
"plasma_grunt_female": "等离子队手下",
"plasma_grunts": "等离子队手下們",
"flare_grunt": "闪焰队手下",
"flare_grunt_female": "闪焰队手下",
"flare_grunts": "闪焰队手下們",
} as const;
// Names of special trainers like gym leaders, elite four, and the champion

View File

@ -1569,7 +1569,7 @@ const modifierPool: ModifierPool = {
p => !p.getHeldItems().some(i => i instanceof Modifiers.PokemonResetNegativeStatStageModifier && i.stackCount >= i.getMaxHeldItemCount(p)) &&
(checkedAbilities.some(a => p.hasAbility(a, false, true)) || p.getMoveset(true).some(m => selfStatLowerMoves.includes(m.moveId)))).length;
// If a party member has one of the above moves or abilities and doesn't have max herbs, the herb will appear more frequently
return 3 * (weightMultiplier ? 2: 1) + (weightMultiplier ? weightMultiplier - 1 : 0);
return 2 * (weightMultiplier ? 2 : 1) + (weightMultiplier ? weightMultiplier : 0);
}, 10),
new WeightedModifierType(modifierTypes.REVIVER_SEED, 4),
new WeightedModifierType(modifierTypes.CANDY_JAR, 5),
@ -1637,7 +1637,7 @@ const wildModifierPool: ModifierPool = {
}),
[ModifierTier.ULTRA]: [
new WeightedModifierType(modifierTypes.ATTACK_TYPE_BOOSTER, 10),
new WeightedModifierType(modifierTypes.WHITE_HERB, 2)
new WeightedModifierType(modifierTypes.WHITE_HERB, 1)
].map(m => {
m.setTier(ModifierTier.ULTRA); return m;
}),
@ -1666,7 +1666,7 @@ const trainerModifierPool: ModifierPool = {
m.setTier(ModifierTier.GREAT); return m;
}),
[ModifierTier.ULTRA]: [
new WeightedModifierType(modifierTypes.ATTACK_TYPE_BOOSTER, 5),
new WeightedModifierType(modifierTypes.ATTACK_TYPE_BOOSTER, 10),
new WeightedModifierType(modifierTypes.WHITE_HERB, 1),
].map(m => {
m.setTier(ModifierTier.ULTRA); return m;
@ -1684,6 +1684,7 @@ const trainerModifierPool: ModifierPool = {
new WeightedModifierType(modifierTypes.KINGS_ROCK, 1),
new WeightedModifierType(modifierTypes.LEFTOVERS, 1),
new WeightedModifierType(modifierTypes.SHELL_BELL, 1),
new WeightedModifierType(modifierTypes.SCOPE_LENS, 1),
].map(m => {
m.setTier(ModifierTier.MASTER); return m;
})

View File

@ -1437,7 +1437,7 @@ export class SummonPhase extends PartyMemberPokemonPhase {
this.scene.time.delayedCall(750, () => this.summon());
} else {
const trainerName = this.scene.currentBattle.trainer.getName(!(this.fieldIndex % 2) ? TrainerSlot.TRAINER : TrainerSlot.TRAINER_PARTNER);
const pokemonName = getPokemonNameWithAffix(this.getPokemon());
const pokemonName = this.getPokemon().getNameToRender();
const message = i18next.t("battle:trainerSendOut", { trainerName, pokemonName });
this.scene.pbTrayEnemy.hide();
@ -1650,7 +1650,7 @@ export class SwitchSummonPhase extends SummonPhase {
i18next.t("battle:playerGo", { pokemonName: getPokemonNameWithAffix(switchedPokemon) }) :
i18next.t("battle:trainerGo", {
trainerName: this.scene.currentBattle.trainer.getName(!(this.fieldIndex % 2) ? TrainerSlot.TRAINER : TrainerSlot.TRAINER_PARTNER),
pokemonName: getPokemonNameWithAffix(this.getPokemon())
pokemonName: this.getPokemon().getNameToRender()
})
);
// Ensure improperly persisted summon data (such as tags) is cleared upon switching
@ -5038,7 +5038,7 @@ export class AttemptCapturePhase extends PokemonPhase {
Promise.all([pokemon.hideInfo(), this.scene.gameData.setPokemonCaught(pokemon)]).then(() => {
if (this.scene.getParty().length === 6) {
const promptRelease = () => {
this.scene.ui.showText(i18next.t("battle:partyFull", { pokemonName: getPokemonNameWithAffix(pokemon) }), null, () => {
this.scene.ui.showText(i18next.t("battle:partyFull", { pokemonName: pokemon.getNameToRender() }), null, () => {
this.scene.pokemonInfoContainer.makeRoomForConfirmUi(1, true);
this.scene.ui.setMode(Mode.CONFIRM, () => {
const newPokemon = this.scene.addPlayerPokemon(pokemon.species, pokemon.level, pokemon.abilityIndex, pokemon.formIndex, pokemon.gender, pokemon.shiny, pokemon.variant, pokemon.ivs, pokemon.nature, pokemon);

View File

@ -38,6 +38,7 @@ export default class PokemonData {
public friendship: integer;
public metLevel: integer;
public metBiome: Biome | -1;
public metSpecies: Species;
public luck: integer;
public pauseEvolutions: boolean;
public pokerus: boolean;
@ -83,6 +84,7 @@ export default class PokemonData {
this.friendship = source.friendship !== undefined ? source.friendship : getPokemonSpecies(this.species).baseFriendship;
this.metLevel = source.metLevel || 5;
this.metBiome = source.metBiome !== undefined ? source.metBiome : -1;
this.metSpecies = source.metSpecies;
this.luck = source.luck !== undefined ? source.luck : (source.shiny ? (source.variant + 1) : 0);
if (!forHistory) {
this.pauseEvolutions = !!source.pauseEvolutions;

View File

@ -40,8 +40,8 @@ export default class MenuUiHandler extends MessageUiHandler {
private cursorObj: Phaser.GameObjects.Image;
protected ignoredMenuOptions: MenuOptions[];
protected menuOptions: MenuOptions[];
private excludedMenus: () => ConditionalMenu[];
private menuOptions: MenuOptions[];
protected manageDataConfig: OptionSelectConfig;
protected communityConfig: OptionSelectConfig;
@ -52,13 +52,19 @@ export default class MenuUiHandler extends MessageUiHandler {
constructor(scene: BattleScene, mode?: Mode) {
super(scene, mode);
this.ignoredMenuOptions = !bypassLogin
? [ ]
: [ MenuOptions.LOG_OUT ];
this.menuOptions = Utils.getEnumKeys(MenuOptions).map(m => parseInt(MenuOptions[m]) as MenuOptions).filter(m => !this.ignoredMenuOptions.includes(m));
this.excludedMenus = () => [
{ condition: [Mode.COMMAND, Mode.TITLE].includes(mode ?? Mode.TITLE), options: [ MenuOptions.EGG_GACHA, MenuOptions.EGG_LIST] },
{ condition: bypassLogin, options: [ MenuOptions.LOG_OUT ] }
];
this.menuOptions = Utils.getEnumKeys(MenuOptions)
.map(m => parseInt(MenuOptions[m]) as MenuOptions)
.filter(m => {
return !this.excludedMenus().some(exclusion => exclusion.condition && exclusion.options.includes(m));
});
}
setup() {
setup(): void {
const ui = this.getUi();
// wiki url directs based on languges available on wiki
const lang = i18next.resolvedLanguage.substring(0,2);
@ -80,10 +86,25 @@ export default class MenuUiHandler extends MessageUiHandler {
this.menuOverlay.setOrigin(0,0);
this.menuContainer.add(this.menuOverlay);
const menuMessageText = addTextObject(this.scene, 8, 8, "", TextStyle.WINDOW, { maxLines: 2 });
menuMessageText.setName("menu-message");
menuMessageText.setWordWrapWidth(1224);
menuMessageText.setOrigin(0, 0);
this.menuContainer.add(this.bgmBar);
this.menuContainer.setVisible(false);
}
render() {
const ui = this.getUi();
this.excludedMenus = () => [
{ condition: ![Mode.COMMAND, Mode.TITLE].includes(ui.getModeChain()[0]), options: [ MenuOptions.EGG_GACHA, MenuOptions.EGG_LIST] },
{ condition: bypassLogin, options: [ MenuOptions.LOG_OUT ] }
];
this.menuOptions = Utils.getEnumKeys(MenuOptions)
.map(m => parseInt(MenuOptions[m]) as MenuOptions)
.filter(m => {
return !this.excludedMenus().some(exclusion => exclusion.condition && exclusion.options.includes(m));
});
this.optionSelectText = addTextObject(this.scene, 0, 0, this.menuOptions.map(o => `${i18next.t(`menuUiHandler:${MenuOptions[o]}`)}`).join("\n"), TextStyle.WINDOW, { maxLines: this.menuOptions.length });
this.optionSelectText.setLineSpacing(12);
@ -108,10 +129,12 @@ export default class MenuUiHandler extends MessageUiHandler {
menuMessageBox.setOrigin(0, 0);
this.menuMessageBoxContainer.add(menuMessageBox);
const menuMessageText = addTextObject(this.scene, 8, 8, "", TextStyle.WINDOW, { maxLines: 2 });
menuMessageText.setName("menu-message");
menuMessageText.setWordWrapWidth(1224);
menuMessageText.setOrigin(0, 0);
this.menuMessageBoxContainer.add(menuMessageText);
this.menuContainer.add(this.bgmBar);
this.message = menuMessageText;
this.menuContainer.add(this.menuMessageBoxContainer);
@ -270,16 +293,19 @@ export default class MenuUiHandler extends MessageUiHandler {
xOffset: 98,
options: communityOptions
};
this.setCursor(0);
this.menuContainer.setVisible(false);
}
show(args: any[]): boolean {
this.render();
super.show(args);
this.menuOptions = Utils.getEnumKeys(MenuOptions)
.map(m => parseInt(MenuOptions[m]) as MenuOptions)
.filter(m => {
return !this.excludedMenus().some(exclusion => exclusion.condition && exclusion.options.includes(m));
});
this.menuContainer.setVisible(true);
this.setCursor(0);
@ -305,11 +331,15 @@ export default class MenuUiHandler extends MessageUiHandler {
if (button === Button.ACTION) {
let adjustedCursor = this.cursor;
for (const imo of this.ignoredMenuOptions) {
if (adjustedCursor >= imo) {
adjustedCursor++;
} else {
break;
const excludedMenu = this.excludedMenus().find(e => e.condition);
if (excludedMenu !== undefined && excludedMenu.options !== undefined && excludedMenu.options.length > 0) {
const sortedOptions = excludedMenu.options.sort();
for (const imo of sortedOptions) {
if (adjustedCursor >= imo) {
adjustedCursor++;
} else {
break;
}
}
}
switch (adjustedCursor) {
@ -506,3 +536,8 @@ export default class MenuUiHandler extends MessageUiHandler {
this.cursorObj = null;
}
}
interface ConditionalMenu {
condition: boolean;
options: MenuOptions[];
}

View File

@ -536,4 +536,8 @@ export default class UI extends Phaser.GameObjects.Container {
this.revertMode().then(success => Utils.executeIf(success, this.revertModes).then(() => resolve()));
});
}
public getModeChain(): Mode[] {
return this.modeChain;
}
}