fix switching override in doubles

This commit is contained in:
Alex Van Liew 2024-08-08 16:34:04 -07:00 committed by snoozbuster
parent a086b3a0ad
commit c1019bac39
1 changed files with 5 additions and 4 deletions

View File

@ -430,16 +430,17 @@ export default class Trainer extends Phaser.GameObjects.Container {
} }
getPartyMemberMatchupScores(trainerSlot: TrainerSlot = TrainerSlot.NONE, forSwitch: boolean = false): [integer, integer][] { getPartyMemberMatchupScores(trainerSlot: TrainerSlot = TrainerSlot.NONE, forSwitch: boolean = false): [integer, integer][] {
if (Overrides.TRAINER_ALWAYS_SWITCHES) {
return [[1, 100], [1, 100]];
}
if (trainerSlot && !this.isDouble()) { if (trainerSlot && !this.isDouble()) {
trainerSlot = TrainerSlot.NONE; trainerSlot = TrainerSlot.NONE;
} }
const party = this.scene.getEnemyParty(); const party = this.scene.getEnemyParty();
const nonFaintedLegalPartyMembers = party.slice(this.scene.currentBattle.getBattlerCount()).filter(p => p.isAllowedInBattle()).filter(p => !trainerSlot || p.trainerSlot === trainerSlot); const nonFaintedLegalPartyMembers = party.slice(this.scene.currentBattle.getBattlerCount()).filter(p => p.isAllowedInBattle()).filter(p => !trainerSlot || p.trainerSlot === trainerSlot);
if (Overrides.TRAINER_ALWAYS_SWITCHES) {
return nonFaintedLegalPartyMembers.map(p => [party.indexOf(p), 100]);
}
const partyMemberScores = nonFaintedLegalPartyMembers.map(p => { const partyMemberScores = nonFaintedLegalPartyMembers.map(p => {
const playerField = this.scene.getPlayerField().filter(p => p.isAllowedInBattle()); const playerField = this.scene.getPlayerField().filter(p => p.isAllowedInBattle());
let score = 0; let score = 0;