diff --git a/src/data/trainer-type.ts b/src/data/trainer-type.ts index 8056f23ba..52ee8170e 100644 --- a/src/data/trainer-type.ts +++ b/src/data/trainer-type.ts @@ -1,4 +1,4 @@ -import BattleScene from "../battle-scene"; +import BattleScene, { startingWave } from "../battle-scene"; import { ModifierType, ModifierTypeFunc, modifierTypes } from "../modifier/modifier-type"; import { EnemyPokemon } from "../pokemon"; import * as Utils from "../utils"; @@ -510,7 +510,7 @@ interface TrainerConfigs { } function getWavePartyTemplate(scene: BattleScene, ...templates: TrainerPartyTemplate[]) { - return templates[Math.min(Math.max(Math.ceil((scene.currentBattle.waveIndex - 10) / 20) - 1, 0), templates.length - 1)]; + return templates[Math.min(Math.max(Math.ceil(((scene.currentBattle?.waveIndex || startingWave) - 10) / 20) - 1, 0), templates.length - 1)]; } function getGymLeaderPartyTemplate(scene: BattleScene) { diff --git a/src/trainer.ts b/src/trainer.ts index 9c1dc58eb..5feea41dd 100644 --- a/src/trainer.ts +++ b/src/trainer.ts @@ -153,7 +153,7 @@ export default class Trainer extends Phaser.GameObjects.Container { const tierPool = this.config.speciesPools[tier]; ret = getPokemonSpecies(getPokemonSpecies(Phaser.Math.RND.pick(tierPool)).getSpeciesForLevel(level, true)); } else - ret = getPokemonSpecies(this.scene.randomSpecies(battle.waveIndex, level, false, this.config.speciesFilter).getSpeciesForLevel(level)); + ret = getPokemonSpecies(this.scene.randomSpecies(battle.waveIndex, level, false, this.config.speciesFilter).getSpeciesForLevel(level, true)); if (template.isBalanced(battle.enemyParty.length)) { const partyMemberTypes = battle.enemyParty.map(p => p.getTypes()).flat();