diff --git a/src/battle-scene.ts b/src/battle-scene.ts index c3b32eb16b3..64b4a97dd0b 100644 --- a/src/battle-scene.ts +++ b/src/battle-scene.ts @@ -636,7 +636,27 @@ export default class BattleScene extends Phaser.Scene { newBattleType = BattleType.TRAINER; else if (newWaveIndex % 10 !== 1 && newWaveIndex % 10) { const trainerChance = this.arena.getTrainerChance(); - newBattleType = trainerChance && !Utils.randSeedInt(trainerChance) ? BattleType.TRAINER : BattleType.WILD; + let allowTrainerBattle = true; + if (trainerChance && this.gameMode === GameMode.CLASSIC) { + const waveBase = Math.floor(newWaveIndex / 10) * 10; + for (let w = Math.max(newWaveIndex - 3, waveBase + 2); w <= Math.min(newWaveIndex + 3, waveBase + 9); w++) { + if (w === newWaveIndex) + continue; + if (((w > 20 && !(w % 30)) || fixedBattles.hasOwnProperty(w))) { + allowTrainerBattle = false; + break; + } else if (w < newWaveIndex) { + this.executeWithSeedOffset(() => { + const waveTrainerChance = this.arena.getTrainerChance(); + if (!Utils.randSeedInt(waveTrainerChance)) + allowTrainerBattle = false; + }, w); + if (!allowTrainerBattle) + break; + } + } + } + newBattleType = allowTrainerBattle && trainerChance && !Utils.randSeedInt(trainerChance) ? BattleType.TRAINER : BattleType.WILD; } else newBattleType = BattleType.WILD; } else diff --git a/src/data/trainer-type.ts b/src/data/trainer-type.ts index b0ed50db724..6c4f0625205 100644 --- a/src/data/trainer-type.ts +++ b/src/data/trainer-type.ts @@ -1,5 +1,5 @@ import BattleScene, { startingWave } from "../battle-scene"; -import { ModifierType, ModifierTypeFunc, modifierTypes } from "../modifier/modifier-type"; +import { ModifierTypeFunc, modifierTypes } from "../modifier/modifier-type"; import { EnemyPokemon } from "../pokemon"; import * as Utils from "../utils"; import { Moves } from "./move"; diff --git a/src/messages.ts b/src/messages.ts index 5c39f5fa51b..a848701ed8b 100644 --- a/src/messages.ts +++ b/src/messages.ts @@ -1,5 +1,5 @@ import Pokemon from "./pokemon"; export function getPokemonMessage(pokemon: Pokemon, content: string): string { - return `${!pokemon.isPlayer() ? 'Wild ' : ''}${pokemon.name}${content}`; + return `${!pokemon.isPlayer() ? pokemon.hasTrainer() ? 'Foe ' : 'Wild ' : ''}${pokemon.name}${content}`; } \ No newline at end of file