Bug issue 3876, Octolock bug, and additionally some tests added for Big

Pecks, Clear Body, and White Smoke

Adding tests for octolock
This commit is contained in:
PrabbyDD 2024-08-30 22:24:02 -07:00
parent ce0ba3fbf9
commit ad268622a6
2 changed files with 43 additions and 1 deletions

View File

@ -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;
}

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