From 1f5e0898182d763617dcc3d3882b20235a8f683e Mon Sep 17 00:00:00 2001 From: AJ Fontaine <36677462+Fontbane@users.noreply.github.com> Date: Sat, 2 Aug 2025 16:48:51 -0400 Subject: [PATCH] [Beta] Remove non-Legend Fresh Start option, fix starting movesets https://github.com/pagefaultgames/pokerogue/pull/6196 * Remove non-Legend fresh start option, fix starting movesets * Move updateInfo call * Fix relearns counting for starter moves * Reduce array allocations and function calls --- src/data/challenge.ts | 27 ++++++++++++++------------- src/phases/select-starter-phase.ts | 6 +++++- 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/src/data/challenge.ts b/src/data/challenge.ts index aaa82a7d20f..fd6528bb3bc 100644 --- a/src/data/challenge.ts +++ b/src/data/challenge.ts @@ -4,7 +4,6 @@ import { defaultStarterSpecies } from "#app/constants"; import { globalScene } from "#app/global-scene"; import { pokemonEvolutions } from "#balance/pokemon-evolutions"; import { speciesStarterCosts } from "#balance/starters"; -import { getEggTierForSpecies } from "#data/egg"; import { pokemonFormChanges } from "#data/pokemon-forms"; import type { PokemonSpecies } from "#data/pokemon-species"; import { getPokemonSpeciesForm } from "#data/pokemon-species"; @@ -12,7 +11,6 @@ import { BattleType } from "#enums/battle-type"; import { ChallengeType } from "#enums/challenge-type"; import { Challenges } from "#enums/challenges"; import { TypeColor, TypeShadow } from "#enums/color"; -import { EggTier } from "#enums/egg-type"; import { ClassicFixedBossWaves } from "#enums/fixed-boss-waves"; import { ModifierTier } from "#enums/modifier-tier"; import type { MoveId } from "#enums/move-id"; @@ -26,7 +24,7 @@ import type { Pokemon } from "#field/pokemon"; import { Trainer } from "#field/trainer"; import { PokemonMove } from "#moves/pokemon-move"; import type { DexAttrProps, GameData } from "#system/game-data"; -import { BooleanHolder, type NumberHolder, randSeedItem } from "#utils/common"; +import { BooleanHolder, isBetween, type NumberHolder, randSeedItem } from "#utils/common"; import { deepCopy } from "#utils/data"; import { getPokemonSpecies } from "#utils/pokemon-utils"; import { toCamelCase, toSnakeCase } from "#utils/strings"; @@ -685,14 +683,11 @@ export class SingleTypeChallenge extends Challenge { */ export class FreshStartChallenge extends Challenge { constructor() { - super(Challenges.FRESH_START, 3); + super(Challenges.FRESH_START, 2); } applyStarterChoice(pokemon: PokemonSpecies, valid: BooleanHolder): boolean { - if ( - (this.value === 1 && !defaultStarterSpecies.includes(pokemon.speciesId)) || - (this.value === 2 && getEggTierForSpecies(pokemon) >= EggTier.EPIC) - ) { + if (this.value === 1 && !defaultStarterSpecies.includes(pokemon.speciesId)) { valid.value = false; return true; } @@ -708,12 +703,18 @@ export class FreshStartChallenge extends Challenge { pokemon.abilityIndex = pokemon.abilityIndex % 2; // Always base ability, if you set it to hidden it wraps to first ability pokemon.passive = false; // Passive isn't unlocked pokemon.nature = Nature.HARDY; // Neutral nature - pokemon.moveset = pokemon.species + let validMoves = pokemon.species .getLevelMoves() - .filter(m => m[0] <= 5) - .map(lm => lm[1]) - .slice(0, 4) - .map(m => new PokemonMove(m)); // No egg moves + .filter(m => isBetween(m[0], 1, 5)) + .map(lm => lm[1]); + // Filter egg moves out of the moveset + 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 + 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 pokemon.shiny = false; // Not shiny pokemon.variant = 0; // Not shiny diff --git a/src/phases/select-starter-phase.ts b/src/phases/select-starter-phase.ts index 6456bacd0e3..d6bd252c77d 100644 --- a/src/phases/select-starter-phase.ts +++ b/src/phases/select-starter-phase.ts @@ -99,8 +99,12 @@ export class SelectStarterPhase extends Phase { starterPokemon.generateFusionSpecies(true); } starterPokemon.setVisible(false); - applyChallenges(ChallengeType.STARTER_MODIFY, starterPokemon); + const chalApplied = applyChallenges(ChallengeType.STARTER_MODIFY, starterPokemon); party.push(starterPokemon); + if (chalApplied) { + // If any challenges modified the starter, it should update + loadPokemonAssets.push(starterPokemon.updateInfo()); + } loadPokemonAssets.push(starterPokemon.loadAssets()); }); overrideModifiers();