Fix fusion move merge happening after wave end

This commit is contained in:
Flashfyre 2024-04-11 16:30:29 -04:00
parent d05fab041c
commit d50521755e

View File

@ -2319,25 +2319,24 @@ export class PlayerPokemon extends Pokemon {
this.generateName(); this.generateName();
this.calculateStats(); this.calculateStats();
this.generateCompatibleTms(); this.generateCompatibleTms();
this.updateInfo(true).then(() => { this.updateInfo(true);
const fusedPartyMemberIndex = this.scene.getParty().indexOf(pokemon); const fusedPartyMemberIndex = this.scene.getParty().indexOf(pokemon);
let partyMemberIndex = this.scene.getParty().indexOf(this); let partyMemberIndex = this.scene.getParty().indexOf(this);
if (partyMemberIndex > fusedPartyMemberIndex) if (partyMemberIndex > fusedPartyMemberIndex)
partyMemberIndex--; partyMemberIndex--;
pokemon.getMoveset(true).map(m => this.scene.unshiftPhase(new LearnMovePhase(this.scene, partyMemberIndex, m.getMove().id))); pokemon.getMoveset(true).map(m => this.scene.unshiftPhase(new LearnMovePhase(this.scene, partyMemberIndex, m.getMove().id)));
const fusedPartyMemberHeldModifiers = this.scene.findModifiers(m => m instanceof PokemonHeldItemModifier const fusedPartyMemberHeldModifiers = this.scene.findModifiers(m => m instanceof PokemonHeldItemModifier
&& (m as PokemonHeldItemModifier).pokemonId === pokemon.id, true) as PokemonHeldItemModifier[]; && (m as PokemonHeldItemModifier).pokemonId === pokemon.id, true) as PokemonHeldItemModifier[];
const transferModifiers: Promise<boolean>[] = []; const transferModifiers: Promise<boolean>[] = [];
for (let modifier of fusedPartyMemberHeldModifiers) for (let modifier of fusedPartyMemberHeldModifiers)
transferModifiers.push(this.scene.tryTransferHeldItemModifier(modifier, this, true, false, true, true)); transferModifiers.push(this.scene.tryTransferHeldItemModifier(modifier, this, true, false, true, true));
Promise.allSettled(transferModifiers).then(() => { Promise.allSettled(transferModifiers).then(() => {
this.scene.updateModifiers(true, true).then(() => { this.scene.updateModifiers(true, true).then(() => {
this.scene.removePartyMemberModifiers(fusedPartyMemberIndex); this.scene.removePartyMemberModifiers(fusedPartyMemberIndex);
this.scene.getParty().splice(fusedPartyMemberIndex, 1)[0]; this.scene.getParty().splice(fusedPartyMemberIndex, 1)[0];
pokemon.destroy(); pokemon.destroy();
this.updateFusionPalette(); this.updateFusionPalette();
resolve(); resolve();
});
}); });
}); });
}); });