Fix crash when encountering a shiny

This commit is contained in:
Flashfyre 2023-07-05 11:54:36 -04:00
parent d556f5aca1
commit 7cd45b30eb
3 changed files with 3 additions and 12 deletions

View File

@ -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();

View File

@ -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');

View File

@ -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);