From 7870c718b2718227e1841068a7420fc03a75bbb6 Mon Sep 17 00:00:00 2001 From: innerthunder Date: Thu, 29 Aug 2024 23:18:20 -0700 Subject: [PATCH] More edge case tests --- src/test/moves/powder.test.ts | 79 ++++++++++++++++++++++++++++++++--- 1 file changed, 74 insertions(+), 5 deletions(-) diff --git a/src/test/moves/powder.test.ts b/src/test/moves/powder.test.ts index 3f8a05940ae..e38d508a002 100644 --- a/src/test/moves/powder.test.ts +++ b/src/test/moves/powder.test.ts @@ -51,14 +51,50 @@ describe("Moves - Powder", () => { await game.phaseInterceptor.to(BerryPhase, false); expect(enemyPokemon.getLastXMoves()[0].result).toBe(MoveResult.FAIL); expect(enemyPokemon.hp).toBe(Math.ceil(3 * enemyPokemon.getMaxHp() / 4)); + + await game.toNextTurn(); + + game.move.select(Moves.SPLASH); + + await game.phaseInterceptor.to(BerryPhase, false); + expect(enemyPokemon.getLastXMoves()[0].result).toBe(MoveResult.SUCCESS); + expect(enemyPokemon.hp).toBe(Math.ceil(3 * enemyPokemon.getMaxHp() / 4)); }, TIMEOUT ); - it.todo("should not cancel Fire-type moves after the turn it's used"); + it( + "should have no effect against Grass-type Pokemon", + async () => { + game.override.enemySpecies(Species.AMOONGUSS); - it.todo("should have no effect against Grass-type Pokemon"); + await game.classicMode.startBattle([Species.CHARIZARD]); - it.todo("should have no effect against Pokemon with Overcoat"); + const enemyPokemon = game.scene.getEnemyPokemon()!; + + game.move.select(Moves.POWDER); + + await game.phaseInterceptor.to(BerryPhase, false); + expect(enemyPokemon.getLastXMoves()[0].result).toBe(MoveResult.SUCCESS); + expect(enemyPokemon.hp).toBe(enemyPokemon.getMaxHp()); + }, TIMEOUT + ); + + it( + "should have no effect against Pokemon with Overcoat", + async () => { + game.override.enemyAbility(Abilities.OVERCOAT); + + await game.classicMode.startBattle([Species.CHARIZARD]); + + const enemyPokemon = game.scene.getEnemyPokemon()!; + + game.move.select(Moves.POWDER); + + await game.phaseInterceptor.to(BerryPhase, false); + expect(enemyPokemon.getLastXMoves()[0].result).toBe(MoveResult.SUCCESS); + expect(enemyPokemon.hp).toBe(enemyPokemon.getMaxHp()); + }, TIMEOUT + ); it( "should not damage the target if the target has Magic Guard", @@ -115,6 +151,7 @@ describe("Moves - Powder", () => { }, TIMEOUT ); + // TODO: Implement this interaction and enable this test it.skip( "should cancel Fire-type moves generated by the target's Dancer ability", async () => { @@ -140,7 +177,39 @@ describe("Moves - Powder", () => { }, TIMEOUT ); - it.todo("should cancel Revelation Dance if it becomes a Fire-type move"); + it( + "should cancel Revelation Dance if it becomes a Fire-type move", + async () => { + game.override + .enemySpecies(Species.CHARIZARD) + .enemyMoveset(Array(4).fill(Moves.REVELATION_DANCE)); - it.todo("should cancel Shell Trap and damage the target, even if the move would fail"); + await game.classicMode.startBattle([Species.CHARIZARD]); + + const enemyPokemon = game.scene.getEnemyPokemon()!; + + game.move.select(Moves.POWDER); + + await game.phaseInterceptor.to(BerryPhase, false); + expect(enemyPokemon.getLastXMoves()[0].result).toBe(MoveResult.FAIL); + expect(enemyPokemon.hp).toBe(Math.ceil(3 * enemyPokemon.getMaxHp() / 4)); + }, TIMEOUT + ); + + it( + "should cancel Shell Trap and damage the target, even if the move would fail", + async () => { + game.override.enemyMoveset(Array(4).fill(Moves.SHELL_TRAP)); + + await game.classicMode.startBattle([Species.CHARIZARD]); + + const enemyPokemon = game.scene.getEnemyPokemon()!; + + game.move.select(Moves.POWDER); + + await game.phaseInterceptor.to(BerryPhase, false); + expect(enemyPokemon.getLastXMoves()[0].result).toBe(MoveResult.FAIL); + expect(enemyPokemon.hp).toBe(Math.ceil(3 * enemyPokemon.getMaxHp() / 4)); + }, TIMEOUT + ); });