Actually fix single battle summoning issue

This commit is contained in:
Flashfyre 2024-03-21 12:34:19 -04:00
parent 918a0d77f1
commit 7189258095
3 changed files with 6 additions and 3 deletions

View File

@ -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 => {

View File

@ -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);

View File

@ -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);
}
}