Fix trainer random Pokemon always first evolution

pull/2/head
Flashfyre 2023-11-09 08:27:17 -05:00
parent f0055048ed
commit 5a88344173
2 changed files with 3 additions and 3 deletions

View File

@ -1,4 +1,4 @@
import BattleScene from "../battle-scene"; import BattleScene, { startingWave } from "../battle-scene";
import { ModifierType, ModifierTypeFunc, modifierTypes } from "../modifier/modifier-type"; import { ModifierType, ModifierTypeFunc, modifierTypes } from "../modifier/modifier-type";
import { EnemyPokemon } from "../pokemon"; import { EnemyPokemon } from "../pokemon";
import * as Utils from "../utils"; import * as Utils from "../utils";
@ -510,7 +510,7 @@ interface TrainerConfigs {
} }
function getWavePartyTemplate(scene: BattleScene, ...templates: TrainerPartyTemplate[]) { 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) { function getGymLeaderPartyTemplate(scene: BattleScene) {

View File

@ -153,7 +153,7 @@ export default class Trainer extends Phaser.GameObjects.Container {
const tierPool = this.config.speciesPools[tier]; const tierPool = this.config.speciesPools[tier];
ret = getPokemonSpecies(getPokemonSpecies(Phaser.Math.RND.pick(tierPool)).getSpeciesForLevel(level, true)); ret = getPokemonSpecies(getPokemonSpecies(Phaser.Math.RND.pick(tierPool)).getSpeciesForLevel(level, true));
} else } 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)) { if (template.isBalanced(battle.enemyParty.length)) {
const partyMemberTypes = battle.enemyParty.map(p => p.getTypes()).flat(); const partyMemberTypes = battle.enemyParty.map(p => p.getTypes()).flat();