From 71892580959e82163f2bc6d8cbb669bb33c8327d Mon Sep 17 00:00:00 2001 From: Flashfyre Date: Thu, 21 Mar 2024 12:34:19 -0400 Subject: [PATCH] Actually fix single battle summoning issue --- src/field/trainer.ts | 3 +++ src/system/game-data.ts | 2 +- src/system/pokemon-data.ts | 4 ++-- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/field/trainer.ts b/src/field/trainer.ts index b2fa9fd32..5cb0646b2 100644 --- a/src/field/trainer.ts +++ b/src/field/trainer.ts @@ -271,6 +271,9 @@ export default class Trainer extends Phaser.GameObjects.Container { } getPartyMemberMatchupScores(trainerSlot: TrainerSlot = TrainerSlot.NONE): [integer, integer][] { + if (trainerSlot && !this.isDouble()) + trainerSlot = TrainerSlot.NONE; + const party = this.scene.getEnemyParty(); const nonFaintedPartyMembers = party.slice(this.scene.currentBattle.getBattlerCount()).filter(p => !p.isFainted()).filter(p => !trainerSlot || p.trainerSlot === trainerSlot); const partyMemberScores = nonFaintedPartyMembers.map(p => { diff --git a/src/system/game-data.ts b/src/system/game-data.ts index b95b09cac..afad63067 100644 --- a/src/system/game-data.ts +++ b/src/system/game-data.ts @@ -583,7 +583,7 @@ export class GameData { scene.newArena(sessionData.arena.biome, true); sessionData.enemyParty.forEach((enemyData, e) => { - const enemyPokemon = enemyData.toPokemon(scene, battleType, e) as EnemyPokemon; + const enemyPokemon = enemyData.toPokemon(scene, battleType, e, sessionData.trainer?.variant === TrainerVariant.DOUBLE) as EnemyPokemon; battle.enemyParty[e] = enemyPokemon; if (battleType === BattleType.WILD) battle.seenEnemyPartyMemberIds.add(enemyPokemon.id); diff --git a/src/system/pokemon-data.ts b/src/system/pokemon-data.ts index f37ae2eab..c2dc3ce86 100644 --- a/src/system/pokemon-data.ts +++ b/src/system/pokemon-data.ts @@ -105,10 +105,10 @@ export default class PokemonData { } } - toPokemon(scene: BattleScene, battleType?: BattleType, partyMemberIndex: integer = 0): Pokemon { + toPokemon(scene: BattleScene, battleType?: BattleType, partyMemberIndex: integer = 0, double: boolean = false): Pokemon { const species = getPokemonSpecies(this.species); if (this.player) return scene.addPlayerPokemon(species, this.level, this.abilityIndex, this.formIndex, this.gender, this.shiny, this.ivs, this.nature, this); - return scene.addEnemyPokemon(species, this.level, battleType === BattleType.TRAINER ? !(partyMemberIndex % 2) ? TrainerSlot.TRAINER : TrainerSlot.TRAINER_PARTNER : TrainerSlot.NONE, this.boss, this); + return scene.addEnemyPokemon(species, this.level, battleType === BattleType.TRAINER ? !double || !(partyMemberIndex % 2) ? TrainerSlot.TRAINER : TrainerSlot.TRAINER_PARTNER : TrainerSlot.NONE, this.boss, this); } } \ No newline at end of file