From f199549753ceb7a503a5d1ff4508a1cbabe908c7 Mon Sep 17 00:00:00 2001 From: geeil-han Date: Wed, 11 Dec 2024 02:48:47 +0100 Subject: [PATCH] added a feature that removes MAKES_CONTACT if necessary --- src/data/move.ts | 4 ++++ src/test/moves/shell_side_arm.test.ts | 33 ++++++++++++++------------- 2 files changed, 21 insertions(+), 16 deletions(-) diff --git a/src/data/move.ts b/src/data/move.ts index 5d165e01dd6..4869f1dd260 100644 --- a/src/data/move.ts +++ b/src/data/move.ts @@ -4621,6 +4621,10 @@ export class ShellSideArmCategoryAttr extends VariableMoveCategoryAttr { move.makesContact(); return true; } + /** MoveFlags are not reset every turn so if this flag is set it needs to be reset if the move is a special attack */ + if (move.hasFlag(MoveFlags.MAKES_CONTACT)) { + move.makesContact(false); + } return false; } } diff --git a/src/test/moves/shell_side_arm.test.ts b/src/test/moves/shell_side_arm.test.ts index f3acd598c37..2614b2df048 100644 --- a/src/test/moves/shell_side_arm.test.ts +++ b/src/test/moves/shell_side_arm.test.ts @@ -34,22 +34,6 @@ describe("Moves - Shell Side Arm", () => { .enemyMoveset(Moves.SPLASH); }); - it("should not make contact if the move stays special", async () => { - game.override.enemySpecies(Species.SLOWBRO).enemyAbility(Abilities.ROUGH_SKIN); - - await game.classicMode.startBattle([ Species.XURKITREE ]); - - const player = game.scene.getPlayerPokemon()!; - - vi.spyOn(shellSideArmAttr, "apply"); - - game.move.select(Moves.SHELL_SIDE_ARM); - await game.toNextTurn(); - - expect(shellSideArmAttr.apply).toHaveLastReturnedWith(false); - expect(player.getMaxHp()).toBe(player.hp); - }); - it("becomes a physical attack if forecasted to deal more damage as physical", async () => { game.override.enemySpecies(Species.SNORLAX); @@ -109,4 +93,21 @@ describe("Moves - Shell Side Arm", () => { expect(shellSideArmAttr.apply).toHaveLastReturnedWith(false); }); + + it("should not make contact if the move stays special", async () => { + game.override.enemySpecies(Species.SLOWBRO).enemyAbility(Abilities.ROUGH_SKIN); + + await game.classicMode.startBattle([ Species.XURKITREE ]); + + const player = game.scene.getPlayerPokemon()!; + + vi.spyOn(shellSideArmAttr, "apply"); + + game.move.select(Moves.SHELL_SIDE_ARM); + await game.toNextTurn(); + + expect(shellSideArmAttr.apply).toHaveLastReturnedWith(false); + expect(player.getMaxHp()).toBe(player.hp); + }); + });