Fixed some bugs

This commit is contained in:
Wlowscha 2025-09-03 22:03:06 +02:00
parent 4219379abf
commit 18a650a10e
No known key found for this signature in database
GPG Key ID: 3C8F1AD330565D04
4 changed files with 10 additions and 13 deletions

View File

@ -19,6 +19,7 @@ import { vouchers } from "#system/voucher";
import type { OptionSelectConfig, OptionSelectItem } from "#ui/abstract-option-select-ui-handler";
import { SaveSlotUiMode } from "#ui/save-slot-select-ui-handler";
import { isLocal, isLocalServerConnected, isNullOrUndefined } from "#utils/common";
import { getPokemonSpecies } from "#utils/pokemon-utils";
import i18next from "i18next";
export class TitlePhase extends Phase {
@ -215,22 +216,18 @@ export class TitlePhase extends Phase {
const party = globalScene.getPlayerParty();
const loadPokemonAssets: Promise<void>[] = [];
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.MALE : Gender.FEMALE) : Gender.GENDERLESS;
const starterPokemon = globalScene.addPlayerPokemon(
starter.species,
species,
startingLevel,
starter.abilityIndex,
starterFormIndex,
starterGender,
starterProps.shiny,
starterProps.variant,
starter.shiny,
starter.variant,
undefined,
starter.nature,
);

View File

@ -238,7 +238,7 @@ export class GameManager {
* @param species - Optional array of species for party to start with.
* @returns A Promise that resolves when the EncounterPhase ends.
*/
async runToMysteryEncounter(encounterType?: MysteryEncounterType, species?: SpeciesId[]) {
async runToMysteryEncounter(encounterType?: MysteryEncounterType, species: SpeciesId[] = []) {
if (!isNullOrUndefined(encounterType)) {
this.override.disableTrainerWaves();
this.override.mysteryEncounter(encounterType);

View File

@ -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(species: SpeciesId[] = []) {
await this.game.runToTitle();
if (this.game.override.disableShinies) {

View File

@ -32,7 +32,7 @@ export class ClassicModeHelper extends GameManagerHelper {
*/
async runToSummon(): Promise<void>;
async runToSummon(species: SpeciesId[] | undefined): Promise<void>;
async runToSummon(species?: SpeciesId[]): Promise<void> {
async runToSummon(species: SpeciesId[] = []): Promise<void> {
await this.game.runToTitle();
if (this.game.override.disableShinies) {