Fix for single battle trainer summoning issue

This commit is contained in:
Flashfyre 2024-03-21 12:18:10 -04:00
parent 945236f760
commit 918a0d77f1
2 changed files with 4 additions and 1 deletions

View File

@ -2104,7 +2104,7 @@ export class ForceSwitchOutAttr extends MoveEffectAttr {
switchOutTarget.scene.field.remove(switchOutTarget);
if (switchOutTarget.hp)
user.scene.unshiftPhase(new SwitchSummonPhase(user.scene, switchOutTarget.getFieldIndex(), user.scene.currentBattle.trainer.getNextSummonIndex(), false, this.batonPass, false));
user.scene.unshiftPhase(new SwitchSummonPhase(user.scene, switchOutTarget.getFieldIndex(), user.scene.currentBattle.trainer.getNextSummonIndex((switchOutTarget as EnemyPokemon).trainerSlot), false, this.batonPass, false));
} else {
switchOutTarget.setVisible(false);

View File

@ -302,6 +302,9 @@ export default class Trainer extends Phaser.GameObjects.Container {
}
getNextSummonIndex(trainerSlot: TrainerSlot = TrainerSlot.NONE, partyMemberScores: [integer, integer][] = this.getPartyMemberMatchupScores(trainerSlot)): integer {
if (trainerSlot && !this.isDouble())
trainerSlot = TrainerSlot.NONE;
const sortedPartyMemberScores = this.getSortedPartyMemberMatchupScores(partyMemberScores);
const maxScorePartyMemberIndexes = partyMemberScores.filter(pms => pms[1] === sortedPartyMemberScores[0][1]).map(pms => pms[0]);