From 4ff3c556135d93f0d455b3bf95af8e37a6e3a8ee Mon Sep 17 00:00:00 2001 From: Flashfyre Date: Mon, 10 Apr 2023 16:52:27 -0400 Subject: [PATCH] Fix some crashes --- src/battle-phases.ts | 12 ++++++++---- src/battle-scene.ts | 2 +- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/battle-phases.ts b/src/battle-phases.ts index 2ed7c84ae..d5c2f896b 100644 --- a/src/battle-phases.ts +++ b/src/battle-phases.ts @@ -1011,12 +1011,16 @@ export class AttemptCapturePhase extends BattlePhase { this.scene.unshiftPhase(new VictoryPhase(this.scene)); this.scene.ui.showText(`${pokemon.name} was caught!`, null, () => { pokemon.hideInfo(); - const newPokemon = pokemon.addToParty(); - this.scene.field.remove(pokemon, true); - newPokemon.loadAssets().then(() => { + const end = () => { this.removePb(); this.end(); - }); + }; + const newPokemon = pokemon.addToParty(); + this.scene.field.remove(pokemon, true); + if (newPokemon) + newPokemon.loadAssets().then(end); + else + end(); }, 0, true); } diff --git a/src/battle-scene.ts b/src/battle-scene.ts index 744c03b27..d8925fc67 100644 --- a/src/battle-scene.ts +++ b/src/battle-scene.ts @@ -163,7 +163,7 @@ export default class BattleScene extends Phaser.Scene { // Load pokemon-related images this.loadImage(`pkmn__back__sub`, 'pokemon/back', 'sub.png'); this.loadImage(`pkmn__sub`, 'pokemon', 'sub.png'); - this.loadAtlas('sparkle', 'effects'); + this.loadAtlas('shiny', 'effects'); this.loadImage('evo_sparkle', 'effects'); this.load.video('evo_bg', 'images/effects/evo_bg.mp4', null, false, true);