From e265c1961f113fb92e749721b19ddb919b3a3f83 Mon Sep 17 00:00:00 2001 From: Flashfyre Date: Tue, 26 Dec 2023 12:01:56 -0500 Subject: [PATCH] Fix bug with generating moves before form --- src/battle-phases.ts | 4 ++-- src/battle-scene.ts | 3 ++- src/pokemon.ts | 4 ++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/battle-phases.ts b/src/battle-phases.ts index c824dbe5165..1eed6467dd3 100644 --- a/src/battle-phases.ts +++ b/src/battle-phases.ts @@ -3087,14 +3087,14 @@ export class AttemptRunPhase extends PokemonPhase { onComplete: () => enemyField.forEach(enemyPokemon => enemyPokemon.destroy()) }); + this.scene.clearEnemyHeldItemModifiers(); + enemyField.forEach(enemyPokemon => { enemyPokemon.hideInfo().then(() => enemyPokemon.destroy()); enemyPokemon.hp = 0; enemyPokemon.trySetStatus(StatusEffect.FAINT); }); - this.scene.clearEnemyHeldItemModifiers(); - this.scene.pushPhase(new BattleEndPhase(this.scene)); this.scene.pushPhase(new NewBattlePhase(this.scene)); } else diff --git a/src/battle-scene.ts b/src/battle-scene.ts index f75e2ca6b50..374af8b61fe 100644 --- a/src/battle-scene.ts +++ b/src/battle-scene.ts @@ -1423,7 +1423,8 @@ export default class BattleScene extends Phaser.Scene { updatePartyForModifiers(party: Pokemon[], instant?: boolean): Promise { return new Promise(resolve => { Promise.allSettled(party.map(p => { - p.calculateStats(); + if (p.scene) + p.calculateStats(); return p.updateInfo(instant); })).then(() => resolve()); }); diff --git a/src/pokemon.ts b/src/pokemon.ts index f57a1a90b05..e0c202336e0 100644 --- a/src/pokemon.ts +++ b/src/pokemon.ts @@ -132,8 +132,6 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { this.fusionShiny = dataSource.fusionShiny; this.fusionGender = dataSource.fusionGender; } else { - this.generateAndPopulateMoveset(); - this.id = Utils.randSeedInt(4294967295); this.ivs = ivs || [ Utils.binToDec(Utils.decToBin(this.id).substring(0, 5)), @@ -167,6 +165,8 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { if (scene.gameMode === GameMode.SPLICED_ENDLESS) this.generateFusionSpecies(); + + this.generateAndPopulateMoveset(); } this.generateName();