From ad268622a679aacf199785fae2effe58c2d2fb53 Mon Sep 17 00:00:00 2001 From: PrabbyDD Date: Fri, 30 Aug 2024 22:24:02 -0700 Subject: [PATCH] Bug issue 3876, Octolock bug, and additionally some tests added for Big Pecks, Clear Body, and White Smoke Adding tests for octolock --- src/data/battler-tags.ts | 2 +- src/test/moves/octolock.test.ts | 42 +++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+), 1 deletion(-) diff --git a/src/data/battler-tags.ts b/src/data/battler-tags.ts index 8c05d296e76..bca9738a8b0 100644 --- a/src/data/battler-tags.ts +++ b/src/data/battler-tags.ts @@ -750,7 +750,7 @@ export class OctolockTag extends TrappedTag { const shouldLapse = lapseType !== BattlerTagLapseType.CUSTOM || super.lapse(pokemon, lapseType); if (shouldLapse) { - pokemon.scene.unshiftPhase(new StatChangePhase(pokemon.scene, pokemon.getBattlerIndex(), true, [BattleStat.DEF, BattleStat.SPDEF], -1)); + pokemon.scene.unshiftPhase(new StatChangePhase(pokemon.scene, pokemon.getBattlerIndex(), false, [BattleStat.DEF, BattleStat.SPDEF], -1)); return true; } diff --git a/src/test/moves/octolock.test.ts b/src/test/moves/octolock.test.ts index 389e4a4c4cf..34dad13b0d9 100644 --- a/src/test/moves/octolock.test.ts +++ b/src/test/moves/octolock.test.ts @@ -61,6 +61,48 @@ describe("Moves - Octolock", () => { expect(enemyPokemon[0].summonData.battleStats[BattleStat.SPDEF]).toBe(-2); }); + it("If target pokemon has Big Pecks, Octolock should only reduce spdef by 1", { timeout: 10000 }, async () => { + game.override.enemyAbility(Abilities.BIG_PECKS); + await game.startBattle([Species.GRAPPLOCT]); + + const enemyPokemon = game.scene.getEnemyField(); + + // use Octolock and advance to init phase of next turn to check for stat changes + game.move.select(Moves.OCTOLOCK); + await game.phaseInterceptor.to(TurnInitPhase); + + expect(enemyPokemon[0].summonData.battleStats[BattleStat.DEF]).toBe(0); + expect(enemyPokemon[0].summonData.battleStats[BattleStat.SPDEF]).toBe(-1); + }); + + it("If target pokemon has White Smoke, Octolock should not reduce any stats", { timeout: 10000 }, async () => { + game.override.enemyAbility(Abilities.WHITE_SMOKE); + await game.startBattle([Species.GRAPPLOCT]); + + const enemyPokemon = game.scene.getEnemyField(); + + // use Octolock and advance to init phase of next turn to check for stat changes + game.move.select(Moves.OCTOLOCK); + await game.phaseInterceptor.to(TurnInitPhase); + + expect(enemyPokemon[0].summonData.battleStats[BattleStat.DEF]).toBe(0); + expect(enemyPokemon[0].summonData.battleStats[BattleStat.SPDEF]).toBe(0); + }); + + it("If target pokemon has Clear Body, Octolock should not reduce any stats", { timeout: 10000 }, async () => { + game.override.enemyAbility(Abilities.CLEAR_BODY); + await game.startBattle([Species.GRAPPLOCT]); + + const enemyPokemon = game.scene.getEnemyField(); + + // use Octolock and advance to init phase of next turn to check for stat changes + game.move.select(Moves.OCTOLOCK); + await game.phaseInterceptor.to(TurnInitPhase); + + expect(enemyPokemon[0].summonData.battleStats[BattleStat.DEF]).toBe(0); + expect(enemyPokemon[0].summonData.battleStats[BattleStat.SPDEF]).toBe(0); + }); + it("Traps the target pokemon", { timeout: 10000 }, async () => { await game.startBattle([Species.GRAPPLOCT]);