Prevent Ditto from being randomly generated as part of a fusion

This commit is contained in:
NightKev 2024-11-08 17:06:11 -08:00
parent 8d37225259
commit 324cc03af0
2 changed files with 23 additions and 14 deletions

View File

@ -888,17 +888,24 @@ export default class PokemonSpecies extends PokemonSpeciesForm implements Locali
getCompatibleFusionSpeciesFilter(): PokemonSpeciesFilter {
const hasEvolution = pokemonEvolutions.hasOwnProperty(this.speciesId);
const hasPrevolution = pokemonPrevolutions.hasOwnProperty(this.speciesId);
const pseudoLegendary = this.subLegendary;
const subLegendary = this.subLegendary;
const legendary = this.legendary;
const mythical = this.mythical;
return species => {
return (pseudoLegendary || legendary || mythical ||
(pokemonEvolutions.hasOwnProperty(species.speciesId) === hasEvolution
&& pokemonPrevolutions.hasOwnProperty(species.speciesId) === hasPrevolution))
&& species.subLegendary === pseudoLegendary
return (
subLegendary
|| legendary
|| mythical
|| (
pokemonEvolutions.hasOwnProperty(species.speciesId) === hasEvolution
&& pokemonPrevolutions.hasOwnProperty(species.speciesId) === hasPrevolution
)
)
&& species.subLegendary === subLegendary
&& species.legendary === legendary
&& species.mythical === mythical
&& (this.isTrainerForbidden() || !species.isTrainerForbidden());
&& (this.isTrainerForbidden() || !species.isTrainerForbidden())
&& species.speciesId !== Species.DITTO;
};
}

View File

@ -2030,15 +2030,17 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
const hasHiddenAbility = !Utils.randSeedInt(hiddenAbilityChance.value);
const randAbilityIndex = Utils.randSeedInt(2);
const filter = !forStarter ? this.species.getCompatibleFusionSpeciesFilter()
: species => {
const filter = !forStarter ?
this.species.getCompatibleFusionSpeciesFilter()
: (species: PokemonSpecies) => {
return pokemonEvolutions.hasOwnProperty(species.speciesId)
&& !pokemonPrevolutions.hasOwnProperty(species.speciesId)
&& !species.pseudoLegendary
&& !species.subLegendary
&& !species.legendary
&& !species.mythical
&& !species.isTrainerForbidden()
&& species.speciesId !== this.species.speciesId;
&& species.speciesId !== this.species.speciesId
&& species.speciesId !== Species.DITTO;
};
let fusionOverride: PokemonSpecies | undefined = undefined;