added a feature that removes MAKES_CONTACT if necessary

This commit is contained in:
geeil-han 2024-12-11 02:48:47 +01:00
parent c37d90b1fa
commit f199549753
2 changed files with 21 additions and 16 deletions

View File

@ -4621,6 +4621,10 @@ export class ShellSideArmCategoryAttr extends VariableMoveCategoryAttr {
move.makesContact(); move.makesContact();
return true; 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; return false;
} }
} }

View File

@ -34,22 +34,6 @@ describe("Moves - Shell Side Arm", () => {
.enemyMoveset(Moves.SPLASH); .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 () => { it("becomes a physical attack if forecasted to deal more damage as physical", async () => {
game.override.enemySpecies(Species.SNORLAX); game.override.enemySpecies(Species.SNORLAX);
@ -109,4 +93,21 @@ describe("Moves - Shell Side Arm", () => {
expect(shellSideArmAttr.apply).toHaveLastReturnedWith(false); 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);
});
}); });