From 2fe99cc3bfaa67e321152559148571992a7485bf Mon Sep 17 00:00:00 2001 From: Wlowscha <54003515+Wlowscha@users.noreply.github.com> Date: Sun, 21 Sep 2025 20:07:08 +0200 Subject: [PATCH] [Refactor] Refactor `Starter` and its handling (#6477) * Reworked `Starter` interface with more explicit information * Use Starter in ssui * Fixed some bugs * Passing starter.ivs to playerPokemon * Using speciesIds * Fixed getTestRunStarters * Reverted some parameter changes * Initialize starters in ssui * Don't clear starters before starting run * Fix to game manager * Apply suggestions from code review Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> * Set ivs to 0 in part timer test * Setting the right ivs * Moved ssui to handlers folder * Ran biome all * Fixed broken imports --------- Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> --- src/@types/save-data.ts | 18 +++ src/data/daily-run.ts | 9 +- src/phases/select-starter-phase.ts | 32 +++-- src/phases/title-phase.ts | 19 ++- src/ui/handlers/starter-select-ui-handler.ts | 117 ++++++++---------- .../encounters/part-timer-encounter.test.ts | 1 + test/test-utils/game-manager-utils.ts | 52 ++++---- test/test-utils/game-manager.ts | 6 +- .../helpers/challenge-mode-helper.ts | 6 +- .../test-utils/helpers/classic-mode-helper.ts | 6 +- 10 files changed, 137 insertions(+), 129 deletions(-) diff --git a/src/@types/save-data.ts b/src/@types/save-data.ts index 4c20d63da53..ae359c20949 100644 --- a/src/@types/save-data.ts +++ b/src/@types/save-data.ts @@ -4,8 +4,10 @@ import type { BattleType } from "#enums/battle-type"; import type { GameModes } from "#enums/game-modes"; import type { MoveId } from "#enums/move-id"; import type { MysteryEncounterType } from "#enums/mystery-encounter-type"; +import type { Nature } from "#enums/nature"; import type { PlayerGender } from "#enums/player-gender"; import type { PokemonType } from "#enums/pokemon-type"; +import type { SpeciesId } from "#enums/species-id"; import type { MysteryEncounterSaveData } from "#mystery-encounters/mystery-encounter-save-data"; import type { Variant } from "#sprites/variant"; import type { ArenaData } from "#system/arena-data"; @@ -108,6 +110,22 @@ export interface DexAttrProps { formIndex: number; } +export interface Starter { + speciesId: SpeciesId; + shiny: boolean; + variant: Variant; + formIndex: number; + female?: boolean; + abilityIndex: number; + passive: boolean; + nature: Nature; + moveset?: StarterMoveset; + pokerus: boolean; + nickname?: string; + teraType?: PokemonType; + ivs: number[]; +} + export type RunHistoryData = Record; export interface RunEntry { diff --git a/src/data/daily-run.ts b/src/data/daily-run.ts index 5f49b9adbb0..776dff1bf46 100644 --- a/src/data/daily-run.ts +++ b/src/data/daily-run.ts @@ -6,7 +6,7 @@ import { PokemonSpecies } from "#data/pokemon-species"; import { BiomeId } from "#enums/biome-id"; import { PartyMemberStrength } from "#enums/party-member-strength"; import { SpeciesId } from "#enums/species-id"; -import type { Starter } from "#ui/starter-select-ui-handler"; +import type { Starter } from "#types/save-data"; import { randSeedGauss, randSeedInt, randSeedItem } from "#utils/common"; import { getEnumValues } from "#utils/enums"; import { getPokemonSpecies, getPokemonSpeciesForm } from "#utils/pokemon-utils"; @@ -66,8 +66,11 @@ function getDailyRunStarter(starterSpeciesForm: PokemonSpeciesForm, startingLeve const formIndex = starterSpeciesForm instanceof PokemonSpecies ? undefined : starterSpeciesForm.formIndex; const pokemon = globalScene.addPlayerPokemon(starterSpecies, startingLevel, undefined, formIndex); const starter: Starter = { - species: starterSpecies, - dexAttr: pokemon.getDexAttr(), + speciesId: starterSpecies.speciesId, + shiny: pokemon.shiny, + variant: pokemon.variant, + formIndex: pokemon.formIndex, + ivs: pokemon.ivs, abilityIndex: pokemon.abilityIndex, passive: false, nature: pokemon.getNature(), diff --git a/src/phases/select-starter-phase.ts b/src/phases/select-starter-phase.ts index 27e2150fd06..e923efaa678 100644 --- a/src/phases/select-starter-phase.ts +++ b/src/phases/select-starter-phase.ts @@ -4,11 +4,10 @@ import { Phase } from "#app/phase"; import { SpeciesFormChangeMoveLearnedTrigger } from "#data/form-change-triggers"; import { Gender } from "#data/gender"; import { ChallengeType } from "#enums/challenge-type"; -import type { SpeciesId } from "#enums/species-id"; import { UiMode } from "#enums/ui-mode"; import { overrideHeldItems, overrideModifiers } from "#modifiers/modifier"; -import { SaveSlotUiMode } from "#ui/save-slot-select-ui-handler"; -import type { Starter } from "#ui/starter-select-ui-handler"; +import type { Starter } from "#types/save-data"; +import { SaveSlotUiMode } from "#ui/handlers/save-slot-select-ui-handler"; import { applyChallenges } from "#utils/challenge-utils"; import { getPokemonSpecies } from "#utils/pokemon-utils"; import SoundFade from "phaser3-rex-plugins/plugins/soundfade"; @@ -44,33 +43,32 @@ export class SelectStarterPhase extends Phase { const loadPokemonAssets: Promise[] = []; starters.forEach((starter: Starter, i: number) => { if (!i && Overrides.STARTER_SPECIES_OVERRIDE) { - starter.species = getPokemonSpecies(Overrides.STARTER_SPECIES_OVERRIDE as SpeciesId); + starter.speciesId = Overrides.STARTER_SPECIES_OVERRIDE; } - const starterProps = globalScene.gameData.getSpeciesDexAttrProps(starter.species, starter.dexAttr); - let starterFormIndex = Math.min(starterProps.formIndex, Math.max(starter.species.forms.length - 1, 0)); + const species = getPokemonSpecies(starter.speciesId); + let starterFormIndex = starter.formIndex; if ( - starter.species.speciesId in Overrides.STARTER_FORM_OVERRIDES - && Overrides.STARTER_FORM_OVERRIDES[starter.species.speciesId] != null - && starter.species.forms[Overrides.STARTER_FORM_OVERRIDES[starter.species.speciesId]!] + starter.speciesId in Overrides.STARTER_FORM_OVERRIDES + && Overrides.STARTER_FORM_OVERRIDES[starter.speciesId] != null + && species.forms[Overrides.STARTER_FORM_OVERRIDES[starter.speciesId]!] ) { - starterFormIndex = Overrides.STARTER_FORM_OVERRIDES[starter.species.speciesId]!; + starterFormIndex = Overrides.STARTER_FORM_OVERRIDES[starter.speciesId]!; } let starterGender = - starter.species.malePercent !== null ? (!starterProps.female ? Gender.MALE : Gender.FEMALE) : Gender.GENDERLESS; + species.malePercent !== null ? (!starter.female ? Gender.MALE : Gender.FEMALE) : Gender.GENDERLESS; if (Overrides.GENDER_OVERRIDE !== null) { starterGender = Overrides.GENDER_OVERRIDE; } - const starterIvs = globalScene.gameData.dexData[starter.species.speciesId].ivs.slice(0); const starterPokemon = globalScene.addPlayerPokemon( - starter.species, + species, globalScene.gameMode.getStartingLevel(), starter.abilityIndex, starterFormIndex, starterGender, - starterProps.shiny, - starterProps.variant, - starterIvs, + starter.shiny, + starter.variant, + starter.ivs, starter.nature, ); starter.moveset && starterPokemon.tryPopulateMoveset(starter.moveset); @@ -78,7 +76,7 @@ export class SelectStarterPhase extends Phase { starterPokemon.passive = true; } starterPokemon.luck = globalScene.gameData.getDexAttrLuck( - globalScene.gameData.dexData[starter.species.speciesId].caughtAttr, + globalScene.gameData.dexData[species.speciesId].caughtAttr, ); if (starter.pokerus) { starterPokemon.pokerus = true; diff --git a/src/phases/title-phase.ts b/src/phases/title-phase.ts index 1920db8d20e..9535ea1c8e9 100644 --- a/src/phases/title-phase.ts +++ b/src/phases/title-phase.ts @@ -19,6 +19,7 @@ import type { SessionSaveData } from "#types/save-data"; import type { OptionSelectConfig, OptionSelectItem } from "#ui/abstract-option-select-ui-handler"; import { SaveSlotUiMode } from "#ui/save-slot-select-ui-handler"; import { isLocal, isLocalServerConnected } from "#utils/common"; +import { getPokemonSpecies } from "#utils/pokemon-utils"; import i18next from "i18next"; export class TitlePhase extends Phase { @@ -218,23 +219,19 @@ export class TitlePhase extends Phase { const party = globalScene.getPlayerParty(); const loadPokemonAssets: Promise[] = []; for (const starter of starters) { - const starterProps = globalScene.gameData.getSpeciesDexAttrProps(starter.species, starter.dexAttr); - const starterFormIndex = Math.min(starterProps.formIndex, Math.max(starter.species.forms.length - 1, 0)); + const species = getPokemonSpecies(starter.speciesId); + const starterFormIndex = starter.formIndex; const starterGender = - starter.species.malePercent !== null - ? !starterProps.female - ? Gender.MALE - : Gender.FEMALE - : Gender.GENDERLESS; + species.malePercent !== null ? (starter.female ? Gender.FEMALE : Gender.MALE) : Gender.GENDERLESS; const starterPokemon = globalScene.addPlayerPokemon( - starter.species, + species, startingLevel, starter.abilityIndex, starterFormIndex, starterGender, - starterProps.shiny, - starterProps.variant, - undefined, + starter.shiny, + starter.variant, + starter.ivs, starter.nature, ); starterPokemon.setVisible(false); diff --git a/src/ui/handlers/starter-select-ui-handler.ts b/src/ui/handlers/starter-select-ui-handler.ts index 53e566864b1..8c3594546f1 100644 --- a/src/ui/handlers/starter-select-ui-handler.ts +++ b/src/ui/handlers/starter-select-ui-handler.ts @@ -49,7 +49,7 @@ import { achvs } from "#system/achv"; import { RibbonData } from "#system/ribbons/ribbon-data"; import { SettingKeyboard } from "#system/settings-keyboard"; import type { DexEntry } from "#types/dex-data"; -import type { DexAttrProps, StarterAttributes, StarterDataEntry, StarterMoveset } from "#types/save-data"; +import type { Starter, StarterAttributes, StarterDataEntry, StarterMoveset } from "#types/save-data"; import type { OptionSelectItem } from "#ui/abstract-option-select-ui-handler"; import { DropDown, DropDownLabel, DropDownOption, DropDownState, DropDownType, SortCriteria } from "#ui/dropdown"; import { FilterBar } from "#ui/filter-bar"; @@ -82,18 +82,6 @@ import type BBCodeText from "phaser3-rex-plugins/plugins/bbcodetext"; export type StarterSelectCallback = (starters: Starter[]) => void; -export interface Starter { - species: PokemonSpecies; - dexAttr: bigint; - abilityIndex: number; - passive: boolean; - nature: Nature; - moveset?: StarterMoveset; - pokerus: boolean; - nickname?: string; - teraType?: PokemonType; -} - interface LanguageSetting { starterInfoTextSize: string; instructionTextSize: string; @@ -364,15 +352,13 @@ export class StarterSelectUiHandler extends MessageUiHandler { private allSpecies: PokemonSpecies[] = []; private lastSpecies: PokemonSpecies; private speciesLoaded: Map = new Map(); + + private starters: Starter[] = []; public starterSpecies: PokemonSpecies[] = []; private pokerusSpecies: PokemonSpecies[] = []; - private starterAttr: bigint[] = []; - private starterAbilityIndexes: number[] = []; - private starterNatures: Nature[] = []; - private starterTeras: PokemonType[] = []; - private starterMovesets: StarterMoveset[] = []; private speciesStarterDexEntry: DexEntry | null; private speciesStarterMoves: MoveId[]; + private canCycleShiny: boolean; private canCycleForm: boolean; private canCycleGender: boolean; @@ -2758,12 +2744,26 @@ export class StarterSelectUiHandler extends MessageUiHandler { props.variant, ); + const { dexEntry, starterDataEntry } = this.getSpeciesData(species.speciesId); + + const starter = { + speciesId: species.speciesId, + shiny: props.shiny, + variant: props.variant, + formIndex: props.formIndex, + female: props.female, + abilityIndex, + passive: !(starterDataEntry.passiveAttr ^ (PassiveAttr.ENABLED | PassiveAttr.UNLOCKED)), + nature, + moveset, + pokerus: this.pokerusSpecies.includes(species), + nickname: this.starterPreferences[species.speciesId]?.nickname, + teraType, + ivs: dexEntry.ivs, + }; + + this.starters.push(starter); this.starterSpecies.push(species); - this.starterAttr.push(dexAttr); - this.starterAbilityIndexes.push(abilityIndex); - this.starterNatures.push(nature); - this.starterTeras.push(teraType); - this.starterMovesets.push(moveset); if (this.speciesLoaded.get(species.speciesId) || randomSelection) { getPokemonSpeciesForm(species.speciesId, props.formIndex).cry(); } @@ -2833,7 +2833,7 @@ export class StarterSelectUiHandler extends MessageUiHandler { for (const [index, species] of this.starterSpecies.entries()) { if (species.speciesId === id) { - this.starterMovesets[index] = this.starterMoveset; + this.starters[index].moveset = this.starterMoveset; } } } @@ -3640,20 +3640,20 @@ export class StarterSelectUiHandler extends MessageUiHandler { const starterIndex = this.starterSpecies.indexOf(species); - let props: DexAttrProps; + const props = globalScene.gameData.getSpeciesDexAttrProps(species, defaultDexAttr); if (starterIndex > -1) { - props = globalScene.gameData.getSpeciesDexAttrProps(species, this.starterAttr[starterIndex]); + const starter = this.starters[starterIndex]; this.setSpeciesDetails( species, { - shiny: props.shiny, - formIndex: props.formIndex, - female: props.female, - variant: props.variant, - abilityIndex: this.starterAbilityIndexes[starterIndex], - natureIndex: this.starterNatures[starterIndex], - teraType: this.starterTeras[starterIndex], + shiny: starter.shiny, + formIndex: starter.formIndex, + female: starter.female, + variant: starter.variant, + abilityIndex: starter.abilityIndex, + natureIndex: starter.nature, + teraType: starter.teraType, }, false, ); @@ -3664,7 +3664,6 @@ export class StarterSelectUiHandler extends MessageUiHandler { const { dexEntry } = this.getSpeciesData(species.speciesId); const defaultNature = starterAttributes?.nature || globalScene.gameData.getSpeciesDefaultNature(species, dexEntry); - props = globalScene.gameData.getSpeciesDexAttrProps(species, defaultDexAttr); if (starterAttributes?.variant && !Number.isNaN(starterAttributes.variant) && props.shiny) { props.variant = starterAttributes.variant as Variant; } @@ -3910,10 +3909,15 @@ export class StarterSelectUiHandler extends MessageUiHandler { const starterIndex = this.starterSpecies.indexOf(species); if (starterIndex > -1) { - this.starterAttr[starterIndex] = this.dexAttrCursor; - this.starterAbilityIndexes[starterIndex] = this.abilityCursor; - this.starterNatures[starterIndex] = this.natureCursor; - this.starterTeras[starterIndex] = this.teraCursor; + const starter = this.starters[starterIndex]; + const props = globalScene.gameData.getSpeciesDexAttrProps(species, this.dexAttrCursor); + starter.shiny = props.shiny; + starter.variant = props.variant; + starter.female = props.female; + starter.formIndex = props.formIndex; + starter.abilityIndex = this.abilityCursor; + starter.nature = this.natureCursor; + starter.teraType = this.teraCursor; } const assetLoadCancelled = new BooleanHolder(false); @@ -4215,11 +4219,7 @@ export class StarterSelectUiHandler extends MessageUiHandler { popStarter(index: number): void { this.starterSpecies.splice(index, 1); - this.starterAttr.splice(index, 1); - this.starterAbilityIndexes.splice(index, 1); - this.starterNatures.splice(index, 1); - this.starterTeras.splice(index, 1); - this.starterMovesets.splice(index, 1); + this.starters.splice(index, 1); for (let s = 0; s < this.starterSpecies.length; s++) { const species = this.starterSpecies[s]; @@ -4443,27 +4443,11 @@ export class StarterSelectUiHandler extends MessageUiHandler { () => { const startRun = () => { globalScene.money = globalScene.gameMode.getStartingMoney(); + const starters = this.starters.slice(0); ui.setMode(UiMode.STARTER_SELECT); - const thisObj = this; const originalStarterSelectCallback = this.starterSelectCallback; this.starterSelectCallback = null; - originalStarterSelectCallback?.( - new Array(this.starterSpecies.length).fill(0).map((_, i) => { - const starterSpecies = thisObj.starterSpecies[i]; - const { starterDataEntry } = this.getSpeciesData(starterSpecies.speciesId); - return { - species: starterSpecies, - dexAttr: thisObj.starterAttr[i], - abilityIndex: thisObj.starterAbilityIndexes[i], - passive: !(starterDataEntry.passiveAttr ^ (PassiveAttr.ENABLED | PassiveAttr.UNLOCKED)), - nature: thisObj.starterNatures[i] as Nature, - teraType: thisObj.starterTeras[i] as PokemonType, - moveset: thisObj.starterMovesets[i], - pokerus: thisObj.pokerusSpecies.includes(starterSpecies), - nickname: thisObj.starterPreferences[starterSpecies.speciesId]?.nickname, - }; - }), - ); + originalStarterSelectCallback?.(starters); }; startRun(); }, @@ -4492,10 +4476,17 @@ export class StarterSelectUiHandler extends MessageUiHandler { */ isPartyValid(): boolean { let canStart = false; - for (const species of this.starterSpecies) { + for (let s = 0; s < this.starterSpecies.length; s++) { + const species = this.starterSpecies[s]; + const starter = this.starters[s]; const isValidForChallenge = checkStarterValidForChallenge( species, - globalScene.gameData.getSpeciesDexAttrProps(species, this.getCurrentDexProps(species.speciesId)), + { + formIndex: starter.formIndex, + shiny: starter.shiny, + variant: starter.variant, + female: starter.female ?? false, + }, false, ); canStart ||= isValidForChallenge; diff --git a/test/mystery-encounter/encounters/part-timer-encounter.test.ts b/test/mystery-encounter/encounters/part-timer-encounter.test.ts index 1826c75381a..15d2664364c 100644 --- a/test/mystery-encounter/encounters/part-timer-encounter.test.ts +++ b/test/mystery-encounter/encounters/part-timer-encounter.test.ts @@ -168,6 +168,7 @@ describe("Part-Timer - Mystery Encounter", () => { // Override party levels to 50 so stats can be fully reflective scene.getPlayerParty().forEach(p => { p.level = 50; + p.ivs = [0, 0, 0, 0, 0, 0]; p.calculateStats(); }); await runMysteryEncounterToEnd(game, 2, { pokemonNo: 3 }); diff --git a/test/test-utils/game-manager-utils.ts b/test/test-utils/game-manager-utils.ts index 26b7ccf1020..4be05bf0ddb 100644 --- a/test/test-utils/game-manager-utils.ts +++ b/test/test-utils/game-manager-utils.ts @@ -8,8 +8,7 @@ import { GameModes } from "#enums/game-modes"; import type { MoveId } from "#enums/move-id"; import type { SpeciesId } from "#enums/species-id"; import { PlayerPokemon } from "#field/pokemon"; -import type { StarterMoveset } from "#types/save-data"; -import type { Starter } from "#ui/starter-select-ui-handler"; +import type { Starter, StarterMoveset } from "#types/save-data"; import { getPokemonSpecies, getPokemonSpeciesForm } from "#utils/pokemon-utils"; /** Function to convert Blob to string */ @@ -33,24 +32,24 @@ export function holdOn(ms: number) { return new Promise(resolve => setTimeout(resolve, ms)); } -export function generateStarter(scene: BattleScene, species?: SpeciesId[]): Starter[] { +export function generateStarters(scene: BattleScene, speciesIds?: SpeciesId[]): Starter[] { const seed = "test"; - const starters = getTestRunStarters(seed, species); + const starters = getTestRunStarters(seed, speciesIds); const startingLevel = scene.gameMode.getStartingLevel(); for (const starter of starters) { - const starterProps = scene.gameData.getSpeciesDexAttrProps(starter.species, starter.dexAttr); - const starterFormIndex = Math.min(starterProps.formIndex, Math.max(starter.species.forms.length - 1, 0)); + const species = getPokemonSpecies(starter.speciesId); + const starterFormIndex = starter.formIndex; const starterGender = - starter.species.malePercent !== null ? (!starterProps.female ? Gender.MALE : Gender.FEMALE) : Gender.GENDERLESS; + species.malePercent !== null ? (starter.female ? Gender.FEMALE : Gender.MALE) : Gender.GENDERLESS; const starterPokemon = scene.addPlayerPokemon( - starter.species, + species, startingLevel, starter.abilityIndex, starterFormIndex, starterGender, - starterProps.shiny, - starterProps.variant, - undefined, + starter.shiny, + starter.variant, + starter.ivs, starter.nature, ); const moveset: MoveId[] = []; @@ -62,20 +61,23 @@ export function generateStarter(scene: BattleScene, species?: SpeciesId[]): Star return starters; } -function getTestRunStarters(seed: string, species?: SpeciesId[]): Starter[] { - if (!species) { +function getTestRunStarters(seed: string, speciesIds?: SpeciesId[]): Starter[] { + if (!speciesIds || speciesIds.length === 0) { return getDailyRunStarters(seed); } const starters: Starter[] = []; const startingLevel = getGameMode(GameModes.CLASSIC).getStartingLevel(); - for (const specie of species) { - const starterSpeciesForm = getPokemonSpeciesForm(specie, 0); + for (const speciesId of speciesIds) { + const starterSpeciesForm = getPokemonSpeciesForm(speciesId, 0); const starterSpecies = getPokemonSpecies(starterSpeciesForm.speciesId); const pokemon = new PlayerPokemon(starterSpecies, startingLevel, undefined, 0); const starter: Starter = { - species: starterSpecies, - dexAttr: pokemon.getDexAttr(), + speciesId, + shiny: pokemon.shiny, + variant: pokemon.variant, + formIndex: pokemon.formIndex, + ivs: pokemon.ivs, abilityIndex: pokemon.abilityIndex, passive: false, nature: pokemon.getNature(), @@ -89,22 +91,20 @@ function getTestRunStarters(seed: string, species?: SpeciesId[]): Starter[] { /** * Useful for populating party, wave index, etc. without having to spin up and run through an entire EncounterPhase */ -export function initSceneWithoutEncounterPhase(scene: BattleScene, species?: SpeciesId[]): void { - const starters = generateStarter(scene, species); +export function initSceneWithoutEncounterPhase(scene: BattleScene, speciesIds?: SpeciesId[]): void { + const starters = generateStarters(scene, speciesIds); starters.forEach(starter => { - const starterProps = scene.gameData.getSpeciesDexAttrProps(starter.species, starter.dexAttr); - const starterFormIndex = Math.min(starterProps.formIndex, Math.max(starter.species.forms.length - 1, 0)); + const starterFormIndex = starter.formIndex; const starterGender = Gender.MALE; - const starterIvs = scene.gameData.dexData[starter.species.speciesId].ivs.slice(0); const starterPokemon = scene.addPlayerPokemon( - starter.species, + getPokemonSpecies(starter.speciesId), scene.gameMode.getStartingLevel(), starter.abilityIndex, starterFormIndex, starterGender, - starterProps.shiny, - starterProps.variant, - starterIvs, + starter.shiny, + starter.variant, + starter.ivs, starter.nature, ); starter.moveset && starterPokemon.tryPopulateMoveset(starter.moveset); diff --git a/test/test-utils/game-manager.ts b/test/test-utils/game-manager.ts index f681846d935..abe0b8cfcf6 100644 --- a/test/test-utils/game-manager.ts +++ b/test/test-utils/game-manager.ts @@ -29,7 +29,7 @@ import { TurnEndPhase } from "#phases/turn-end-phase"; import { TurnInitPhase } from "#phases/turn-init-phase"; import { TurnStartPhase } from "#phases/turn-start-phase"; import { ErrorInterceptor } from "#test/test-utils/error-interceptor"; -import { generateStarter } from "#test/test-utils/game-manager-utils"; +import { generateStarters } from "#test/test-utils/game-manager-utils"; import { GameWrapper } from "#test/test-utils/game-wrapper"; import { ChallengeModeHelper } from "#test/test-utils/helpers/challenge-mode-helper"; import { ClassicModeHelper } from "#test/test-utils/helpers/classic-mode-helper"; @@ -215,7 +215,7 @@ export class GameManager { this.onNextPrompt("TitlePhase", UiMode.TITLE, () => { this.scene.gameMode = getGameMode(mode); - const starters = generateStarter(this.scene, species); + const starters = generateStarters(this.scene, species); const selectStarterPhase = new SelectStarterPhase(); this.scene.phaseManager.pushPhase(new EncounterPhase(false)); selectStarterPhase.initBattle(starters); @@ -251,7 +251,7 @@ export class GameManager { UiMode.TITLE, () => { this.scene.gameMode = getGameMode(GameModes.CLASSIC); - const starters = generateStarter(this.scene, species); + const starters = generateStarters(this.scene, species); const selectStarterPhase = new SelectStarterPhase(); this.scene.phaseManager.pushPhase(new EncounterPhase(false)); selectStarterPhase.initBattle(starters); diff --git a/test/test-utils/helpers/challenge-mode-helper.ts b/test/test-utils/helpers/challenge-mode-helper.ts index 7bc40aec035..a1fe114013d 100644 --- a/test/test-utils/helpers/challenge-mode-helper.ts +++ b/test/test-utils/helpers/challenge-mode-helper.ts @@ -9,7 +9,7 @@ import { CommandPhase } from "#phases/command-phase"; import { EncounterPhase } from "#phases/encounter-phase"; import { SelectStarterPhase } from "#phases/select-starter-phase"; import { TurnInitPhase } from "#phases/turn-init-phase"; -import { generateStarter } from "#test/test-utils/game-manager-utils"; +import { generateStarters } from "#test/test-utils/game-manager-utils"; import { GameManagerHelper } from "#test/test-utils/helpers/game-manager-helper"; /** @@ -34,7 +34,7 @@ export class ChallengeModeHelper extends GameManagerHelper { * @param gameMode - Optional game mode to set. * @returns A promise that resolves when the summon phase is reached. */ - async runToSummon(species?: SpeciesId[]) { + async runToSummon(speciesIds?: SpeciesId[]) { await this.game.runToTitle(); if (this.game.override.disableShinies) { @@ -43,7 +43,7 @@ export class ChallengeModeHelper extends GameManagerHelper { this.game.onNextPrompt("TitlePhase", UiMode.TITLE, () => { this.game.scene.gameMode.challenges = this.challenges; - const starters = generateStarter(this.game.scene, species); + const starters = generateStarters(this.game.scene, speciesIds); const selectStarterPhase = new SelectStarterPhase(); this.game.scene.phaseManager.pushPhase(new EncounterPhase(false)); selectStarterPhase.initBattle(starters); diff --git a/test/test-utils/helpers/classic-mode-helper.ts b/test/test-utils/helpers/classic-mode-helper.ts index f813a8f797e..896de7a8b6f 100644 --- a/test/test-utils/helpers/classic-mode-helper.ts +++ b/test/test-utils/helpers/classic-mode-helper.ts @@ -10,7 +10,7 @@ import { CommandPhase } from "#phases/command-phase"; import { EncounterPhase } from "#phases/encounter-phase"; import { SelectStarterPhase } from "#phases/select-starter-phase"; import { TurnInitPhase } from "#phases/turn-init-phase"; -import { generateStarter } from "#test/test-utils/game-manager-utils"; +import { generateStarters } from "#test/test-utils/game-manager-utils"; import { GameManagerHelper } from "#test/test-utils/helpers/game-manager-helper"; /** @@ -35,7 +35,7 @@ export class ClassicModeHelper extends GameManagerHelper { // biome-ignore lint/style/useUnifiedTypeSignatures: Marks the overload for deprecation async runToSummon(): Promise; async runToSummon(species: SpeciesId[] | undefined): Promise; - async runToSummon(species?: SpeciesId[]): Promise { + async runToSummon(speciesIds?: SpeciesId[]): Promise { await this.game.runToTitle(); if (this.game.override.disableShinies) { @@ -50,7 +50,7 @@ export class ClassicModeHelper extends GameManagerHelper { this.game.onNextPrompt("TitlePhase", UiMode.TITLE, () => { this.game.scene.gameMode = getGameMode(GameModes.CLASSIC); - const starters = generateStarter(this.game.scene, species); + const starters = generateStarters(this.game.scene, speciesIds); const selectStarterPhase = new SelectStarterPhase(); this.game.scene.phaseManager.pushPhase(new EncounterPhase(false)); selectStarterPhase.initBattle(starters);