Replaced instances of consecutive game.scene.getPlayerParty with destructuring

This commit is contained in:
Bertie690 2025-07-30 18:14:05 -04:00
parent 5d4e93b009
commit 6013bc8c00
7 changed files with 15 additions and 30 deletions

View File

@ -344,8 +344,7 @@ describe("Abilities - Wimp Out", () => {
it("Wimp Out activating should not cancel a double battle", async () => {
game.override.battleStyle("double").enemyAbility(AbilityId.WIMP_OUT).enemyMoveset([MoveId.SPLASH]).enemyLevel(1);
await game.classicMode.startBattle([SpeciesId.WIMPOD, SpeciesId.TYRUNT]);
const enemyLeadPokemon = game.scene.getEnemyParty()[0];
const enemySecPokemon = game.scene.getEnemyParty()[1];
const [enemyLeadPokemon, enemySecPokemon] = game.scene.getEnemyParty();
game.move.select(MoveId.FALSE_SWIPE, 0, BattlerIndex.ENEMY);
game.move.select(MoveId.SPLASH, 1);

View File

@ -34,8 +34,7 @@ describe("Evolution", () => {
it("should keep hidden ability after evolving", async () => {
await game.classicMode.runToSummon([SpeciesId.EEVEE, SpeciesId.TRAPINCH]);
const eevee = game.scene.getPlayerParty()[0];
const trapinch = game.scene.getPlayerParty()[1];
const [eevee, trapinch] = game.scene.getPlayerParty();
eevee.abilityIndex = 2;
trapinch.abilityIndex = 2;
@ -49,8 +48,7 @@ describe("Evolution", () => {
it("should keep same ability slot after evolving", async () => {
await game.classicMode.runToSummon([SpeciesId.BULBASAUR, SpeciesId.CHARMANDER]);
const bulbasaur = game.scene.getPlayerParty()[0];
const charmander = game.scene.getPlayerParty()[1];
const [bulbasaur, charmander] = game.scene.getPlayerParty();
bulbasaur.abilityIndex = 0;
charmander.abilityIndex = 1;
@ -80,8 +78,7 @@ describe("Evolution", () => {
nincada.gender = 1;
await nincada.evolve(pokemonEvolutions[SpeciesId.NINCADA][0], nincada.getSpeciesForm());
const ninjask = game.scene.getPlayerParty()[0];
const shedinja = game.scene.getPlayerParty()[1];
const [ninjask, shedinja] = game.scene.getPlayerParty();
expect(ninjask.abilityIndex).toBe(2);
expect(shedinja.abilityIndex).toBe(1);
expect(ninjask.gender).toBe(1);

View File

@ -113,8 +113,7 @@ describe("Items - Light Ball", () => {
it("LIGHT_BALL held by fused PIKACHU (base)", async () => {
await game.classicMode.startBattle([SpeciesId.PIKACHU, SpeciesId.MAROWAK]);
const partyMember = game.scene.getPlayerParty()[0];
const ally = game.scene.getPlayerParty()[1];
const [partyMember, ally] = game.scene.getPlayerParty();
// Fuse party members (taken from PlayerPokemon.fuse(...) function)
partyMember.fusionSpecies = ally.species;
@ -152,8 +151,7 @@ describe("Items - Light Ball", () => {
it("LIGHT_BALL held by fused PIKACHU (part)", async () => {
await game.classicMode.startBattle([SpeciesId.MAROWAK, SpeciesId.PIKACHU]);
const partyMember = game.scene.getPlayerParty()[0];
const ally = game.scene.getPlayerParty()[1];
const [partyMember, ally] = game.scene.getPlayerParty();
// Fuse party members (taken from PlayerPokemon.fuse(...) function)
partyMember.fusionSpecies = ally.species;

View File

@ -107,8 +107,7 @@ describe("Items - Metal Powder", () => {
it("METAL_POWDER held by fused DITTO (base)", async () => {
await game.classicMode.startBattle([SpeciesId.DITTO, SpeciesId.MAROWAK]);
const partyMember = game.scene.getPlayerParty()[0];
const ally = game.scene.getPlayerParty()[1];
const [partyMember, ally] = game.scene.getPlayerParty();
// Fuse party members (taken from PlayerPokemon.fuse(...) function)
partyMember.fusionSpecies = ally.species;
@ -140,8 +139,7 @@ describe("Items - Metal Powder", () => {
it("METAL_POWDER held by fused DITTO (part)", async () => {
await game.classicMode.startBattle([SpeciesId.MAROWAK, SpeciesId.DITTO]);
const partyMember = game.scene.getPlayerParty()[0];
const ally = game.scene.getPlayerParty()[1];
const [partyMember, ally] = game.scene.getPlayerParty();
// Fuse party members (taken from PlayerPokemon.fuse(...) function)
partyMember.fusionSpecies = ally.species;

View File

@ -107,8 +107,7 @@ describe("Items - Quick Powder", () => {
it("QUICK_POWDER held by fused DITTO (base)", async () => {
await game.classicMode.startBattle([SpeciesId.DITTO, SpeciesId.MAROWAK]);
const partyMember = game.scene.getPlayerParty()[0];
const ally = game.scene.getPlayerParty()[1];
const [partyMember, ally] = game.scene.getPlayerParty();
// Fuse party members (taken from PlayerPokemon.fuse(...) function)
partyMember.fusionSpecies = ally.species;
@ -140,8 +139,7 @@ describe("Items - Quick Powder", () => {
it("QUICK_POWDER held by fused DITTO (part)", async () => {
await game.classicMode.startBattle([SpeciesId.MAROWAK, SpeciesId.DITTO]);
const partyMember = game.scene.getPlayerParty()[0];
const ally = game.scene.getPlayerParty()[1];
const [partyMember, ally] = game.scene.getPlayerParty();
// Fuse party members (taken from PlayerPokemon.fuse(...) function)
partyMember.fusionSpecies = ally.species;

View File

@ -157,8 +157,7 @@ describe("Items - Thick Club", () => {
await game.classicMode.startBattle([species[randSpecies], SpeciesId.PIKACHU]);
const partyMember = game.scene.getPlayerParty()[0];
const ally = game.scene.getPlayerParty()[1];
const [partyMember, ally] = game.scene.getPlayerParty();
// Fuse party members (taken from PlayerPokemon.fuse(...) function)
partyMember.fusionSpecies = ally.species;
@ -194,8 +193,7 @@ describe("Items - Thick Club", () => {
await game.classicMode.startBattle([SpeciesId.PIKACHU, species[randSpecies]]);
const partyMember = game.scene.getPlayerParty()[0];
const ally = game.scene.getPlayerParty()[1];
const [partyMember, ally] = game.scene.getPlayerParty();
// Fuse party members (taken from PlayerPokemon.fuse(...) function)
partyMember.fusionSpecies = ally.species;

View File

@ -78,8 +78,7 @@ describe("Moves - Dragon Tail", () => {
const leadPokemon = game.scene.getPlayerParty()[0];
const enemyLeadPokemon = game.scene.getEnemyParty()[0];
const enemySecPokemon = game.scene.getEnemyParty()[1];
const [enemyLeadPokemon, enemySecPokemon] = game.scene.getEnemyParty();
game.move.select(MoveId.DRAGON_TAIL, 0, BattlerIndex.ENEMY);
game.move.select(MoveId.SPLASH, 1);
@ -105,11 +104,9 @@ describe("Moves - Dragon Tail", () => {
game.override.battleStyle("double").enemyMoveset(MoveId.SPLASH).enemyAbility(AbilityId.ROUGH_SKIN);
await game.classicMode.startBattle([SpeciesId.DRATINI, SpeciesId.DRATINI, SpeciesId.WAILORD, SpeciesId.WAILORD]);
const leadPokemon = game.scene.getPlayerParty()[0];
const secPokemon = game.scene.getPlayerParty()[1];
const [leadPokemon, secPokemon] = game.scene.getPlayerParty();
const enemyLeadPokemon = game.scene.getEnemyParty()[0];
const enemySecPokemon = game.scene.getEnemyParty()[1];
const [enemyLeadPokemon, enemySecPokemon] = game.scene.getEnemyParty();
game.move.select(MoveId.DRAGON_TAIL, 0, BattlerIndex.ENEMY);
// target the same pokemon, second move should be redirected after first flees