From dc9d7a3e172fc8f4befaeb0f5ff073183f0630a6 Mon Sep 17 00:00:00 2001 From: Bertie690 Date: Tue, 17 Jun 2025 16:55:55 -0400 Subject: [PATCH] Fixed test 0.5 --- test/abilities/imposter.test.ts | 28 ++++++++++++++++++---------- test/abilities/lightningrod.test.ts | 27 +++++++++------------------ test/abilities/storm_drain.test.ts | 2 +- 3 files changed, 28 insertions(+), 29 deletions(-) diff --git a/test/abilities/imposter.test.ts b/test/abilities/imposter.test.ts index 0023dd594da..976bc339dde 100644 --- a/test/abilities/imposter.test.ts +++ b/test/abilities/imposter.test.ts @@ -75,23 +75,31 @@ describe("Abilities - Imposter", () => { }); it("should copy in-battle overridden stats", async () => { - await game.classicMode.startBattle([SpeciesId.DITTO]); + game.override.ability(AbilityId.BALL_FETCH); + await game.classicMode.startBattle([SpeciesId.MAGIKARP, SpeciesId.DITTO]); - const player = game.scene.getPlayerPokemon()!; - const enemy = game.scene.getEnemyPokemon()!; + const [karp, ditto] = game.scene.getPlayerField(); + const enemy = game.field.getEnemyPokemon(); + game.field.mockAbility(ditto, AbilityId.IMPOSTER); - const avgAtk = Math.floor((player.getStat(Stat.ATK, false) + enemy.getStat(Stat.ATK, false)) / 2); - const avgSpAtk = Math.floor((player.getStat(Stat.SPATK, false) + enemy.getStat(Stat.SPATK, false)) / 2); + // Turn 1: Use power split + const avgAtk = Math.floor((karp.getStat(Stat.ATK, false) + enemy.getStat(Stat.ATK, false)) / 2); + const avgSpAtk = Math.floor((karp.getStat(Stat.SPATK, false) + enemy.getStat(Stat.SPATK, false)) / 2); - game.move.use(MoveId.TACKLE); + game.move.use(MoveId.SPLASH); await game.move.forceEnemyMove(MoveId.POWER_SPLIT); - await game.phaseInterceptor.to(TurnEndPhase); + await game.toNextTurn(); - expect(player.getStat(Stat.ATK, false)).toBe(avgAtk); expect(enemy.getStat(Stat.ATK, false)).toBe(avgAtk); - - expect(player.getStat(Stat.SPATK, false)).toBe(avgSpAtk); expect(enemy.getStat(Stat.SPATK, false)).toBe(avgSpAtk); + + // Turn 2: Switch in ditto, should copy enemy ability + game.doSwitchPokemon(1); + await game.move.forceEnemyMove(MoveId.SPLASH); + await game.toNextTurn(); + + expect(ditto.getStat(Stat.ATK, false)).toBe(avgAtk); + expect(ditto.getStat(Stat.SPATK, false)).toBe(avgSpAtk); }); it("should set each move's pp to a maximum of 5", async () => { diff --git a/test/abilities/lightningrod.test.ts b/test/abilities/lightningrod.test.ts index d533838430c..028258a9d56 100644 --- a/test/abilities/lightningrod.test.ts +++ b/test/abilities/lightningrod.test.ts @@ -36,10 +36,8 @@ describe("Abilities - Lightningrod", () => { it("should redirect electric type moves", async () => { await game.classicMode.startBattle([SpeciesId.FEEBAS, SpeciesId.MAGIKARP]); - const enemy1 = game.scene.getEnemyField()[0]; - const enemy2 = game.scene.getEnemyField()[1]; - - enemy2.summonData.ability = AbilityId.LIGHTNING_ROD; + const [enemy1, enemy2] = game.scene.getEnemyField(); + game.field.mockAbility(enemy2, AbilityId.LIGHTNING_ROD); game.move.select(MoveId.SHOCK_WAVE, BattlerIndex.PLAYER, BattlerIndex.ENEMY); game.move.select(MoveId.SPLASH, BattlerIndex.PLAYER_2); @@ -52,10 +50,8 @@ describe("Abilities - Lightningrod", () => { game.override.moveset([MoveId.SPLASH, MoveId.AERIAL_ACE]); await game.classicMode.startBattle([SpeciesId.FEEBAS, SpeciesId.MAGIKARP]); - const enemy1 = game.scene.getEnemyField()[0]; - const enemy2 = game.scene.getEnemyField()[1]; - - enemy2.summonData.ability = AbilityId.LIGHTNING_ROD; + const [enemy1, enemy2] = game.scene.getEnemyField(); + game.field.mockAbility(enemy2, AbilityId.LIGHTNING_ROD); game.move.select(MoveId.AERIAL_ACE, BattlerIndex.PLAYER, BattlerIndex.ENEMY); game.move.select(MoveId.SPLASH, BattlerIndex.PLAYER_2); @@ -68,8 +64,7 @@ describe("Abilities - Lightningrod", () => { await game.classicMode.startBattle([SpeciesId.FEEBAS, SpeciesId.MAGIKARP]); const enemy2 = game.scene.getEnemyField()[1]; - - enemy2.summonData.ability = AbilityId.LIGHTNING_ROD; + game.field.mockAbility(enemy2, AbilityId.LIGHTNING_ROD); game.move.select(MoveId.SHOCK_WAVE, BattlerIndex.PLAYER, BattlerIndex.ENEMY); game.move.select(MoveId.SPLASH, BattlerIndex.PLAYER_2); @@ -83,10 +78,8 @@ describe("Abilities - Lightningrod", () => { game.override.ability(AbilityId.NORMALIZE); await game.classicMode.startBattle([SpeciesId.FEEBAS]); - const enemy1 = game.scene.getEnemyField()[0]; - const enemy2 = game.scene.getEnemyField()[1]; - - enemy2.summonData.ability = AbilityId.LIGHTNING_ROD; + const [enemy1, enemy2] = game.scene.getEnemyField(); + game.field.mockAbility(enemy2, AbilityId.LIGHTNING_ROD); game.move.select(MoveId.SHOCK_WAVE, BattlerIndex.PLAYER, BattlerIndex.ENEMY); await game.phaseInterceptor.to("BerryPhase"); @@ -98,10 +91,8 @@ describe("Abilities - Lightningrod", () => { game.override.ability(AbilityId.GALVANIZE); await game.classicMode.startBattle([SpeciesId.FEEBAS, SpeciesId.MAGIKARP]); - const enemy1 = game.scene.getEnemyField()[0]; - const enemy2 = game.scene.getEnemyField()[1]; - - enemy2.summonData.ability = AbilityId.LIGHTNING_ROD; + const [enemy1, enemy2] = game.scene.getEnemyField(); + game.field.mockAbility(enemy2, AbilityId.LIGHTNING_ROD); game.move.use(MoveId.TACKLE, BattlerIndex.PLAYER, BattlerIndex.ENEMY); await game.phaseInterceptor.to("BerryPhase"); diff --git a/test/abilities/storm_drain.test.ts b/test/abilities/storm_drain.test.ts index 28085138d75..6e56bf44fa7 100644 --- a/test/abilities/storm_drain.test.ts +++ b/test/abilities/storm_drain.test.ts @@ -104,7 +104,7 @@ describe("Abilities - Storm Drain", () => { enemy2.summonData.ability = AbilityId.STORM_DRAIN; - game.move.use(MoveId.HYPER_VOICE, BattlerIndex.PLAYER, BattlerIndex.ENEMY); + game.move.use(MoveId.HYPER_VOICE, BattlerIndex.PLAYER); await game.phaseInterceptor.to("BerryPhase"); expect(enemy1.isFullHp()).toBe(true);