Fix Meloetta-related bugs in mono-type challenges (#4460)

Remove Meloetta from the `TYPE_OVERRIDES` array so wrong-form
Meloetta can't be sent into battle.
This was missed when Meloetta was changed in a previous PR

Also disallow Meloetta from being added to the party in
starter select if it's in the wrong form
for the current mono-type challenge
This commit is contained in:
NightKev 2024-09-26 21:48:57 -07:00 committed by GitHub
parent c7f00d0a4d
commit 933309cd00
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 3 deletions

View File

@ -527,18 +527,19 @@ interface monotypeOverride {
*/
export class SingleTypeChallenge extends Challenge {
private static TYPE_OVERRIDES: monotypeOverride[] = [
{species: Species.MELOETTA, type: Type.PSYCHIC, fusion: true},
{species: Species.CASTFORM, type: Type.NORMAL, fusion: false},
];
// TODO: Find a solution for all Pokemon with this ssui issue, including Basculin and Burmy
private static SPECIES_OVERRIDES: Species[] = [Species.MELOETTA];
constructor() {
super(Challenges.SINGLE_TYPE, 18);
}
applyStarterChoice(pokemon: PokemonSpecies, valid: Utils.BooleanHolder, dexAttr: DexAttrProps, soft: boolean = false): boolean {
override applyStarterChoice(pokemon: PokemonSpecies, valid: Utils.BooleanHolder, dexAttr: DexAttrProps, soft: boolean = false): boolean {
const speciesForm = getPokemonSpeciesForm(pokemon.speciesId, dexAttr.formIndex);
const types = [speciesForm.type1, speciesForm.type2];
if (soft) {
if (soft && !SingleTypeChallenge.SPECIES_OVERRIDES.includes(pokemon.speciesId)) {
const speciesToCheck = [pokemon.speciesId];
while (speciesToCheck.length) {
const checking = speciesToCheck.pop();