From 6fede7d55c5d3aa8115c866be298f42e30181734 Mon Sep 17 00:00:00 2001 From: NightKev <34855794+DayKev@users.noreply.github.com> Date: Thu, 3 Oct 2024 03:06:33 -0700 Subject: [PATCH] Add test for Serene Grace interaction --- src/test/moves/triple_arrows.test.ts | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/src/test/moves/triple_arrows.test.ts b/src/test/moves/triple_arrows.test.ts index e1bc4f80c36..94e2875c3cc 100644 --- a/src/test/moves/triple_arrows.test.ts +++ b/src/test/moves/triple_arrows.test.ts @@ -9,6 +9,9 @@ import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vite describe("Moves - Triple Arrows", () => { let phaserGame: Phaser.Game; let game: GameManager; + const tripleArrows = allMoves[Moves.TRIPLE_ARROWS]; + const flinchAttr = tripleArrows.getAttrs(FlinchAttr)[0]; + const defDropAttr = tripleArrows.getAttrs(StatStageChangeAttr)[0]; beforeAll(() => { phaserGame = new Phaser.Game({ @@ -27,16 +30,14 @@ describe("Moves - Triple Arrows", () => { .moveset([Moves.TRIPLE_ARROWS]) .battleType("single") .enemySpecies(Species.MAGIKARP) - .enemyAbility(Abilities.BALL_FETCH) + .enemyAbility(Abilities.STURDY) .enemyMoveset(Moves.SPLASH); + + vi.spyOn(flinchAttr, "getMoveChance"); + vi.spyOn(defDropAttr, "getMoveChance"); }); it("has a 30% flinch chance and 50% defense drop chance", async () => { - const tripleArrows = allMoves[Moves.TRIPLE_ARROWS]; - const flinchAttr = tripleArrows.getAttrs(FlinchAttr)[0]; - const defDropAttr = tripleArrows.getAttrs(StatStageChangeAttr)[0]; - vi.spyOn(flinchAttr, "getMoveChance"); - vi.spyOn(defDropAttr, "getMoveChance"); await game.classicMode.startBattle([Species.FEEBAS]); game.move.select(Moves.TRIPLE_ARROWS); @@ -45,4 +46,15 @@ describe("Moves - Triple Arrows", () => { expect(flinchAttr.getMoveChance).toHaveReturnedWith(30); expect(defDropAttr.getMoveChance).toHaveReturnedWith(50); }); + + it("is affected normally by Serene Grace", async () => { + game.override.ability(Abilities.SERENE_GRACE); + await game.classicMode.startBattle([Species.FEEBAS]); + + game.move.select(Moves.TRIPLE_ARROWS); + await game.phaseInterceptor.to("BerryPhase"); + + expect(flinchAttr.getMoveChance).toHaveReturnedWith(60); + expect(defDropAttr.getMoveChance).toHaveReturnedWith(100); + }); });