From 81a4020698513b49ddf05bc16e1fa551fbdf4bcf Mon Sep 17 00:00:00 2001 From: NightKev <34855794+DayKev@users.noreply.github.com> Date: Sat, 2 Aug 2025 13:45:13 -0700 Subject: [PATCH] Reduce array allocations and function calls Co-authored-by: Bertie690 <136088738+Bertie690@users.noreply.github.com> --- src/data/challenge.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/data/challenge.ts b/src/data/challenge.ts index 2419b11c9fe..fd6528bb3bc 100644 --- a/src/data/challenge.ts +++ b/src/data/challenge.ts @@ -711,7 +711,8 @@ export class FreshStartChallenge extends Challenge { pokemon.moveset = pokemon.moveset.filter(pm => validMoves.includes(pm.moveId)); if (pokemon.moveset.length < 4) { // If there's empty slots fill with remaining valid moves - validMoves = validMoves.filter(m => !pokemon.moveset.map(pm => pm.moveId).includes(m)); + const existingMoveIds = pokemon.moveset.map(pm => pm.moveId); + validMoves = validMoves.filter(m => !existingMoveIds.includes(m)); pokemon.moveset = pokemon.moveset.concat(validMoves.map(m => new PokemonMove(m))).slice(0, 4); } pokemon.luck = 0; // No luck