From c34b7b1deb978010b89f41126e708a607fda749f Mon Sep 17 00:00:00 2001 From: Wlowscha <54003515+Wlowscha@users.noreply.github.com> Date: Tue, 11 Mar 2025 23:43:58 +0100 Subject: [PATCH] Fixed logic to allow mons with no forms --- src/data/challenge.ts | 38 ++++++++++++++++++-------------------- 1 file changed, 18 insertions(+), 20 deletions(-) diff --git a/src/data/challenge.ts b/src/data/challenge.ts index 561c6feb914..a187ee65496 100644 --- a/src/data/challenge.ts +++ b/src/data/challenge.ts @@ -1299,31 +1299,29 @@ export function checkStarterValidForChallenge(species: PokemonSpecies, props: De * @returns True if the species is considered valid. */ function checkSpeciesValidForChallenge(species: PokemonSpecies, props: DexAttrProps, soft: boolean) { - if (!soft) { + if (!soft || !pokemonFormChanges.hasOwnProperty(species.speciesId)) { const isValidForChallenge = new Utils.BooleanHolder(true); applyChallenges(globalScene.gameMode, ChallengeType.STARTER_CHOICE, species, isValidForChallenge, props); return isValidForChallenge.value; } - if (pokemonFormChanges.hasOwnProperty(species.speciesId)) { - pokemonFormChanges[species.speciesId].forEach(f1 => { - species.forms.forEach((f2, formIndex) => { - if (f1.formKey === f2.formKey) { - const formProps = { ...props }; - formProps.formIndex = formIndex; - const isFormValidForChallenge = new Utils.BooleanHolder(true); - applyChallenges( - globalScene.gameMode, - ChallengeType.STARTER_CHOICE, - species, - isFormValidForChallenge, - formProps, - ); - if (isFormValidForChallenge.value) { - return true; - } + pokemonFormChanges[species.speciesId].forEach(f1 => { + species.forms.forEach((f2, formIndex) => { + if (f1.formKey === f2.formKey) { + const formProps = { ...props }; + formProps.formIndex = formIndex; + const isFormValidForChallenge = new Utils.BooleanHolder(true); + applyChallenges( + globalScene.gameMode, + ChallengeType.STARTER_CHOICE, + species, + isFormValidForChallenge, + formProps, + ); + if (isFormValidForChallenge.value) { + return true; } - }); + } }); - } + }); return false; }