diff --git a/src/field/pokemon.ts b/src/field/pokemon.ts index 48cd023a5da..11f0ea9cf92 100644 --- a/src/field/pokemon.ts +++ b/src/field/pokemon.ts @@ -6390,6 +6390,7 @@ export class EnemyPokemon extends Pokemon { ivs.push(randSeedIntRange(Math.floor(waveIndex / 10), 31)); } this.ivs = ivs; + this.friendship = Math.round(255 * (waveIndex / 200)); } } diff --git a/test/field/pokemon.test.ts b/test/field/pokemon.test.ts index 87a0da98f25..2bf2e0b23b2 100644 --- a/test/field/pokemon.test.ts +++ b/test/field/pokemon.test.ts @@ -203,14 +203,29 @@ describe("Spec - Pokemon", () => { "should set minimum IVs for enemy trainer pokemon based on wave (%i)", async wave => { game.override.startingWave(wave); - await game.classicMode.startBattle([SpeciesId.FEEBAS]); - const { waveIndex } = game.scene.currentBattle; + await game.classicMode.runToSummon([SpeciesId.FEEBAS]); - for (const pokemon of game.scene.getEnemyParty()) { - for (const index in pokemon.ivs) { - expect(pokemon.ivs[index]).toBeGreaterThanOrEqual(Math.floor(waveIndex / 10)); + for (const pokemon of game.field.getEnemyParty()) { + for (const iv of pokemon.ivs) { + expect(iv).toBeGreaterThanOrEqual(Math.floor(wave / 10)); } } }, ); + + it.each([ + { wave: 5, friendship: 6 }, + { wave: 25, friendship: 32 }, + { wave: 55, friendship: 70 }, + { wave: 95, friendship: 121 }, + { wave: 145, friendship: 185 }, + { wave: 195, friendship: 249 }, + ])("should set friendship for enemy trainer pokemon based on wave ($wave)", async ({ wave, friendship }) => { + game.override.startingWave(wave); + await game.classicMode.runToSummon([SpeciesId.FEEBAS]); + + for (const pokemon of game.field.getEnemyParty()) { + expect(pokemon.friendship).toBe(friendship); + } + }); }); diff --git a/test/test-utils/helpers/field-helper.ts b/test/test-utils/helpers/field-helper.ts index 29eb70ae20c..53864c6ddef 100644 --- a/test/test-utils/helpers/field-helper.ts +++ b/test/test-utils/helpers/field-helper.ts @@ -44,6 +44,26 @@ export class FieldHelper extends GameManagerHelper { return pokemon!; } + /** + * Passthrough for {@linkcode globalScene.getPlayerParty} that adds a check that the party contains at least 1 pokemon. + * @returns The enemy party + */ + public getPlayerParty(): PlayerPokemon[] { + const party = this.game.scene.getPlayerParty(); + expect(party.length).toBeGreaterThan(0); + return party; + } + + /** + * Passthrough for {@linkcode globalScene.getEnemyParty} that adds a check that the party contains at least 1 pokemon. + * @returns The enemy party + */ + public getEnemyParty(): EnemyPokemon[] { + const party = this.game.scene.getEnemyParty(); + expect(party.length).toBeGreaterThan(0); + return party; + } + /** * Helper function to return all on-field {@linkcode Pokemon} in speed order (fastest first). * @param indices - Whether to only return {@linkcode BattlerIndex}es instead of full Pokemon objects