diff --git a/src/data/move.ts b/src/data/move.ts index 7800d6df12a..bf61ed5befe 100644 --- a/src/data/move.ts +++ b/src/data/move.ts @@ -4747,7 +4747,7 @@ export class AddArenaTagAttr extends MoveEffectAttr { return false; } - if (move.chance < 0 || move.chance === 100 || user.randSeedInt(100) < move.chance) { + if ((move.chance < 0 || move.chance === 100 || user.randSeedInt(100) < move.chance) && user.getLastXMoves(1)[0].result === MoveResult.SUCCESS) { user.scene.arena.addTag(this.tagType, this.turnCount, move.id, user.id, (this.selfSideTarget ? user : target).isPlayer() ? ArenaTagSide.PLAYER : ArenaTagSide.ENEMY); return true; } @@ -7417,6 +7417,7 @@ export function initMoves() { .attr(HighCritAttr) .attr(StatusEffectAttr, StatusEffect.BURN), new StatusMove(Moves.MUD_SPORT, Type.GROUND, -1, 15, -1, 0, 3) + .ignoresProtect() .attr(AddArenaTagAttr, ArenaTagType.MUD_SPORT, 5) .target(MoveTarget.BOTH_SIDES), new AttackMove(Moves.ICE_BALL, Type.ICE, MoveCategory.PHYSICAL, 30, 90, 20, -1, 0, 3) @@ -7541,6 +7542,7 @@ export function initMoves() { .recklessMove(), new AttackMove(Moves.MAGICAL_LEAF, Type.GRASS, MoveCategory.SPECIAL, 60, -1, 20, -1, 0, 3), new StatusMove(Moves.WATER_SPORT, Type.WATER, -1, 15, -1, 0, 3) + .ignoresProtect() .attr(AddArenaTagAttr, ArenaTagType.WATER_SPORT, 5) .target(MoveTarget.BOTH_SIDES), new SelfStatusMove(Moves.CALM_MIND, Type.PSYCHIC, -1, 20, -1, 0, 3) @@ -7569,6 +7571,7 @@ export function initMoves() { .attr(AddBattlerTagAttr, BattlerTagType.ROOSTED, true, false) .triageMove(), new StatusMove(Moves.GRAVITY, Type.PSYCHIC, -1, 5, -1, 0, 4) + .ignoresProtect() .attr(AddArenaTagAttr, ArenaTagType.GRAVITY, 5) .target(MoveTarget.BOTH_SIDES), new StatusMove(Moves.MIRACLE_EYE, Type.PSYCHIC, -1, 40, -1, 0, 4) diff --git a/src/test/moves/baddy_bad.test.ts b/src/test/moves/baddy_bad.test.ts new file mode 100644 index 00000000000..d1a221453a6 --- /dev/null +++ b/src/test/moves/baddy_bad.test.ts @@ -0,0 +1,43 @@ +import { Abilities } from "#enums/abilities"; +import { Moves } from "#enums/moves"; +import { Species } from "#enums/species"; +import GameManager from "#test/utils/gameManager"; +import Phaser from "phaser"; +import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; + +describe("Moves - Baddy Bad", () => { + let phaserGame: Phaser.Game; + let game: GameManager; + const TIMEOUT = 20 * 1000; + + beforeAll(() => { + phaserGame = new Phaser.Game({ + type: Phaser.HEADLESS, + }); + }); + + afterEach(() => { + game.phaseInterceptor.restoreOg(); + }); + + beforeEach(() => { + game = new GameManager(phaserGame); + game.override + .moveset([Moves.SPLASH]) + .battleType("single") + .enemySpecies(Species.MAGIKARP) + .enemyAbility(Abilities.BALL_FETCH) + .enemyMoveset(Moves.SPLASH) + .ability(Abilities.BALL_FETCH); + }); + + it("should not activate Reflect if the move fails due to Protect", async () => { + game.override.enemyMoveset(Moves.PROTECT); + await game.classicMode.startBattle([Species.FEEBAS]); + + game.move.select(Moves.BADDY_BAD); + await game.phaseInterceptor.to("BerryPhase"); + + expect(game.scene.arena.tags.length).toBe(0); + }, TIMEOUT); +});