adding fainted check to fix the bug

This commit is contained in:
PrabbyDD 2024-10-18 15:01:50 -07:00
parent 682e33e0e1
commit 08e22e680d

View File

@ -44,9 +44,14 @@ export class FaintPhase extends PokemonPhase {
}
}
/** In case the current pokemon was just switched in, make sure it is counted as participating in the combat */
/**
* In case the current pokemon was just switched in, make sure it is counted as participating in the combat.
* For EXP_SHARE purposes, if the current pokemon faints as the combat ends and it was the ONLY player pokemon
* involved in combat, it needs to be counted as a participant so the other party pokemon can get their EXP,
* so the fainted pokemon has been included.
*/
this.scene.getField().forEach((pokemon, i) => {
if (pokemon?.isActive()) {
if (pokemon?.isActive() || pokemon?.isFainted()) {
if (pokemon.isPlayer()) {
this.scene.currentBattle.addParticipant(pokemon as PlayerPokemon);
}