From 7cd45b30eb7ee1845d43113413c0adf01433d0f9 Mon Sep 17 00:00:00 2001 From: Flashfyre Date: Wed, 5 Jul 2023 11:54:36 -0400 Subject: [PATCH] Fix crash when encountering a shiny --- src/battle-phases.ts | 11 +---------- src/battle-scene.ts | 2 +- src/ui/party-ui-handler.ts | 2 +- 3 files changed, 3 insertions(+), 12 deletions(-) diff --git a/src/battle-phases.ts b/src/battle-phases.ts index 8e55e58ce..c4854354a 100644 --- a/src/battle-phases.ts +++ b/src/battle-phases.ts @@ -312,15 +312,6 @@ export class NextEncounterPhase extends EncounterPhase { } }); } - - end() { - this.scene.getEnemyField().forEach((enemyPokemon, e) => { - if (enemyPokemon.shiny) - this.scene.unshiftPhase(new ShinySparklePhase(this.scene, BattlerIndex.ENEMY + e)); - }); - - super.end(); - } } export class NewBiomeEncounterPhase extends NextEncounterPhase { @@ -2342,7 +2333,7 @@ export class AttemptCapturePhase extends PokemonPhase { this.end(); }; const removePokemon = () => { - this.scene.getPlayerField().forEach(playerPokemon => playerPokemon.removeTagsBySourceId(pokemon.id)); + this.scene.getPlayerField().filter(p => p.isActive()).forEach(playerPokemon => playerPokemon.removeTagsBySourceId(pokemon.id)); pokemon.hp = 0; pokemon.trySetStatus(StatusEffect.FAINT); this.scene.clearEnemyModifiers(); diff --git a/src/battle-scene.ts b/src/battle-scene.ts index 09841dd89..c27fbb328 100644 --- a/src/battle-scene.ts +++ b/src/battle-scene.ts @@ -167,7 +167,7 @@ export default class BattleScene extends Phaser.Scene { this.loadImage('overlay_exp', 'ui'); this.loadImage('icon_owned', 'ui'); this.loadImage('ability_bar', 'ui'); - this.loadImage('shiny', 'ui'); + this.loadImage('shiny_star', 'ui', 'shiny.png'); this.loadImage('party_bg', 'ui'); this.loadImage('party_bg_double', 'ui'); diff --git a/src/ui/party-ui-handler.ts b/src/ui/party-ui-handler.ts index c362fb941..7901c1594 100644 --- a/src/ui/party-ui-handler.ts +++ b/src/ui/party-ui-handler.ts @@ -663,7 +663,7 @@ class PartySlot extends Phaser.GameObjects.Container { } if (this.pokemon.shiny) { - const shinyStar = this.scene.add.image(0, 0, 'shiny'); + const shinyStar = this.scene.add.image(0, 0, 'shiny_star'); shinyStar.setOrigin(0, 0); shinyStar.setPositionRelative(slotLevelLabel, this.slotIndex >= battlerCount ? 35 : 67, this.slotIndex >= battlerCount ? -1 : -18);