Fix for single battle trainer summoning issue

pull/16/head
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); switchOutTarget.scene.field.remove(switchOutTarget);
if (switchOutTarget.hp) 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 { } else {
switchOutTarget.setVisible(false); 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 { 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 sortedPartyMemberScores = this.getSortedPartyMemberMatchupScores(partyMemberScores);
const maxScorePartyMemberIndexes = partyMemberScores.filter(pms => pms[1] === sortedPartyMemberScores[0][1]).map(pms => pms[0]); const maxScorePartyMemberIndexes = partyMemberScores.filter(pms => pms[1] === sortedPartyMemberScores[0][1]).map(pms => pms[0]);