[Bug] Fix Octolock Ignores Clear Body, White Smoke, Big Pecks #3876

Pecks, Clear Body, and White Smoke

Adding tests for octolock
This commit is contained in:
PrabbyDD 2024-09-01 21:20:16 -07:00 committed by GitHub
parent 22d31bc704
commit 4553c1c34f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 43 additions and 1 deletions

View File

@ -767,7 +767,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;
}

View File

@ -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]);