Always check requested form first

This commit is contained in:
Wlowscha 2025-03-16 12:02:01 +01:00
parent f0c33e5416
commit bcef75fb10
No known key found for this signature in database
GPG Key ID: 3C8F1AD330565D04

View File

@ -715,7 +715,6 @@ export class SingleTypeChallenge extends Challenge {
{ species: Species.CASTFORM, type: PokemonType.NORMAL, fusion: false }, { species: Species.CASTFORM, type: PokemonType.NORMAL, fusion: false },
]; ];
// TODO: Find a solution for all Pokemon with this ssui issue, including Basculin and Burmy // TODO: Find a solution for all Pokemon with this ssui issue, including Basculin and Burmy
private static SPECIES_OVERRIDES: Species[] = [Species.MELOETTA];
constructor() { constructor() {
super(Challenges.SINGLE_TYPE, 18); super(Challenges.SINGLE_TYPE, 18);
@ -1298,11 +1297,15 @@ export function checkStarterValidForChallenge(species: PokemonSpecies, props: De
* @returns `true` if the species is considered valid. * @returns `true` if the species is considered valid.
*/ */
function checkSpeciesValidForChallenge(species: PokemonSpecies, props: DexAttrProps, soft: boolean) { function checkSpeciesValidForChallenge(species: PokemonSpecies, props: DexAttrProps, soft: boolean) {
if (!soft || !pokemonFormChanges.hasOwnProperty(species.speciesId) || props.formIndex === 0) { const isValidForChallenge = new Utils.BooleanHolder(true);
const isValidForChallenge = new Utils.BooleanHolder(true); applyChallenges(globalScene.gameMode, ChallengeType.STARTER_CHOICE, species, isValidForChallenge, props);
applyChallenges(globalScene.gameMode, ChallengeType.STARTER_CHOICE, species, isValidForChallenge, props); if (!soft || !pokemonFormChanges.hasOwnProperty(species.speciesId)) {
return isValidForChallenge.value; return isValidForChallenge.value;
} }
// If the form in props is valid, return true before checking other form changes
if (soft && isValidForChallenge.value) {
return true;
}
pokemonFormChanges[species.speciesId].forEach(f1 => { pokemonFormChanges[species.speciesId].forEach(f1 => {
species.forms.forEach((f2, formIndex) => { species.forms.forEach((f2, formIndex) => {
if (f1.formKey === f2.formKey) { if (f1.formKey === f2.formKey) {