From 15dedf06eda9b1cf1e012bc15c9df3c662dc0b28 Mon Sep 17 00:00:00 2001 From: PrabbyDD <147005742+PrabbyDD@users.noreply.github.com> Date: Tue, 29 Oct 2024 14:38:57 -0700 Subject: [PATCH] [P2] No Exp Gained after Switching in a Pokemon as the Opponent Faints (#4687) * fixing the exp bug * fixing the exp bug * dont think need to reset turn data there * changing a little bit * Update src/phases/faint-phase.ts Co-authored-by: innerthunder <168692175+innerthunder@users.noreply.github.com> --------- Co-authored-by: innerthunder <168692175+innerthunder@users.noreply.github.com> --- src/phases/faint-phase.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/phases/faint-phase.ts b/src/phases/faint-phase.ts index eee1fd52938..8eb84beded5 100644 --- a/src/phases/faint-phase.ts +++ b/src/phases/faint-phase.ts @@ -65,6 +65,15 @@ export class FaintPhase extends PokemonPhase { } } + /** In case the current pokemon was just switched in, make sure it is counted as participating in the combat */ + this.scene.getPlayerField().forEach((pokemon, i) => { + if (pokemon?.isActive(true)) { + if (pokemon.isPlayer()) { + this.scene.currentBattle.addParticipant(pokemon as PlayerPokemon); + } + } + }); + if (!this.tryOverrideForBattleSpec()) { this.doFaint(); }