mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-20 15:22:19 +02:00
Moving things around to avoid checking same species twice
This commit is contained in:
parent
8a8480b7f1
commit
65440eff3c
@ -1301,16 +1301,20 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
checkValidForChallenge(species: PokemonSpecies, props: DexAttrProps, soft: boolean) {
|
checkValidForChallenge(species: PokemonSpecies, props: DexAttrProps, soft: boolean) {
|
||||||
const isValidForChallenge = new BooleanHolder(true);
|
if (!soft) {
|
||||||
Challenge.applyChallenges(
|
const isValidForChallenge = new BooleanHolder(true);
|
||||||
globalScene.gameMode,
|
Challenge.applyChallenges(
|
||||||
Challenge.ChallengeType.STARTER_CHOICE,
|
globalScene.gameMode,
|
||||||
species,
|
Challenge.ChallengeType.STARTER_CHOICE,
|
||||||
isValidForChallenge,
|
species,
|
||||||
props
|
isValidForChallenge,
|
||||||
);
|
props
|
||||||
const allValidities: boolean[] = [];
|
);
|
||||||
if (soft) {
|
return isValidForChallenge.value;
|
||||||
|
} else {
|
||||||
|
// We check the validity of every evolution and battle form separately,
|
||||||
|
// and require that at least one is valid
|
||||||
|
const allValidities: boolean[] = [];
|
||||||
const speciesToCheck = [ species.speciesId ];
|
const speciesToCheck = [ species.speciesId ];
|
||||||
while (speciesToCheck.length) {
|
while (speciesToCheck.length) {
|
||||||
const checking = speciesToCheck.pop();
|
const checking = speciesToCheck.pop();
|
||||||
@ -1349,8 +1353,8 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return allValidities.filter(v => v).length > 0;
|
||||||
}
|
}
|
||||||
return isValidForChallenge.value || (soft && allValidities.filter(v => v).length > 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
processInput(button: Button): boolean {
|
processInput(button: Button): boolean {
|
||||||
|
Loading…
Reference in New Issue
Block a user