Compare commits

...

22 Commits

Author SHA1 Message Date
Bertie690
17cb3bb43d
Merge 9cec9fc715 into bb86bdd2a6 2025-08-06 00:16:37 -04:00
damocleas
bb86bdd2a6
[Balance] Add Scientist to Lab, Swimmer to Seabed to account for ME's
https://github.com/pagefaultgames/pokerogue/pull/6217
2025-08-05 19:57:51 -07:00
Sirz Benjie
1633df75c4
[UI/UX] Add change password ui (#5938)
* Add change password ui

* Ensure input fields are cleared after submit or cancel

* Play select sound on successful submission or cancel

---------

Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
Co-authored-by: Wlowscha <54003515+Wlowscha@users.noreply.github.com>
2025-08-05 16:35:58 -06:00
Wlowscha
9cec9fc715
Merge branch 'beta' into turn-start-phase 2025-08-02 22:08:04 +02:00
Bertie690
23df04467c
Merge branch 'beta' into turn-start-phase 2025-07-29 22:47:32 -04:00
Bertie690
f42c1461c2
Merge branch 'beta' into turn-start-phase 2025-07-25 19:28:37 -04:00
Bertie690
1d4b7666ee
Merge branch 'beta' into turn-start-phase 2025-07-19 12:11:20 -04:00
NightKev
3012060954 Fix locales submodule 2025-07-15 00:19:35 -07:00
NightKev
991c00eda0 Merge branch 'beta' into turn-start-phase 2025-07-15 00:18:52 -07:00
Bertie690
94d8d60826
Merge branch 'beta' into turn-start-phase 2025-07-08 23:59:05 +02:00
Bertie690
70d49e546d
Merge branch 'beta' into turn-start-phase 2025-07-04 10:36:19 +02:00
Bertie690
5c1bfb4110
Merge branch 'beta' into turn-start-phase 2025-06-28 10:12:35 +01:00
Bertie690
bdfe4a6a2a
Merge branch 'beta' into turn-start-phase 2025-06-24 18:18:52 -04:00
Bertie690
e6e4445a09 Fixed up documentation for speed order functions 2025-06-22 16:25:44 -04:00
Bertie690
4dc53d2ee3
Merge branch 'beta' into turn-start-phase 2025-06-22 07:46:28 -04:00
Bertie690
5781eb2715 Merge remote-tracking branch 'upstream/beta' into turn-start-phase 2025-06-16 12:07:51 -04:00
Bertie690
bc337f022d Ran biome 2025-06-16 12:07:46 -04:00
Bertie690
93740ae3a2
Update turn-start-phase.ts 2025-06-16 08:23:44 -04:00
Bertie690
4ab2a33578
Merge branch 'beta' into turn-start-phase 2025-06-16 08:16:33 -04:00
Bertie690
7cf396f296
Update turn-start-phase.ts 2025-06-14 20:02:12 -04:00
Bertie690
81d3fb1eea Fixed sutff 2025-06-13 07:30:42 -04:00
Bertie690
688bd5366d Reworked Turn Start Phase to be less jank 2025-06-13 07:23:45 -04:00
11 changed files with 302 additions and 228 deletions

View File

@ -15,3 +15,10 @@ export interface AccountRegisterRequest {
username: string; username: string;
password: string; password: string;
} }
export interface AccountChangePwRequest {
password: string;
}
export interface AccountChangePwResponse {
success: boolean;
}

View File

