mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2024-11-25 16:26:25 +00:00
[Bug] Fix Victini's generation for challenges. (#1973)
* Make victini count as gen 5 challenge instead of 4 * Add comment
This commit is contained in:
parent
ae02943b16
commit
f0a826b8f4
@ -267,11 +267,18 @@ export class SingleGenerationChallenge extends Challenge {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* We have special code below for victini because it is classed as a generation 4 pokemon in the code
|
||||
* despite being a generation 5 pokemon. This is due to UI constraints, the starter select screen has
|
||||
* no more room for pokemon so victini is put in the gen 4 section instead. This code just overrides the
|
||||
* normal generation check to correctly treat victini as gen 5.
|
||||
*/
|
||||
switch (challengeType) {
|
||||
case ChallengeType.STARTER_CHOICE:
|
||||
const species = args[0] as PokemonSpecies;
|
||||
const isValidStarter = args[1] as Utils.BooleanHolder;
|
||||
if (species.generation !== this.value) {
|
||||
const starterGeneration = species.speciesId === Species.VICTINI ? 5 : species.generation;
|
||||
if (starterGeneration !== this.value) {
|
||||
isValidStarter.value = false;
|
||||
return true;
|
||||
}
|
||||
@ -279,7 +286,9 @@ export class SingleGenerationChallenge extends Challenge {
|
||||
case ChallengeType.POKEMON_IN_BATTLE:
|
||||
const pokemon = args[0] as Pokemon;
|
||||
const isValidPokemon = args[1] as Utils.BooleanHolder;
|
||||
if (pokemon.isPlayer() && ((pokemon.species.formIndex === 0 ? pokemon.species : getPokemonSpecies(pokemon.species.speciesId)).generation !== this.value || (pokemon.isFusion() && (pokemon.fusionSpecies.formIndex === 0 ? pokemon.fusionSpecies : getPokemonSpecies(pokemon.fusionSpecies.speciesId)).generation !== this.value))) {
|
||||
const baseGeneration = pokemon.species.speciesId === Species.VICTINI ? 5 : getPokemonSpecies(pokemon.species.speciesId).generation;
|
||||
const fusionGeneration = pokemon.isFusion() ? pokemon.fusionSpecies.speciesId === Species.VICTINI ? 5 : getPokemonSpecies(pokemon.fusionSpecies.speciesId).generation : 0;
|
||||
if (pokemon.isPlayer() && (baseGeneration !== this.value || (pokemon.isFusion() && fusionGeneration !== this.value))) {
|
||||
isValidPokemon.value = false;
|
||||
return true;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user