From 516cec232dd0f5a797723c5ec77e8e56bd8eff08 Mon Sep 17 00:00:00 2001 From: frutescens Date: Wed, 21 Aug 2024 23:47:45 -0700 Subject: [PATCH] Added test fixes and removed unwanted edit. --- src/enums/battle-spec.ts | 3 +-- src/test/abilities/mycelium_might.test.ts | 21 ++++++++++++++------- src/test/abilities/stall.test.ts | 18 ++++++++++++------ 3 files changed, 27 insertions(+), 15 deletions(-) diff --git a/src/enums/battle-spec.ts b/src/enums/battle-spec.ts index ca7dbe929e5..00bc7f92fea 100644 --- a/src/enums/battle-spec.ts +++ b/src/enums/battle-spec.ts @@ -1,5 +1,4 @@ export enum BattleSpec { DEFAULT, - FINAL_BOSS, - FINAL_BOSS_MONOTYPE + FINAL_BOSS } diff --git a/src/test/abilities/mycelium_might.test.ts b/src/test/abilities/mycelium_might.test.ts index 061c43a1e9b..9c92ee46bdc 100644 --- a/src/test/abilities/mycelium_might.test.ts +++ b/src/test/abilities/mycelium_might.test.ts @@ -44,8 +44,10 @@ describe("Abilities - Mycelium Might", () => { it("If a Pokemon with Mycelium Might uses a status move, it will always move last but the status move will ignore protective abilities", async() => { await game.startBattle([ Species.REGIELEKI ]); - const enemyPokemon = game.scene.getEnemyPokemon(); + const enemyPokemon = game.scene.getEnemyPokemon(); + const playerPokemonIndex = game.scene.getPlayerPokemon().getBattlerIndex(); + const enemyPokemonIndex = enemyPokemon.getBattlerIndex(); game.doAttack(getMovePosition(game.scene, 0, Moves.BABY_DOLL_EYES)); await game.phaseInterceptor.run(EnemyCommandPhase); @@ -54,8 +56,8 @@ describe("Abilities - Mycelium Might", () => { const commandOrder = phase.getCommandOrder(); // The opponent Pokemon (without Mycelium Might) goes first despite having lower speed than the player Pokemon. // The player Pokemon (with Mycelium Might) goes last despite having higher speed than the opponent. - // This means that the commandOrder is equivalent to the speed Order reversed - expect(speedOrder.reverse()).toEqual(commandOrder); + expect(speedOrder).toEqual([playerPokemonIndex, enemyPokemonIndex]); + expect(commandOrder).toEqual([enemyPokemonIndex, playerPokemonIndex]); await game.phaseInterceptor.to(TurnEndPhase); // Despite the opponent's ability (Clear Body), its attack stat is still reduced. expect(enemyPokemon?.summonData.battleStats[BattleStat.ATK]).toBe(-1); @@ -64,8 +66,10 @@ describe("Abilities - Mycelium Might", () => { it("Pokemon with Mycelium Might will go first if a status move that is in a higher priority bracket than the opponent's move is used", async() => { game.override.enemyMoveset([Moves.TACKLE, Moves.TACKLE, Moves.TACKLE, Moves.TACKLE]); await game.startBattle([ Species.REGIELEKI ]); - const enemyPokemon = game.scene.getEnemyPokemon(); + const enemyPokemon = game.scene.getEnemyPokemon(); + const playerPokemonIndex = game.scene.getPlayerPokemon().getBattlerIndex(); + const enemyPokemonIndex = enemyPokemon.getBattlerIndex(); game.doAttack(getMovePosition(game.scene, 0, Moves.BABY_DOLL_EYES)); await game.phaseInterceptor.run(EnemyCommandPhase); @@ -74,8 +78,8 @@ describe("Abilities - Mycelium Might", () => { const commandOrder = phase.getCommandOrder(); // The player Pokemon (with M.M.) goes first because its move is still within a higher priority bracket than its opponent. // The enemy Pokemon goes second because its move is in a lower priority bracket. - // This means that the commandOrder should be identical to the speedOrder - expect(speedOrder).toEqual(commandOrder); + expect(speedOrder).toEqual([playerPokemonIndex, enemyPokemonIndex]); + expect(commandOrder).toEqual([playerPokemonIndex, enemyPokemonIndex]); await game.phaseInterceptor.to(TurnEndPhase); // Despite the opponent's ability (Clear Body), its attack stat is still reduced. expect(enemyPokemon?.summonData.battleStats[BattleStat.ATK]).toBe(-1); @@ -84,6 +88,8 @@ describe("Abilities - Mycelium Might", () => { it("Order is established normally if the Pokemon uses a non-status move", async() => { await game.startBattle([ Species.REGIELEKI ]); + const playerPokemonIndex = game.scene.getPlayerPokemon().getBattlerIndex(); + const enemyPokemonIndex = game.scene.getEnemyPokemon().getBattlerIndex(); game.doAttack(getMovePosition(game.scene, 0, Moves.QUICK_ATTACK)); await game.phaseInterceptor.run(EnemyCommandPhase); @@ -93,6 +99,7 @@ describe("Abilities - Mycelium Might", () => { // The player Pokemon (with M.M.) goes first because it has a higher speed and did not use a status move. // The enemy Pokemon (without M.M.) goes second because its speed is lower. // This means that the commandOrder should be identical to the speedOrder - expect(speedOrder).toEqual(commandOrder); + expect(speedOrder).toEqual([playerPokemonIndex, enemyPokemonIndex]); + expect(commandOrder).toEqual([playerPokemonIndex, enemyPokemonIndex]); }, 20000); }); diff --git a/src/test/abilities/stall.test.ts b/src/test/abilities/stall.test.ts index b4374e31e20..270fdacd7cc 100644 --- a/src/test/abilities/stall.test.ts +++ b/src/test/abilities/stall.test.ts @@ -41,6 +41,8 @@ describe("Abilities - Stall", () => { it("Pokemon with Stall should move last in its priority bracket regardless of speed", async() => { await game.startBattle([ Species.SHUCKLE ]); + const playerPokemonIndex = game.scene.getPlayerPokemon().getBattlerIndex(); + const enemyPokemonIndex = game.scene.getEnemyPokemon().getBattlerIndex(); game.doAttack(getMovePosition(game.scene, 0, Moves.QUICK_ATTACK)); await game.phaseInterceptor.run(EnemyCommandPhase); @@ -49,13 +51,15 @@ describe("Abilities - Stall", () => { const commandOrder = phase.getCommandOrder(); // The player Pokemon (without Stall) goes first despite having lower speed than the opponent. // The opponent Pokemon (with Stall) goes last despite having higher speed than the player Pokemon. - // This means that the commandOrder is equivalent to the speed Order reversed - expect(speedOrder.reverse()).toEqual(commandOrder); + expect(speedOrder).toEqual([enemyPokemonIndex, playerPokemonIndex]); + expect(commandOrder).toEqual([playerPokemonIndex, enemyPokemonIndex]); }, 20000); it("Pokemon with Stall will go first if a move that is in a higher priority bracket than the opponent's move is used", async() => { await game.startBattle([ Species.SHUCKLE ]); + const playerPokemonIndex = game.scene.getPlayerPokemon().getBattlerIndex(); + const enemyPokemonIndex = game.scene.getEnemyPokemon().getBattlerIndex(); game.doAttack(getMovePosition(game.scene, 0, Moves.TACKLE)); await game.phaseInterceptor.run(EnemyCommandPhase); @@ -64,14 +68,16 @@ describe("Abilities - Stall", () => { const commandOrder = phase.getCommandOrder(); // The opponent Pokemon (with Stall) goes first because its move is still within a higher priority bracket than its opponent. // The player Pokemon goes second because its move is in a lower priority bracket. - // This means that the commandOrder should be identical to the speedOrder - expect(speedOrder).toEqual(commandOrder); + expect(speedOrder).toEqual([enemyPokemonIndex, playerPokemonIndex]); + expect(commandOrder).toEqual([enemyPokemonIndex, playerPokemonIndex]); }, 20000); it("If both Pokemon have stall and use the same move, speed is used to determine who goes first.", async() => { game.override.ability(Abilities.STALL); await game.startBattle([ Species.SHUCKLE ]); + const playerPokemonIndex = game.scene.getPlayerPokemon().getBattlerIndex(); + const enemyPokemonIndex = game.scene.getEnemyPokemon().getBattlerIndex(); game.doAttack(getMovePosition(game.scene, 0, Moves.TACKLE)); await game.phaseInterceptor.run(EnemyCommandPhase); @@ -81,7 +87,7 @@ describe("Abilities - Stall", () => { // The opponent Pokemon (with Stall) goes first because it has a higher speed. // The player Pokemon (with Stall) goes second because its speed is lower. - // This means that the commandOrder should be identical to the speedOrder - expect(speedOrder).toEqual(commandOrder); + expect(speedOrder).toEqual([enemyPokemonIndex, playerPokemonIndex]); + expect(commandOrder).toEqual([enemyPokemonIndex, playerPokemonIndex]); }, 20000); });