Fix fusion evolution items not working on fully evolved species

pull/47/head
Flashfyre 2024-04-06 14:32:55 -04:00
parent a8ec37e7fa
commit 1f860d6d1d
1 changed files with 5 additions and 3 deletions

View File

@ -1183,9 +1183,11 @@ export class EvolutionItemModifier extends ConsumablePokemonModifier {
apply(args: any[]): boolean { apply(args: any[]): boolean {
const pokemon = args[0] as PlayerPokemon; const pokemon = args[0] as PlayerPokemon;
let matchingEvolution = pokemonEvolutions[pokemon.species.speciesId].find(e => e.item === (this.type as ModifierTypes.EvolutionItemModifierType).evolutionItem let matchingEvolution = pokemonEvolutions.hasOwnProperty(pokemon.species.speciesId)
&& (e.evoFormKey === null || (e.preFormKey || '') === pokemon.getFormKey()) ? pokemonEvolutions[pokemon.species.speciesId].find(e => e.item === (this.type as ModifierTypes.EvolutionItemModifierType).evolutionItem
&& (!e.condition || e.condition.predicate(pokemon))); && (e.evoFormKey === null || (e.preFormKey || '') === pokemon.getFormKey())
&& (!e.condition || e.condition.predicate(pokemon)))
: null;
if (!matchingEvolution && pokemon.isFusion()) { if (!matchingEvolution && pokemon.isFusion()) {
matchingEvolution = pokemonEvolutions[pokemon.fusionSpecies.speciesId].find(e => e.item === (this.type as ModifierTypes.EvolutionItemModifierType).evolutionItem matchingEvolution = pokemonEvolutions[pokemon.fusionSpecies.speciesId].find(e => e.item === (this.type as ModifierTypes.EvolutionItemModifierType).evolutionItem