revert fix for Keldeo crashes + implement fix suggestion from PR #4619

This commit is contained in:
MokaStitcher 2024-10-20 21:55:15 +02:00
parent d400dd93ab
commit eea0f4b3ee
2 changed files with 4 additions and 8 deletions

View File

@ -2189,8 +2189,11 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
this.moveset.push(new PokemonMove(movePool[index][0], 0, 0));
}
// Trigger FormChange, except for enemy Pokemon during Mystery Encounters, to avoid crashes
if (this.isPlayer() || !this.scene.currentBattle.isBattleMysteryEncounter() || !this.scene.currentBattle.mysteryEncounter) {
this.scene.triggerPokemonFormChange(this, SpeciesFormChangeMoveLearnedTrigger);
}
}
trySelectMove(moveIndex: integer, ignorePp?: boolean): boolean {
const move = this.getMoveset().length > moveIndex

View File

@ -36,7 +36,6 @@ import { MysteryEncounterPhase } from "#app/phases/mystery-encounter-phases";
import { getGoldenBugNetSpecies } from "#app/data/mystery-encounters/utils/encounter-pokemon-utils";
import { Biome } from "#enums/biome";
import { WEIGHT_INCREMENT_ON_SPAWN_MISS } from "#app/data/mystery-encounters/mystery-encounters";
import { QuietFormChangePhase } from "#app/phases/quiet-form-change-phase";
export class EncounterPhase extends BattlePhase {
private loaded: boolean;
@ -385,12 +384,6 @@ export class EncounterPhase extends BattlePhase {
encounter.onVisualsStart(this.scene);
}
// Clear any lingering QuietFormChangePhases which can be inadvertently added by certain wild Pokemon forms
let phaseRemoved: boolean = true;
while (phaseRemoved) {
phaseRemoved = this.scene.tryRemoveUnshiftedPhase(phase => phase instanceof QuietFormChangePhase);
}
const doEncounter = () => {
const doShowEncounterOptions = () => {
this.scene.ui.clearText();