@ -1641,10 +1641,7 @@ export const biomeTrainerPools: BiomeTrainerPools = {
[BiomePoolTier.RARE]: [], [BiomePoolTier.RARE]: [],
[BiomePoolTier.SUPER_RARE]: [], [BiomePoolTier.SUPER_RARE]: [],
[BiomePoolTier.ULTRA_RARE]: [], [BiomePoolTier.ULTRA_RARE]: [],
[BiomePoolTier.BOSS]: [], [BiomePoolTier.BOSS]: []
[BiomePoolTier.BOSS_RARE]: [],
[BiomePoolTier.BOSS_SUPER_RARE]: [],
[BiomePoolTier.BOSS_ULTRA_RARE]: []
}, },
[BiomeId.PLAINS]: { [BiomeId.PLAINS]: {
[BiomePoolTier.COMMON]: [ TrainerType.BREEDER, TrainerType.TWINS ], [BiomePoolTier.COMMON]: [ TrainerType.BREEDER, TrainerType.TWINS ],
@ -1652,10 +1649,7 @@ export const biomeTrainerPools: BiomeTrainerPools = {
[BiomePoolTier.RARE]: [ TrainerType.BLACK_BELT ], [BiomePoolTier.RARE]: [ TrainerType.BLACK_BELT ],
[BiomePoolTier.SUPER_RARE]: [], [BiomePoolTier.SUPER_RARE]: [],
[BiomePoolTier.ULTRA_RARE]: [], [BiomePoolTier.ULTRA_RARE]: [],
[BiomePoolTier.BOSS]: [ TrainerType.CILAN, TrainerType.CHILI, TrainerType.CRESS, TrainerType.CHEREN ], [BiomePoolTier.BOSS]: [ TrainerType.CILAN, TrainerType.CHILI, TrainerType.CRESS, TrainerType.CHEREN ]
[BiomePoolTier.BOSS_RARE]: [],
[BiomePoolTier.BOSS_SUPER_RARE]: [],
[BiomePoolTier.BOSS_ULTRA_RARE]: []
}, },
[BiomeId.GRASS]: { [BiomeId.GRASS]: {
[BiomePoolTier.COMMON]: [ TrainerType.BREEDER, TrainerType.SCHOOL_KID ], [BiomePoolTier.COMMON]: [ TrainerType.BREEDER, TrainerType.SCHOOL_KID ],
@ -1663,10 +1657,7 @@ export const biomeTrainerPools: BiomeTrainerPools = {
[BiomePoolTier.RARE]: [ TrainerType.BLACK_BELT ], [BiomePoolTier.RARE]: [ TrainerType.BLACK_BELT ],
[BiomePoolTier.SUPER_RARE]: [], [BiomePoolTier.SUPER_RARE]: [],
[BiomePoolTier.ULTRA_RARE]: [], [BiomePoolTier.ULTRA_RARE]: [],
[BiomePoolTier.BOSS]: [ TrainerType.ERIKA ], [BiomePoolTier.BOSS]: [ TrainerType.ERIKA ]
[BiomePoolTier.BOSS_RARE]: [],
[BiomePoolTier.BOSS_SUPER_RARE]: [],
[BiomePoolTier.BOSS_ULTRA_RARE]: []
}, },
[BiomeId.TALL_GRASS]: { [BiomeId.TALL_GRASS]: {
[BiomePoolTier.COMMON]: [], [BiomePoolTier.COMMON]: [],
@ -1674,10 +1665,7 @@ export const biomeTrainerPools: BiomeTrainerPools = {
[BiomePoolTier.RARE]: [], [BiomePoolTier.RARE]: [],
[BiomePoolTier.SUPER_RARE]: [], [BiomePoolTier.SUPER_RARE]: [],
[BiomePoolTier.ULTRA_RARE]: [], [BiomePoolTier.ULTRA_RARE]: [],
[BiomePoolTier.BOSS]: [ TrainerType.GARDENIA, TrainerType.VIOLA, TrainerType.BRASSIUS ], [BiomePoolTier.BOSS]: [ TrainerType.GARDENIA, TrainerType.VIOLA, TrainerType.BRASSIUS ]
[BiomePoolTier.BOSS_RARE]: [],
[BiomePoolTier.BOSS_SUPER_RARE]: [],
[BiomePoolTier.BOSS_ULTRA_RARE]: []
}, },
[BiomeId.METROPOLIS]: { [BiomeId.METROPOLIS]: {
[BiomePoolTier.COMMON]: [ TrainerType.BEAUTY, TrainerType.CLERK, TrainerType.CYCLIST, TrainerType.OFFICER, TrainerType.WAITER ], [BiomePoolTier.COMMON]: [ TrainerType.BEAUTY, TrainerType.CLERK, TrainerType.CYCLIST, TrainerType.OFFICER, TrainerType.WAITER ],
@ -1685,10 +1673,7 @@ export const biomeTrainerPools: BiomeTrainerPools = {
[BiomePoolTier.RARE]: [ TrainerType.ARTIST, TrainerType.RICH_KID ], [BiomePoolTier.RARE]: [ TrainerType.ARTIST, TrainerType.RICH_KID ],
[BiomePoolTier.SUPER_RARE]: [], [BiomePoolTier.SUPER_RARE]: [],
[BiomePoolTier.ULTRA_RARE]: [], [BiomePoolTier.ULTRA_RARE]: [],
[BiomePoolTier.BOSS]: [ TrainerType.WHITNEY, TrainerType.NORMAN, TrainerType.IONO, TrainerType.LARRY ], [BiomePoolTier.BOSS]: [ TrainerType.WHITNEY, TrainerType.NORMAN, TrainerType.IONO, TrainerType.LARRY ]
[BiomePoolTier.BOSS_RARE]: [],
[BiomePoolTier.BOSS_SUPER_RARE]: [],
[BiomePoolTier.BOSS_ULTRA_RARE]: []
}, },
[BiomeId.FOREST]: { [BiomeId.FOREST]: {
[BiomePoolTier.COMMON]: [ TrainerType.RANGER ], [BiomePoolTier.COMMON]: [ TrainerType.RANGER ],
@ -1696,10 +1681,7 @@ export const biomeTrainerPools: BiomeTrainerPools = {
[BiomePoolTier.RARE]: [], [BiomePoolTier.RARE]: [],
[BiomePoolTier.SUPER_RARE]: [], [BiomePoolTier.SUPER_RARE]: [],
[BiomePoolTier.ULTRA_RARE]: [], [BiomePoolTier.ULTRA_RARE]: [],
[BiomePoolTier.BOSS]: [ TrainerType.BUGSY, TrainerType.BURGH, TrainerType.KATY ], [BiomePoolTier.BOSS]: [ TrainerType.BUGSY, TrainerType.BURGH, TrainerType.KATY ]
[BiomePoolTier.BOSS_RARE]: [],
[BiomePoolTier.BOSS_SUPER_RARE]: [],
[BiomePoolTier.BOSS_ULTRA_RARE]: []
}, },
[BiomeId.SEA]: { [BiomeId.SEA]: {
[BiomePoolTier.COMMON]: [ TrainerType.SAILOR, TrainerType.SWIMMER ], [BiomePoolTier.COMMON]: [ TrainerType.SAILOR, TrainerType.SWIMMER ],
@ -1707,10 +1689,7 @@ export const biomeTrainerPools: BiomeTrainerPools = {
[BiomePoolTier.RARE]: [], [BiomePoolTier.RARE]: [],
[BiomePoolTier.SUPER_RARE]: [], [BiomePoolTier.SUPER_RARE]: [],
[BiomePoolTier.ULTRA_RARE]: [], [BiomePoolTier.ULTRA_RARE]: [],
[BiomePoolTier.BOSS]: [ TrainerType.MARLON ], [BiomePoolTier.BOSS]: [ TrainerType.MARLON ]
[BiomePoolTier.BOSS_RARE]: [],
[BiomePoolTier.BOSS_SUPER_RARE]: [],
[BiomePoolTier.BOSS_ULTRA_RARE]: []
}, },
[BiomeId.SWAMP]: { [BiomeId.SWAMP]: {
[BiomePoolTier.COMMON]: [ TrainerType.PARASOL_LADY ], [BiomePoolTier.COMMON]: [ TrainerType.PARASOL_LADY ],
@ -1718,10 +1697,7 @@ export const biomeTrainerPools: BiomeTrainerPools = {
[BiomePoolTier.RARE]: [ TrainerType.BLACK_BELT ], [BiomePoolTier.RARE]: [ TrainerType.BLACK_BELT ],
[BiomePoolTier.SUPER_RARE]: [], [BiomePoolTier.SUPER_RARE]: [],
[BiomePoolTier.ULTRA_RARE]: [], [BiomePoolTier.ULTRA_RARE]: [],
[BiomePoolTier.BOSS]: [ TrainerType.JANINE, TrainerType.ROXIE ], [BiomePoolTier.BOSS]: [ TrainerType.JANINE, TrainerType.ROXIE ]
[BiomePoolTier.BOSS_RARE]: [],
[BiomePoolTier.BOSS_SUPER_RARE]: [],
[BiomePoolTier.BOSS_ULTRA_RARE]: []
}, },
[BiomeId.BEACH]: { [BiomeId.BEACH]: {
[BiomePoolTier.COMMON]: [ TrainerType.FISHERMAN, TrainerType.SAILOR ], [BiomePoolTier.COMMON]: [ TrainerType.FISHERMAN, TrainerType.SAILOR ],
@ -1729,10 +1705,7 @@ export const biomeTrainerPools: BiomeTrainerPools = {
[BiomePoolTier.RARE]: [ TrainerType.BLACK_BELT ], [BiomePoolTier.RARE]: [ TrainerType.BLACK_BELT ],
[BiomePoolTier.SUPER_RARE]: [], [BiomePoolTier.SUPER_RARE]: [],
[BiomePoolTier.ULTRA_RARE]: [], [BiomePoolTier.ULTRA_RARE]: [],
[BiomePoolTier.BOSS]: [ TrainerType.MISTY, TrainerType.KOFU ], [BiomePoolTier.BOSS]: [ TrainerType.MISTY, TrainerType.KOFU ]
[BiomePoolTier.BOSS_RARE]: [],
[BiomePoolTier.BOSS_SUPER_RARE]: [],
[BiomePoolTier.BOSS_ULTRA_RARE]: []
}, },
[BiomeId.LAKE]: { [BiomeId.LAKE]: {
[BiomePoolTier.COMMON]: [ TrainerType.BREEDER, TrainerType.FISHERMAN, TrainerType.PARASOL_LADY ], [BiomePoolTier.COMMON]: [ TrainerType.BREEDER, TrainerType.FISHERMAN, TrainerType.PARASOL_LADY ],
@ -1740,21 +1713,15 @@ export const biomeTrainerPools: BiomeTrainerPools = {
[BiomePoolTier.RARE]: [ TrainerType.BLACK_BELT ], [BiomePoolTier.RARE]: [ TrainerType.BLACK_BELT ],
[BiomePoolTier.SUPER_RARE]: [], [BiomePoolTier.SUPER_RARE]: [],
[BiomePoolTier.ULTRA_RARE]: [], [BiomePoolTier.ULTRA_RARE]: [],
[BiomePoolTier.BOSS]: [ TrainerType.CRASHER_WAKE ], [BiomePoolTier.BOSS]: [ TrainerType.CRASHER_WAKE ]
[BiomePoolTier.BOSS_RARE]: [],
[BiomePoolTier.BOSS_SUPER_RARE]: [],
[BiomePoolTier.BOSS_ULTRA_RARE]: []
}, },
[BiomeId.SEABED]: { [BiomeId.SEABED]: {
[BiomePoolTier.COMMON]: [], [BiomePoolTier.COMMON]: [ TrainerType.SWIMMER ],
[BiomePoolTier.UNCOMMON]: [], [BiomePoolTier.UNCOMMON]: [],
[BiomePoolTier.RARE]: [], [BiomePoolTier.RARE]: [],
[BiomePoolTier.SUPER_RARE]: [], [BiomePoolTier.SUPER_RARE]: [],
[BiomePoolTier.ULTRA_RARE]: [], [BiomePoolTier.ULTRA_RARE]: [],
[BiomePoolTier.BOSS]: [ TrainerType.JUAN ], [BiomePoolTier.BOSS]: [ TrainerType.JUAN ]
[BiomePoolTier.BOSS_RARE]: [],
[BiomePoolTier.BOSS_SUPER_RARE]: [],
[BiomePoolTier.BOSS_ULTRA_RARE]: []
}, },
[BiomeId.MOUNTAIN]: { [BiomeId.MOUNTAIN]: {
[BiomePoolTier.COMMON]: [ TrainerType.BACKPACKER, TrainerType.BLACK_BELT, TrainerType.HIKER ], [BiomePoolTier.COMMON]: [ TrainerType.BACKPACKER, TrainerType.BLACK_BELT, TrainerType.HIKER ],
@ -1762,10 +1729,7 @@ export const biomeTrainerPools: BiomeTrainerPools = {
[BiomePoolTier.RARE]: [], [BiomePoolTier.RARE]: [],
[BiomePoolTier.SUPER_RARE]: [], [BiomePoolTier.SUPER_RARE]: [],
[BiomePoolTier.ULTRA_RARE]: [], [BiomePoolTier.ULTRA_RARE]: [],
[BiomePoolTier.BOSS]: [ TrainerType.FALKNER, TrainerType.WINONA, TrainerType.SKYLA ], [BiomePoolTier.BOSS]: [ TrainerType.FALKNER, TrainerType.WINONA, TrainerType.SKYLA ]
[BiomePoolTier.BOSS_RARE]: [],
[BiomePoolTier.BOSS_SUPER_RARE]: [],
[BiomePoolTier.BOSS_ULTRA_RARE]: []
}, },
[BiomeId.BADLANDS]: { [BiomeId.BADLANDS]: {
[BiomePoolTier.COMMON]: [ TrainerType.BACKPACKER, TrainerType.HIKER ], [BiomePoolTier.COMMON]: [ TrainerType.BACKPACKER, TrainerType.HIKER ],
@ -1773,10 +1737,7 @@ export const biomeTrainerPools: BiomeTrainerPools = {
[BiomePoolTier.RARE]: [], [BiomePoolTier.RARE]: [],
[BiomePoolTier.SUPER_RARE]: [], [BiomePoolTier.SUPER_RARE]: [],
[BiomePoolTier.ULTRA_RARE]: [], [BiomePoolTier.ULTRA_RARE]: [],
[BiomePoolTier.BOSS]: [ TrainerType.CLAY, TrainerType.GRANT ], [BiomePoolTier.BOSS]: [ TrainerType.CLAY, TrainerType.GRANT ]
[BiomePoolTier.BOSS_RARE]: [],
[BiomePoolTier.BOSS_SUPER_RARE]: [],
[BiomePoolTier.BOSS_ULTRA_RARE]: []
}, },
[BiomeId.CAVE]: { [BiomeId.CAVE]: {
[BiomePoolTier.COMMON]: [ TrainerType.BACKPACKER, TrainerType.HIKER ], [BiomePoolTier.COMMON]: [ TrainerType.BACKPACKER, TrainerType.HIKER ],
@ -1784,10 +1745,7 @@ export const biomeTrainerPools: BiomeTrainerPools = {
[BiomePoolTier.RARE]: [], [BiomePoolTier.RARE]: [],
[BiomePoolTier.SUPER_RARE]: [], [BiomePoolTier.SUPER_RARE]: [],
[BiomePoolTier.ULTRA_RARE]: [], [BiomePoolTier.ULTRA_RARE]: [],
[BiomePoolTier.BOSS]: [ TrainerType.BROCK, TrainerType.ROXANNE, TrainerType.ROARK ], [BiomePoolTier.BOSS]: [ TrainerType.BROCK, TrainerType.ROXANNE, TrainerType.ROARK ]
[BiomePoolTier.BOSS_RARE]: [],
[BiomePoolTier.BOSS_SUPER_RARE]: [],
[BiomePoolTier.BOSS_ULTRA_RARE]: []
}, },
[BiomeId.DESERT]: { [BiomeId.DESERT]: {
[BiomePoolTier.COMMON]: [ TrainerType.BACKPACKER, TrainerType.SCIENTIST ], [BiomePoolTier.COMMON]: [ TrainerType.BACKPACKER, TrainerType.SCIENTIST ],
@ -1795,10 +1753,7 @@ export const biomeTrainerPools: BiomeTrainerPools = {
[BiomePoolTier.RARE]: [], [BiomePoolTier.RARE]: [],
[BiomePoolTier.SUPER_RARE]: [], [BiomePoolTier.SUPER_RARE]: [],
[BiomePoolTier.ULTRA_RARE]: [], [BiomePoolTier.ULTRA_RARE]: [],
[BiomePoolTier.BOSS]: [ TrainerType.GORDIE ], [BiomePoolTier.BOSS]: [ TrainerType.GORDIE ]
[BiomePoolTier.BOSS_RARE]: [],
[BiomePoolTier.BOSS_SUPER_RARE]: [],
[BiomePoolTier.BOSS_ULTRA_RARE]: []
}, },
[BiomeId.ICE_CAVE]: { [BiomeId.ICE_CAVE]: {
[BiomePoolTier.COMMON]: [ TrainerType.SNOW_WORKER ], [BiomePoolTier.COMMON]: [ TrainerType.SNOW_WORKER ],
@ -1806,10 +1761,7 @@ export const biomeTrainerPools: BiomeTrainerPools = {
[BiomePoolTier.RARE]: [], [BiomePoolTier.RARE]: [],
[BiomePoolTier.SUPER_RARE]: [], [BiomePoolTier.SUPER_RARE]: [],
[BiomePoolTier.ULTRA_RARE]: [], [BiomePoolTier.ULTRA_RARE]: [],
[BiomePoolTier.BOSS]: [ TrainerType.PRYCE, TrainerType.BRYCEN, TrainerType.WULFRIC, TrainerType.GRUSHA ], [BiomePoolTier.BOSS]: [ TrainerType.PRYCE, TrainerType.BRYCEN, TrainerType.WULFRIC, TrainerType.GRUSHA ]
[BiomePoolTier.BOSS_RARE]: [],
[BiomePoolTier.BOSS_SUPER_RARE]: [],
[BiomePoolTier.BOSS_ULTRA_RARE]: []
}, },
[BiomeId.MEADOW]: { [BiomeId.MEADOW]: {
[BiomePoolTier.COMMON]: [ TrainerType.BEAUTY, TrainerType.MUSICIAN, TrainerType.PARASOL_LADY ], [BiomePoolTier.COMMON]: [ TrainerType.BEAUTY, TrainerType.MUSICIAN, TrainerType.PARASOL_LADY ],
@ -1817,10 +1769,7 @@ export const biomeTrainerPools: BiomeTrainerPools = {
[BiomePoolTier.RARE]: [], [BiomePoolTier.RARE]: [],
[BiomePoolTier.SUPER_RARE]: [], [BiomePoolTier.SUPER_RARE]: [],
[BiomePoolTier.ULTRA_RARE]: [], [BiomePoolTier.ULTRA_RARE]: [],
[BiomePoolTier.BOSS]: [ TrainerType.LENORA, TrainerType.MILO ], [BiomePoolTier.BOSS]: [ TrainerType.LENORA, TrainerType.MILO ]
[BiomePoolTier.BOSS_RARE]: [],
[BiomePoolTier.BOSS_SUPER_RARE]: [],
[BiomePoolTier.BOSS_ULTRA_RARE]: []
}, },
[BiomeId.POWER_PLANT]: { [BiomeId.POWER_PLANT]: {
[BiomePoolTier.COMMON]: [ TrainerType.GUITARIST, TrainerType.WORKER ], [BiomePoolTier.COMMON]: [ TrainerType.GUITARIST, TrainerType.WORKER ],
@ -1828,10 +1777,7 @@ export const biomeTrainerPools: BiomeTrainerPools = {
[BiomePoolTier.RARE]: [], [BiomePoolTier.RARE]: [],
[BiomePoolTier.SUPER_RARE]: [], [BiomePoolTier.SUPER_RARE]: [],
[BiomePoolTier.ULTRA_RARE]: [], [BiomePoolTier.ULTRA_RARE]: [],
[BiomePoolTier.BOSS]: [ TrainerType.VOLKNER, TrainerType.ELESA, TrainerType.CLEMONT ], [BiomePoolTier.BOSS]: [ TrainerType.VOLKNER, TrainerType.ELESA, TrainerType.CLEMONT ]
[BiomePoolTier.BOSS_RARE]: [],
[BiomePoolTier.BOSS_SUPER_RARE]: [],
[BiomePoolTier.BOSS_ULTRA_RARE]: []
}, },
[BiomeId.VOLCANO]: { [BiomeId.VOLCANO]: {
[BiomePoolTier.COMMON]: [ TrainerType.FIREBREATHER ], [BiomePoolTier.COMMON]: [ TrainerType.FIREBREATHER ],
@ -1839,10 +1785,7 @@ export const biomeTrainerPools: BiomeTrainerPools = {
[BiomePoolTier.RARE]: [], [BiomePoolTier.RARE]: [],
[BiomePoolTier.SUPER_RARE]: [], [BiomePoolTier.SUPER_RARE]: [],
[BiomePoolTier.ULTRA_RARE]: [], [BiomePoolTier.ULTRA_RARE]: [],
[BiomePoolTier.BOSS]: [ TrainerType.BLAINE, TrainerType.FLANNERY, TrainerType.KABU ], [BiomePoolTier.BOSS]: [ TrainerType.BLAINE, TrainerType.FLANNERY, TrainerType.KABU ]
[BiomePoolTier.BOSS_RARE]: [],
[BiomePoolTier.BOSS_SUPER_RARE]: [],
[BiomePoolTier.BOSS_ULTRA_RARE]: []
}, },
[BiomeId.GRAVEYARD]: { [BiomeId.GRAVEYARD]: {
[BiomePoolTier.COMMON]: [ TrainerType.PSYCHIC ], [BiomePoolTier.COMMON]: [ TrainerType.PSYCHIC ],
@ -1850,10 +1793,7 @@ export const biomeTrainerPools: BiomeTrainerPools = {
[BiomePoolTier.RARE]: [], [BiomePoolTier.RARE]: [],
[BiomePoolTier.SUPER_RARE]: [], [BiomePoolTier.SUPER_RARE]: [],
[BiomePoolTier.ULTRA_RARE]: [], [BiomePoolTier.ULTRA_RARE]: [],
[BiomePoolTier.BOSS]: [ TrainerType.MORTY, TrainerType.ALLISTER, TrainerType.RYME ], [BiomePoolTier.BOSS]: [ TrainerType.MORTY, TrainerType.ALLISTER, TrainerType.RYME ]
[BiomePoolTier.BOSS_RARE]: [],
[BiomePoolTier.BOSS_SUPER_RARE]: [],
[BiomePoolTier.BOSS_ULTRA_RARE]: []
}, },
[BiomeId.DOJO]: { [BiomeId.DOJO]: {
[BiomePoolTier.COMMON]: [ TrainerType.BLACK_BELT ], [BiomePoolTier.COMMON]: [ TrainerType.BLACK_BELT ],
@ -1861,10 +1801,7 @@ export const biomeTrainerPools: BiomeTrainerPools = {
[BiomePoolTier.RARE]: [], [BiomePoolTier.RARE]: [],
[BiomePoolTier.SUPER_RARE]: [], [BiomePoolTier.SUPER_RARE]: [],
[BiomePoolTier.ULTRA_RARE]: [], [BiomePoolTier.ULTRA_RARE]: [],
[BiomePoolTier.BOSS]: [ TrainerType.BRAWLY, TrainerType.MAYLENE, TrainerType.KORRINA, TrainerType.BEA ], [BiomePoolTier.BOSS]: [ TrainerType.BRAWLY, TrainerType.MAYLENE, TrainerType.KORRINA, TrainerType.BEA ]
[BiomePoolTier.BOSS_RARE]: [],
[BiomePoolTier.BOSS_SUPER_RARE]: [],
[BiomePoolTier.BOSS_ULTRA_RARE]: []
}, },
[BiomeId.FACTORY]: { [BiomeId.FACTORY]: {
[BiomePoolTier.COMMON]: [ TrainerType.WORKER ], [BiomePoolTier.COMMON]: [ TrainerType.WORKER ],
@ -1872,10 +1809,7 @@ export const biomeTrainerPools: BiomeTrainerPools = {
[BiomePoolTier.RARE]: [], [BiomePoolTier.RARE]: [],
[BiomePoolTier.SUPER_RARE]: [], [BiomePoolTier.SUPER_RARE]: [],
[BiomePoolTier.ULTRA_RARE]: [], [BiomePoolTier.ULTRA_RARE]: [],
[BiomePoolTier.BOSS]: [ TrainerType.JASMINE, TrainerType.BYRON ], [BiomePoolTier.BOSS]: [ TrainerType.JASMINE, TrainerType.BYRON ]
[BiomePoolTier.BOSS_RARE]: [],
[BiomePoolTier.BOSS_SUPER_RARE]: [],
[BiomePoolTier.BOSS_ULTRA_RARE]: []
}, },
[BiomeId.RUINS]: { [BiomeId.RUINS]: {
[BiomePoolTier.COMMON]: [ TrainerType.PSYCHIC, TrainerType.SCIENTIST ], [BiomePoolTier.COMMON]: [ TrainerType.PSYCHIC, TrainerType.SCIENTIST ],
@ -1883,10 +1817,7 @@ export const biomeTrainerPools: BiomeTrainerPools = {
[BiomePoolTier.RARE]: [], [BiomePoolTier.RARE]: [],
[BiomePoolTier.SUPER_RARE]: [], [BiomePoolTier.SUPER_RARE]: [],
[BiomePoolTier.ULTRA_RARE]: [], [BiomePoolTier.ULTRA_RARE]: [],
[BiomePoolTier.BOSS]: [ TrainerType.SABRINA, TrainerType.TATE, TrainerType.LIZA, TrainerType.TULIP ], [BiomePoolTier.BOSS]: [ TrainerType.SABRINA, TrainerType.TATE, TrainerType.LIZA, TrainerType.TULIP ]
[BiomePoolTier.BOSS_RARE]: [],
[BiomePoolTier.BOSS_SUPER_RARE]: [],
[BiomePoolTier.BOSS_ULTRA_RARE]: []
}, },
[BiomeId.WASTELAND]: { [BiomeId.WASTELAND]: {
[BiomePoolTier.COMMON]: [ TrainerType.VETERAN ], [BiomePoolTier.COMMON]: [ TrainerType.VETERAN ],
@ -1894,10 +1825,7 @@ export const biomeTrainerPools: BiomeTrainerPools = {
[BiomePoolTier.RARE]: [], [BiomePoolTier.RARE]: [],
[BiomePoolTier.SUPER_RARE]: [], [BiomePoolTier.SUPER_RARE]: [],
[BiomePoolTier.ULTRA_RARE]: [], [BiomePoolTier.ULTRA_RARE]: [],
[BiomePoolTier.BOSS]: [ TrainerType.CLAIR, TrainerType.DRAYDEN, TrainerType.RAIHAN ], [BiomePoolTier.BOSS]: [ TrainerType.CLAIR, TrainerType.DRAYDEN, TrainerType.RAIHAN ]
[BiomePoolTier.BOSS_RARE]: [],
[BiomePoolTier.BOSS_SUPER_RARE]: [],
[BiomePoolTier.BOSS_ULTRA_RARE]: []
}, },
[BiomeId.ABYSS]: { [BiomeId.ABYSS]: {
[BiomePoolTier.COMMON]: [], [BiomePoolTier.COMMON]: [],
@ -1905,10 +1833,7 @@ export const biomeTrainerPools: BiomeTrainerPools = {
[BiomePoolTier.RARE]: [], [BiomePoolTier.RARE]: [],
[BiomePoolTier.SUPER_RARE]: [], [BiomePoolTier.SUPER_RARE]: [],
[BiomePoolTier.ULTRA_RARE]: [], [BiomePoolTier.ULTRA_RARE]: [],
[BiomePoolTier.BOSS]: [ TrainerType.MARNIE ], [BiomePoolTier.BOSS]: [ TrainerType.MARNIE ]
[BiomePoolTier.BOSS_RARE]: [],
[BiomePoolTier.BOSS_SUPER_RARE]: [],
[BiomePoolTier.BOSS_ULTRA_RARE]: []
}, },
[BiomeId.SPACE]: { [BiomeId.SPACE]: {
[BiomePoolTier.COMMON]: [], [BiomePoolTier.COMMON]: [],
@ -1916,10 +1841,7 @@ export const biomeTrainerPools: BiomeTrainerPools = {
[BiomePoolTier.RARE]: [], [BiomePoolTier.RARE]: [],
[BiomePoolTier.SUPER_RARE]: [], [BiomePoolTier.SUPER_RARE]: [],
[BiomePoolTier.ULTRA_RARE]: [], [BiomePoolTier.ULTRA_RARE]: [],
[BiomePoolTier.BOSS]: [ TrainerType.OLYMPIA ], [BiomePoolTier.BOSS]: [ TrainerType.OLYMPIA ]
[BiomePoolTier.BOSS_RARE]: [],
[BiomePoolTier.BOSS_SUPER_RARE]: [],
[BiomePoolTier.BOSS_ULTRA_RARE]: []
}, },
[BiomeId.CONSTRUCTION_SITE]: { [BiomeId.CONSTRUCTION_SITE]: {
[BiomePoolTier.COMMON]: [ TrainerType.OFFICER, TrainerType.WORKER ], [BiomePoolTier.COMMON]: [ TrainerType.OFFICER, TrainerType.WORKER ],
@ -1927,10 +1849,7 @@ export const biomeTrainerPools: BiomeTrainerPools = {
[BiomePoolTier.RARE]: [], [BiomePoolTier.RARE]: [],
[BiomePoolTier.SUPER_RARE]: [], [BiomePoolTier.SUPER_RARE]: [],
[BiomePoolTier.ULTRA_RARE]: [], [BiomePoolTier.ULTRA_RARE]: [],
[BiomePoolTier.BOSS]: [ TrainerType.LT_SURGE, TrainerType.CHUCK, TrainerType.WATTSON ], [BiomePoolTier.BOSS]: [ TrainerType.LT_SURGE, TrainerType.CHUCK, TrainerType.WATTSON ]
[BiomePoolTier.BOSS_RARE]: [],
[BiomePoolTier.BOSS_SUPER_RARE]: [],
[BiomePoolTier.BOSS_ULTRA_RARE]: []
}, },
[BiomeId.JUNGLE]: { [BiomeId.JUNGLE]: {
[BiomePoolTier.COMMON]: [ TrainerType.BACKPACKER, TrainerType.RANGER ], [BiomePoolTier.COMMON]: [ TrainerType.BACKPACKER, TrainerType.RANGER ],
@ -1938,10 +1857,7 @@ export const biomeTrainerPools: BiomeTrainerPools = {
[BiomePoolTier.RARE]: [], [BiomePoolTier.RARE]: [],
[BiomePoolTier.SUPER_RARE]: [], [BiomePoolTier.SUPER_RARE]: [],
[BiomePoolTier.ULTRA_RARE]: [], [BiomePoolTier.ULTRA_RARE]: [],
[BiomePoolTier.BOSS]: [ TrainerType.RAMOS ], [BiomePoolTier.BOSS]: [ TrainerType.RAMOS ]
[BiomePoolTier.BOSS_RARE]: [],
[BiomePoolTier.BOSS_SUPER_RARE]: [],
[BiomePoolTier.BOSS_ULTRA_RARE]: []
}, },
[BiomeId.FAIRY_CAVE]: { [BiomeId.FAIRY_CAVE]: {
[BiomePoolTier.COMMON]: [ TrainerType.BEAUTY ], [BiomePoolTier.COMMON]: [ TrainerType.BEAUTY ],
@ -1949,10 +1865,7 @@ export const biomeTrainerPools: BiomeTrainerPools = {
[BiomePoolTier.RARE]: [], [BiomePoolTier.RARE]: [],
[BiomePoolTier.SUPER_RARE]: [], [BiomePoolTier.SUPER_RARE]: [],
[BiomePoolTier.ULTRA_RARE]: [], [BiomePoolTier.ULTRA_RARE]: [],
[BiomePoolTier.BOSS]: [ TrainerType.VALERIE, TrainerType.OPAL, TrainerType.BEDE ], [BiomePoolTier.BOSS]: [ TrainerType.VALERIE, TrainerType.OPAL, TrainerType.BEDE ]
[BiomePoolTier.BOSS_RARE]: [],
[BiomePoolTier.BOSS_SUPER_RARE]: [],
[BiomePoolTier.BOSS_ULTRA_RARE]: []
}, },
[BiomeId.TEMPLE]: { [BiomeId.TEMPLE]: {
[BiomePoolTier.COMMON]: [], [BiomePoolTier.COMMON]: [],
@ -1960,10 +1873,7 @@ export const biomeTrainerPools: BiomeTrainerPools = {
[BiomePoolTier.RARE]: [], [BiomePoolTier.RARE]: [],
[BiomePoolTier.SUPER_RARE]: [], [BiomePoolTier.SUPER_RARE]: [],
[BiomePoolTier.ULTRA_RARE]: [], [BiomePoolTier.ULTRA_RARE]: [],
[BiomePoolTier.BOSS]: [ TrainerType.FANTINA ], [BiomePoolTier.BOSS]: [ TrainerType.FANTINA ]
[BiomePoolTier.BOSS_RARE]: [],
[BiomePoolTier.BOSS_SUPER_RARE]: [],
[BiomePoolTier.BOSS_ULTRA_RARE]: []
}, },
[BiomeId.SLUM]: { [BiomeId.SLUM]: {
[BiomePoolTier.COMMON]: [ TrainerType.BIKER, TrainerType.OFFICER, TrainerType.ROUGHNECK ], [BiomePoolTier.COMMON]: [ TrainerType.BIKER, TrainerType.OFFICER, TrainerType.ROUGHNECK ],
@ -1971,10 +1881,7 @@ export const biomeTrainerPools: BiomeTrainerPools = {
[BiomePoolTier.RARE]: [], [BiomePoolTier.RARE]: [],
[BiomePoolTier.SUPER_RARE]: [], [BiomePoolTier.SUPER_RARE]: [],
[BiomePoolTier.ULTRA_RARE]: [], [BiomePoolTier.ULTRA_RARE]: [],
[BiomePoolTier.BOSS]: [ TrainerType.PIERS ], [BiomePoolTier.BOSS]: [ TrainerType.PIERS ]
[BiomePoolTier.BOSS_RARE]: [],
[BiomePoolTier.BOSS_SUPER_RARE]: [],
[BiomePoolTier.BOSS_ULTRA_RARE]: []
}, },
[BiomeId.SNOWY_FOREST]: { [BiomeId.SNOWY_FOREST]: {
[BiomePoolTier.COMMON]: [ TrainerType.SNOW_WORKER ], [BiomePoolTier.COMMON]: [ TrainerType.SNOW_WORKER ],
@ -1982,10 +1889,7 @@ export const biomeTrainerPools: BiomeTrainerPools = {
[BiomePoolTier.RARE]: [], [BiomePoolTier.RARE]: [],
[BiomePoolTier.SUPER_RARE]: [], [BiomePoolTier.SUPER_RARE]: [],
[BiomePoolTier.ULTRA_RARE]: [], [BiomePoolTier.ULTRA_RARE]: [],
[BiomePoolTier.BOSS]: [ TrainerType.CANDICE, TrainerType.MELONY ], [BiomePoolTier.BOSS]: [ TrainerType.CANDICE, TrainerType.MELONY ]
[BiomePoolTier.BOSS_RARE]: [],
[BiomePoolTier.BOSS_SUPER_RARE]: [],
[BiomePoolTier.BOSS_ULTRA_RARE]: []
}, },
[BiomeId.ISLAND]: { [BiomeId.ISLAND]: {
[BiomePoolTier.COMMON]: [ TrainerType.RICH_KID ], [BiomePoolTier.COMMON]: [ TrainerType.RICH_KID ],
@ -1993,21 +1897,15 @@ export const biomeTrainerPools: BiomeTrainerPools = {
[BiomePoolTier.RARE]: [], [BiomePoolTier.RARE]: [],
[BiomePoolTier.SUPER_RARE]: [], [BiomePoolTier.SUPER_RARE]: [],
[BiomePoolTier.ULTRA_RARE]: [], [BiomePoolTier.ULTRA_RARE]: [],
[BiomePoolTier.BOSS]: [ TrainerType.NESSA ], [BiomePoolTier.BOSS]: [ TrainerType.NESSA ]
[BiomePoolTier.BOSS_RARE]: [],
[BiomePoolTier.BOSS_SUPER_RARE]: [],
[BiomePoolTier.BOSS_ULTRA_RARE]: []
}, },
[BiomeId.LABORATORY]: { [BiomeId.LABORATORY]: {
[BiomePoolTier.COMMON]: [], [BiomePoolTier.COMMON]: [ TrainerType.SCIENTIST ],
[BiomePoolTier.UNCOMMON]: [], [BiomePoolTier.UNCOMMON]: [],
[BiomePoolTier.RARE]: [], [BiomePoolTier.RARE]: [],
[BiomePoolTier.SUPER_RARE]: [], [BiomePoolTier.SUPER_RARE]: [],
[BiomePoolTier.ULTRA_RARE]: [], [BiomePoolTier.ULTRA_RARE]: [],
[BiomePoolTier.BOSS]: [ TrainerType.GIOVANNI ], [BiomePoolTier.BOSS]: [ TrainerType.GIOVANNI ]
[BiomePoolTier.BOSS_RARE]: [],
[BiomePoolTier.BOSS_SUPER_RARE]: [],
[BiomePoolTier.BOSS_ULTRA_RARE]: []
}, },
[BiomeId.END]: { [BiomeId.END]: {
[BiomePoolTier.COMMON]: [], [BiomePoolTier.COMMON]: [],
@ -2015,13 +1913,9 @@ export const biomeTrainerPools: BiomeTrainerPools = {
[BiomePoolTier.RARE]: [], [BiomePoolTier.RARE]: [],
[BiomePoolTier.SUPER_RARE]: [], [BiomePoolTier.SUPER_RARE]: [],
[BiomePoolTier.ULTRA_RARE]: [], [BiomePoolTier.ULTRA_RARE]: [],
[BiomePoolTier.BOSS]: [], [BiomePoolTier.BOSS]: []
[BiomePoolTier.BOSS_RARE]: [],
[BiomePoolTier.BOSS_SUPER_RARE]: [],
[BiomePoolTier.BOSS_ULTRA_RARE]: []
} }
}; };
export function initBiomes() { export function initBiomes() {
const pokemonBiomes = [ const pokemonBiomes = [
[ SpeciesId.BULBASAUR, PokemonType.GRASS, PokemonType.POISON, [ [ SpeciesId.BULBASAUR, PokemonType.GRASS, PokemonType.POISON, [

View File

@ -43,5 +43,6 @@ export enum UiMode {
TEST_DIALOGUE, TEST_DIALOGUE,
AUTO_COMPLETE, AUTO_COMPLETE,
ADMIN, ADMIN,
MYSTERY_ENCOUNTER MYSTERY_ENCOUNTER,
CHANGE_PASSWORD_FORM,
} }

View File

@ -145,7 +145,7 @@ export class Arena {
? BiomePoolTier.BOSS_SUPER_RARE ? BiomePoolTier.BOSS_SUPER_RARE
: BiomePoolTier.BOSS_ULTRA_RARE; : BiomePoolTier.BOSS_ULTRA_RARE;
console.log(BiomePoolTier[tier]); console.log(BiomePoolTier[tier]);
while (!this.pokemonPool[tier].length) { while (!this.pokemonPool[tier]?.length) {
console.log(`Downgraded rarity tier from ${BiomePoolTier[tier]} to ${BiomePoolTier[tier - 1]}`); console.log(`Downgraded rarity tier from ${BiomePoolTier[tier]} to ${BiomePoolTier[tier - 1]}`);
tier--; tier--;
} }

View File

@ -1,4 +1,5 @@
import { applyAbAttrs } from "#abilities/apply-ab-attrs"; import { applyAbAttrs } from "#abilities/apply-ab-attrs";
import type { TurnCommand } from "#app/battle";
import { globalScene } from "#app/global-scene"; import { globalScene } from "#app/global-scene";
import { TrickRoomTag } from "#data/arena-tag"; import { TrickRoomTag } from "#data/arena-tag";
import { allMoves } from "#data/data-lists"; import { allMoves } from "#data/data-lists";
@ -14,19 +15,20 @@ import { BooleanHolder, randSeedShuffle } from "#utils/common";
export class TurnStartPhase extends FieldPhase { export class TurnStartPhase extends FieldPhase {
public readonly phaseName = "TurnStartPhase"; public readonly phaseName = "TurnStartPhase";
/** /**
* This orders the active Pokemon on the field by speed into an BattlerIndex array and returns that array. * This orders the active Pokemon on the field by speed into an BattlerIndex array and returns that array.
* It also checks for Trick Room and reverses the array if it is present. * It also checks for Trick Room and reverses the array if it is present.
* @returns {@linkcode BattlerIndex[]} the battle indices of all pokemon on the field ordered by speed * @returns An array of {@linkcode BattlerIndex}es containing all on-field Pokemon sorted in speed order.
*/ */
getSpeedOrder(): BattlerIndex[] { getSpeedOrder(): BattlerIndex[] {
const playerField = globalScene.getPlayerField().filter(p => p.isActive()) as Pokemon[]; const playerField = globalScene.getPlayerField().filter(p => p.isActive());
const enemyField = globalScene.getEnemyField().filter(p => p.isActive()) as Pokemon[]; const enemyField = globalScene.getEnemyField().filter(p => p.isActive());
// We shuffle the list before sorting so speed ties produce random results // Shuffle the list before sorting so speed ties produce random results
let orderedTargets: Pokemon[] = playerField.concat(enemyField); // This is seeded with the current turn to prevent turn order varying
// We seed it with the current turn to prevent an inconsistency where it // based on how long since you last reloaded.
// was varying based on how long since you last reloaded let orderedTargets = (playerField as Pokemon[]).concat(enemyField);
globalScene.executeWithSeedOffset( globalScene.executeWithSeedOffset(
() => { () => {
orderedTargets = randSeedShuffle(orderedTargets); orderedTargets = randSeedShuffle(orderedTargets);
@ -35,25 +37,25 @@ export class TurnStartPhase extends FieldPhase {
globalScene.waveSeed, globalScene.waveSeed,
); );
// Next, a check for Trick Room is applied to determine sort order. // Check for Trick Room and reverse sort order if active.
// Notably, Pokerogue does NOT have the "outspeed trick room" glitch at >1809 spd.
const speedReversed = new BooleanHolder(false); const speedReversed = new BooleanHolder(false);
globalScene.arena.applyTags(TrickRoomTag, false, speedReversed); globalScene.arena.applyTags(TrickRoomTag, false, speedReversed);
// Adjust the sort function based on whether Trick Room is active.
orderedTargets.sort((a: Pokemon, b: Pokemon) => { orderedTargets.sort((a: Pokemon, b: Pokemon) => {
const aSpeed = a?.getEffectiveStat(Stat.SPD) ?? 0; const aSpeed = a.getEffectiveStat(Stat.SPD);
const bSpeed = b?.getEffectiveStat(Stat.SPD) ?? 0; const bSpeed = b.getEffectiveStat(Stat.SPD);
return speedReversed.value ? aSpeed - bSpeed : bSpeed - aSpeed; return speedReversed.value ? aSpeed - bSpeed : bSpeed - aSpeed;
}); });
return orderedTargets.map(t => t.getFieldIndex() + (!t.isPlayer() ? BattlerIndex.ENEMY : BattlerIndex.PLAYER)); return orderedTargets.map(t => t.getFieldIndex() + (t.isEnemy() ? BattlerIndex.ENEMY : BattlerIndex.PLAYER));
} }
/** /**
* This takes the result of getSpeedOrder and applies priority / bypass speed attributes to it. * This takes the result of getSpeedOrder and applies priority / bypass speed attributes to it.
* This also considers the priority levels of various commands and changes the result of getSpeedOrder based on such. * This also considers the priority levels of various commands and changes the result of `getSpeedOrder` based on such.
* @returns {@linkcode BattlerIndex[]} the final sequence of commands for this turn * @returns An array of {@linkcode BattlerIndex}es containing all on-field Pokemon sorted in action order.
*/ */
getCommandOrder(): BattlerIndex[] { getCommandOrder(): BattlerIndex[] {
let moveOrder = this.getSpeedOrder(); let moveOrder = this.getSpeedOrder();
@ -114,7 +116,8 @@ export class TurnStartPhase extends FieldPhase {
} }
} }
// If there is no difference between the move's calculated priorities, the game checks for differences in battlerBypassSpeed and returns the result. // If there is no difference between the move's calculated priorities,
// check for differences in battlerBypassSpeed and returns the result.
if (battlerBypassSpeed[a].value !== battlerBypassSpeed[b].value) { if (battlerBypassSpeed[a].value !== battlerBypassSpeed[b].value) {
return battlerBypassSpeed[a].value ? -1 : 1; return battlerBypassSpeed[a].value ? -1 : 1;
} }
@ -135,8 +138,6 @@ export class TurnStartPhase extends FieldPhase {
const field = globalScene.getField(); const field = globalScene.getField();
const moveOrder = this.getCommandOrder(); const moveOrder = this.getCommandOrder();
let orderIndex = 0;
for (const o of this.getSpeedOrder()) { for (const o of this.getSpeedOrder()) {
const pokemon = field[o]; const pokemon = field[o];
const preTurnCommand = globalScene.currentBattle.preTurnCommands[o]; const preTurnCommand = globalScene.currentBattle.preTurnCommands[o];
@ -153,71 +154,24 @@ export class TurnStartPhase extends FieldPhase {
const phaseManager = globalScene.phaseManager; const phaseManager = globalScene.phaseManager;
for (const o of moveOrder) { moveOrder.forEach((o, index) => {
const pokemon = field[o]; const pokemon = field[o];
const turnCommand = globalScene.currentBattle.turnCommands[o]; const turnCommand = globalScene.currentBattle.turnCommands[o];
if (turnCommand?.skip) { if (!turnCommand || turnCommand.skip) {
continue; return;
} }
switch (turnCommand?.command) { // TODO: Remove `turnData.order` -
case Command.FIGHT: { // it is used exclusively for Fusion Flare/Bolt
const queuedMove = turnCommand.move; // and uses a really jank implementation
pokemon.turnData.order = orderIndex++; if (turnCommand.command === Command.FIGHT) {
if (!queuedMove) { pokemon.turnData.order = index;
continue;
}
const move =
pokemon.getMoveset().find(m => m.moveId === queuedMove.move && m.ppUsed < m.getMovePp()) ??
new PokemonMove(queuedMove.move);
if (move.getMove().hasAttr("MoveHeaderAttr")) {
phaseManager.unshiftNew("MoveHeaderPhase", pokemon, move);
} }
this.handleTurnCommand(turnCommand, pokemon);
});
if (pokemon.isPlayer() && turnCommand.cursor === -1) { // Queue various effects for the end of the turn.
phaseManager.pushNew(
"MovePhase",
pokemon,
turnCommand.targets || turnCommand.move!.targets,
move,
turnCommand.move!.useMode,
); //TODO: is the bang correct here?
} else {
phaseManager.pushNew(
"MovePhase",
pokemon,
turnCommand.targets || turnCommand.move!.targets,
move,
queuedMove.useMode,
); // TODO: is the bang correct here?
}
break;
}
case Command.BALL:
phaseManager.unshiftNew("AttemptCapturePhase", turnCommand.targets![0] % 2, turnCommand.cursor!); //TODO: is the bang correct here?
break;
case Command.POKEMON:
{
const switchType = turnCommand.args?.[0] ? SwitchType.BATON_PASS : SwitchType.SWITCH;
phaseManager.unshiftNew(
"SwitchSummonPhase",
switchType,
pokemon.getFieldIndex(),
turnCommand.cursor!,
true,
pokemon.isPlayer(),
);
}
break;
case Command.RUN:
{
// Running (like ball throwing) is a team action taking up both Pokemon's turns.
phaseManager.unshiftNew("AttemptRunPhase");
}
break;
}
}
phaseManager.pushNew("CheckInterludePhase"); phaseManager.pushNew("CheckInterludePhase");
// TODO: Re-order these phases to be consistent with mainline turn order: // TODO: Re-order these phases to be consistent with mainline turn order:
@ -239,4 +193,52 @@ export class TurnStartPhase extends FieldPhase {
*/ */
this.end(); this.end();
} }
private handleTurnCommand(turnCommand: TurnCommand, pokemon: Pokemon) {
switch (turnCommand?.command) {
case Command.FIGHT:
this.handleFightCommand(turnCommand, pokemon);
break;
case Command.BALL:
globalScene.phaseManager.unshiftNew("AttemptCapturePhase", turnCommand.targets![0] % 2, turnCommand.cursor!); //TODO: is the bang correct here?
break;
case Command.POKEMON:
globalScene.phaseManager.unshiftNew(
"SwitchSummonPhase",
turnCommand.args?.[0] ? SwitchType.BATON_PASS : SwitchType.SWITCH,
pokemon.getFieldIndex(),
turnCommand.cursor!, // TODO: Is this bang correct?
true,
pokemon.isPlayer(),
);
break;
case Command.RUN:
globalScene.phaseManager.unshiftNew("AttemptRunPhase");
break;
}
}
private handleFightCommand(turnCommand: TurnCommand, pokemon: Pokemon) {
const queuedMove = turnCommand.move;
if (!queuedMove) {
return;
}
// TODO: This seems somewhat dubious
const move =
pokemon.getMoveset().find(m => m.moveId === queuedMove.move && m.ppUsed < m.getMovePp()) ??
new PokemonMove(queuedMove.move);
if (move.getMove().hasAttr("MoveHeaderAttr")) {
globalScene.phaseManager.unshiftNew("MoveHeaderPhase", pokemon, move);
}
globalScene.phaseManager.pushNew(
"MovePhase",
pokemon,
turnCommand.targets ?? queuedMove.targets,
move,
queuedMove.useMode,
);
}
} }

View File

@ -1,6 +1,7 @@
import { ApiBase } from "#api/api-base"; import { ApiBase } from "#api/api-base";
import { SESSION_ID_COOKIE_NAME } from "#app/constants"; import { SESSION_ID_COOKIE_NAME } from "#app/constants";
import type { import type {
AccountChangePwRequest,
AccountInfoResponse, AccountInfoResponse,
AccountLoginRequest, AccountLoginRequest,
AccountLoginResponse, AccountLoginResponse,
@ -95,4 +96,19 @@ export class PokerogueAccountApi extends ApiBase {
removeCookie(SESSION_ID_COOKIE_NAME); // we are always clearing the cookie. removeCookie(SESSION_ID_COOKIE_NAME); // we are always clearing the cookie.
} }
public async changePassword(changePwData: AccountChangePwRequest) {
try {
const response = await this.doPost("/account/changepw", changePwData, "form-urlencoded");
if (response.ok) {
return null;
}
console.warn("Change password failed!", response.status, response.statusText);
return response.text();
} catch (err) {
console.warn("Change password failed!", err);
}
return "Unknown error!";
}
} }

View File

@ -0,0 +1,124 @@
import { globalScene } from "#app/global-scene";
import { pokerogueApi } from "#app/plugins/api/pokerogue-api";
import { UiMode } from "#enums/ui-mode";
import type { InputFieldConfig } from "#ui/form-modal-ui-handler";
import { FormModalUiHandler } from "#ui/form-modal-ui-handler";
import type { ModalConfig } from "#ui/modal-ui-handler";
import i18next from "i18next";
export class ChangePasswordFormUiHandler extends FormModalUiHandler {
private readonly ERR_PASSWORD: string = "invalid password";
private readonly ERR_ACCOUNT_EXIST: string = "account doesn't exist";
private readonly ERR_PASSWORD_MISMATCH: string = "password doesn't match";
constructor(mode: UiMode | null = null) {
super(mode);
}
setup(): void {
super.setup();
}
override getModalTitle(_config?: ModalConfig): string {
return i18next.t("menu:changePassword");
}
override getWidth(_config?: ModalConfig): number {
return 160;
}
override getMargin(_config?: ModalConfig): [number, number, number, number] {
return [0, 0, 48, 0];
}
override getButtonLabels(_config?: ModalConfig): string[] {
return [i18next.t("settings:buttonSubmit"), i18next.t("menu:cancel")];
}
override getReadableErrorMessage(error: string): string {
const colonIndex = error?.indexOf(":");
if (colonIndex > 0) {
error = error.slice(0, colonIndex);
}
switch (error) {
case this.ERR_PASSWORD:
return i18next.t("menu:invalidRegisterPassword");
case this.ERR_ACCOUNT_EXIST:
return i18next.t("menu:accountNonExistent");
case this.ERR_PASSWORD_MISMATCH:
return i18next.t("menu:passwordNotMatchingConfirmPassword");
}
return super.getReadableErrorMessage(error);
}
override getInputFieldConfigs(): InputFieldConfig[] {
const inputFieldConfigs: InputFieldConfig[] = [];
inputFieldConfigs.push({
label: i18next.t("menu:password"),
isPassword: true,
});
inputFieldConfigs.push({
label: i18next.t("menu:confirmPassword"),
isPassword: true,
});
return inputFieldConfigs;
}
override show(args: [ModalConfig, ...any]): boolean {
if (super.show(args)) {
const config = args[0];
const originalSubmitAction = this.submitAction;
this.submitAction = () => {
if (globalScene.tweens.getTweensOf(this.modalContainer).length === 0) {
// Prevent overlapping overrides on action modification
this.submitAction = originalSubmitAction;
this.sanitizeInputs();
globalScene.ui.setMode(UiMode.LOADING, { buttonActions: [] });
const onFail = (error: string | null) => {
globalScene.ui.setMode(UiMode.CHANGE_PASSWORD_FORM, Object.assign(config, { errorMessage: error?.trim() }));
globalScene.ui.playError();
};
const [passwordInput, confirmPasswordInput] = this.inputs;
if (!passwordInput?.text) {
return onFail(this.getReadableErrorMessage("invalid password"));
}
if (passwordInput.text !== confirmPasswordInput.text) {
return onFail(this.ERR_PASSWORD_MISMATCH);
}
pokerogueApi.account.changePassword({ password: passwordInput.text }).then(error => {
if (!error && originalSubmitAction) {
globalScene.ui.playSelect();
originalSubmitAction();
// Only clear inputs if the action was successful
for (const input of this.inputs) {
input.setText("");
}
} else {
onFail(error);
}
});
}
};
// Upon pressing cancel, the inputs should be cleared
const originalCancelAction = this.cancelAction;
this.cancelAction = () => {
globalScene.ui.playSelect();
for (const input of this.inputs) {
input.setText("");
}
originalCancelAction?.();
};
return true;
}
return false;
}
override clear() {
super.clear();
this.setMouseCursorStyle("default"); //reset cursor
}
}

View File

@ -19,6 +19,7 @@ export abstract class FormModalUiHandler extends ModalUiHandler {
protected inputs: InputText[]; protected inputs: InputText[];
protected errorMessage: Phaser.GameObjects.Text; protected errorMessage: Phaser.GameObjects.Text;
protected submitAction: Function | null; protected submitAction: Function | null;
protected cancelAction: (() => void) | null;
protected tween: Phaser.Tweens.Tween; protected tween: Phaser.Tweens.Tween;
protected formLabels: Phaser.GameObjects.Text[]; protected formLabels: Phaser.GameObjects.Text[];
@ -126,22 +127,37 @@ export abstract class FormModalUiHandler extends ModalUiHandler {
}); });
} }
show(args: any[]): boolean { override show(args: any[]): boolean {
if (super.show(args)) { if (super.show(args)) {
this.inputContainers.map(ic => ic.setVisible(true)); this.inputContainers.map(ic => ic.setVisible(true));
const config = args[0] as FormModalConfig; const config = args[0] as FormModalConfig;
this.submitAction = config.buttonActions.length ? config.buttonActions[0] : null; this.submitAction = config.buttonActions.length ? config.buttonActions[0] : null;
this.cancelAction = config.buttonActions[1] ?? null;
// #region: Override button pointerDown
// Override the pointerDown event for the buttonBgs to call the `submitAction` and `cancelAction`
// properties that we set above, allowing their behavior to change after this method terminates
// Some subclasses use this to add behavior to the submit and cancel action
if (this.buttonBgs.length) {
this.buttonBgs[0].off("pointerdown"); this.buttonBgs[0].off("pointerdown");
this.buttonBgs[0].on("pointerdown", () => { this.buttonBgs[0].on("pointerdown", () => {
if (this.submitAction && globalScene.tweens.getTweensOf(this.modalContainer).length === 0) { if (this.submitAction && globalScene.tweens.getTweensOf(this.modalContainer).length === 0) {
this.submitAction(); this.submitAction();
} }
}); });
const cancelBg = this.buttonBgs[1];
if (cancelBg) {
cancelBg.off("pointerdown");
cancelBg.on("pointerdown", () => {
// The seemingly redundant cancelAction check is intentionally left in as a defensive programming measure
if (this.cancelAction && globalScene.tweens.getTweensOf(this.modalContainer).length === 0) {
this.cancelAction();
} }
});
}
//#endregion: Override pointerDown events
this.modalContainer.y += 24; this.modalContainer.y += 24;
this.modalContainer.setAlpha(0); this.modalContainer.setAlpha(0);

View File

@ -311,6 +311,17 @@ export class MenuUiHandler extends MessageUiHandler {
}, },
keepOpen: true, keepOpen: true,
}, },
{
// Note: i18n key is under `menu`, not `menuUiHandler` to avoid duplication
label: i18next.t("menu:changePassword"),
handler: () => {
ui.setOverlayMode(UiMode.CHANGE_PASSWORD_FORM, {
buttonActions: [() => ui.revertMode(), () => ui.revertMode()],
});
return true;
},
keepOpen: true,
},
{ {
label: i18next.t("menuUiHandler:consentPreferences"), label: i18next.t("menuUiHandler:consentPreferences"),
handler: () => { handler: () => {

View File

@ -7,7 +7,7 @@ import { UiHandler } from "#ui/ui-handler";
import { addWindow, WindowVariant } from "#ui/ui-theme"; import { addWindow, WindowVariant } from "#ui/ui-theme";
export interface ModalConfig { export interface ModalConfig {
buttonActions: Function[]; buttonActions: ((...args: any[]) => any)[];
} }
export abstract class ModalUiHandler extends UiHandler { export abstract class ModalUiHandler extends UiHandler {

View File

@ -13,6 +13,7 @@ import { BallUiHandler } from "#ui/ball-ui-handler";
import { BattleMessageUiHandler } from "#ui/battle-message-ui-handler"; import { BattleMessageUiHandler } from "#ui/battle-message-ui-handler";
import type { BgmBar } from "#ui/bgm-bar"; import type { BgmBar } from "#ui/bgm-bar";
import { GameChallengesUiHandler } from "#ui/challenges-select-ui-handler"; import { GameChallengesUiHandler } from "#ui/challenges-select-ui-handler";
import { ChangePasswordFormUiHandler } from "#ui/change-password-form-ui-handler";
import { CommandUiHandler } from "#ui/command-ui-handler"; import { CommandUiHandler } from "#ui/command-ui-handler";
import { ConfirmUiHandler } from "#ui/confirm-ui-handler"; import { ConfirmUiHandler } from "#ui/confirm-ui-handler";
import { EggGachaUiHandler } from "#ui/egg-gacha-ui-handler"; import { EggGachaUiHandler } from "#ui/egg-gacha-ui-handler";
@ -102,6 +103,7 @@ const noTransitionModes = [
UiMode.ADMIN, UiMode.ADMIN,
UiMode.MYSTERY_ENCOUNTER, UiMode.MYSTERY_ENCOUNTER,
UiMode.RUN_INFO, UiMode.RUN_INFO,
UiMode.CHANGE_PASSWORD_FORM,
]; ];
export class UI extends Phaser.GameObjects.Container { export class UI extends Phaser.GameObjects.Container {
@ -172,6 +174,7 @@ export class UI extends Phaser.GameObjects.Container {
new AutoCompleteUiHandler(), new AutoCompleteUiHandler(),
new AdminUiHandler(), new AdminUiHandler(),
new MysteryEncounterUiHandler(), new MysteryEncounterUiHandler(),
new ChangePasswordFormUiHandler(),
]; ];
} }