diff --git a/src/field/pokemon.ts b/src/field/pokemon.ts index 2de8cc150c9..f6810ad38e1 100644 --- a/src/field/pokemon.ts +++ b/src/field/pokemon.ts @@ -12,7 +12,6 @@ import BattleInfo, { import type Move from "#app/data/moves/move"; import { HighCritAttr, - StatChangeBeforeDmgCalcAttr, HitsTagAttr, applyMoveAttrs, FixedDamageAttr, @@ -70,10 +69,8 @@ import { EFFECTIVE_STATS, } from "#enums/stat"; import { - DamageMoneyRewardModifier, EnemyDamageBoosterModifier, EnemyDamageReducerModifier, - EnemyEndureChanceModifier, EnemyFusionChanceModifier, HiddenAbilityRateBoosterModifier, BaseStatModifier, @@ -119,7 +116,6 @@ import { TypeImmuneTag, getBattlerTag, SemiInvulnerableTag, - TypeBoostTag, MoveRestrictionBattlerTag, ExposedTag, DragonCheerTag, @@ -188,7 +184,7 @@ import { PreLeaveFieldRemoveSuppressAbilitiesSourceAbAttr, applyAllyStatMultiplierAbAttrs, AllyStatMultiplierAbAttr, - MoveAbilityBypassAbAttr + MoveAbilityBypassAbAttr, } from "#app/data/abilities/ability"; import { allAbilities } from "#app/data/data-lists"; import type PokemonData from "#app/system/pokemon-data"; @@ -202,7 +198,7 @@ import { EVOLVE_MOVE, RELEARN_MOVE, } from "#app/data/balance/pokemon-level-moves"; -import { DamageAchv, achvs } from "#app/system/achv"; +import { achvs } from "#app/system/achv"; import type { StarterDataEntry, StarterMoveset } from "#app/system/game-data"; import { DexAttr } from "#app/system/game-data"; import { @@ -248,7 +244,7 @@ import { PLAYER_PARTY_MAX_SIZE } from "#app/constants"; import { CustomPokemonData } from "#app/data/custom-pokemon-data"; import { SwitchType } from "#enums/switch-type"; import { SpeciesFormKey } from "#enums/species-form-key"; -import {getStatusEffectOverlapText } from "#app/data/status-effect"; +import { getStatusEffectOverlapText } from "#app/data/status-effect"; import { BASE_HIDDEN_ABILITY_CHANCE, BASE_SHINY_CHANCE, @@ -7030,6 +7026,15 @@ export class EnemyPokemon extends Pokemon { } speciesId = prevolution; } + + if (this.hasTrainer() && globalScene.currentBattle) { + const { waveIndex } = globalScene.currentBattle; + const ivs: number[] = []; + while (ivs.length < 6) { + ivs.push(this.randSeedIntRange(Math.floor(waveIndex / 10), 31)); + } + this.ivs = ivs; + } } this.aiType = diff --git a/test/field/pokemon.test.ts b/test/field/pokemon.test.ts index 85128a31f7f..f763ab2c401 100644 --- a/test/field/pokemon.test.ts +++ b/test/field/pokemon.test.ts @@ -209,4 +209,19 @@ describe("Spec - Pokemon", () => { expect(types[1]).toBe(PokemonType.DARK); }); }); + + it.each([5, 25, 55, 95, 145, 195])( + "should set minimum IVs for enemy trainer pokemon based on wave (%i)", + async wave => { + game.override.startingWave(wave); + await game.classicMode.startBattle([Species.FEEBAS]); + const { waveIndex } = game.scene.currentBattle; + + for (const pokemon of game.scene.getEnemyParty()) { + for (const index in pokemon.ivs) { + expect(pokemon.ivs[index]).toBeGreaterThanOrEqual(Math.floor(waveIndex / 10)); + } + } + }, + ); });