[Balance] Enemy trainer Pokemon will have friendship based on the wave

https://github.com/pagefaultgames/pokerogue/pull/6617

The formula is `round(max friendship * (current wave / 200))`
where the max friendship value a Pokemon can have is `255`
and `current wave / 200` represents a % value based on
how far in the game you are
This commit is contained in:
NightKev 2025-10-03 09:09:35 -07:00 committed by GitHub
parent 35da617d0b
commit c31adf9e7b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 41 additions and 5 deletions

View File

@ -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));
}
}

View File

@ -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);
}
});
});

View File

@ -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