Add more tests

This commit is contained in:
Dean 2025-02-19 14:18:28 -08:00
parent 8c2be2c181
commit e1b2dfd827

View File

@ -1,4 +1,6 @@
import { BattlerIndex } from "#app/battle";
import { Abilities } from "#enums/abilities"; import { Abilities } from "#enums/abilities";
import { ArenaTagType } from "#enums/arena-tag-type";
import { Moves } from "#enums/moves"; import { Moves } from "#enums/moves";
import { Species } from "#enums/species"; import { Species } from "#enums/species";
import { Stat } from "#enums/stat"; import { Stat } from "#enums/stat";
@ -69,18 +71,69 @@ describe("Abilities - Neutralizing Gas", () => {
}); });
it("should activate other abilities when removed", async () => { it("should activate other abilities when removed", async () => {
game.override.enemyAbility(Abilities.INTIMIDATE) game.override.enemyAbility(Abilities.INTREPID_SWORD)
.enemyPassiveAbility(Abilities.DAUNTLESS_SHIELD)
.enemyMoveset(Moves.ENTRAINMENT); .enemyMoveset(Moves.ENTRAINMENT);
await game.classicMode.startBattle([ Species.FEEBAS ]); await game.classicMode.startBattle([ Species.FEEBAS ]);
const playerPokemon = game.scene.getPlayerPokemon(); const enemyPokemon = game.scene.getEnemyPokemon();
expect(playerPokemon?.getStatStage(Stat.ATK)).toBe(0); expect(enemyPokemon?.getStatStage(Stat.ATK)).toBe(0);
expect(enemyPokemon?.getStatStage(Stat.DEF)).toBe(0);
game.move.select(Moves.SPLASH); game.move.select(Moves.SPLASH);
await game.phaseInterceptor.to("BerryPhase"); await game.phaseInterceptor.to("BerryPhase");
// Enemy removes user's ability, so intimidate is activated // Enemy removes user's ability, so both abilities are activated
expect(playerPokemon?.getStatStage(Stat.ATK)).toBe(-1); expect(enemyPokemon?.getStatStage(Stat.ATK)).toBe(1);
expect(enemyPokemon?.getStatStage(Stat.DEF)).toBe(1);
});
it("should not activate the user's other ability when removed", async () => {
game.override.passiveAbility(Abilities.INTIMIDATE)
.enemyMoveset(Moves.ENTRAINMENT);
await game.classicMode.startBattle([ Species.FEEBAS ]);
// Neutralising gas user's passive is still active
const enemyPokemon = game.scene.getEnemyPokemon();
expect(enemyPokemon?.getStatStage(Stat.ATK)).toBe(-1);
game.move.select(Moves.SPLASH);
await game.phaseInterceptor.to("BerryPhase");
// Intimidate did not reactivate after neutralizing gas was removed
expect(enemyPokemon?.getStatStage(Stat.ATK)).toBe(-1);
});
it("should only deactivate when all setters are off the field", async () => {
game.override.enemyMoveset([ Moves.ENTRAINMENT, Moves.SPLASH ])
.battleType("double");
await game.classicMode.startBattle([ Species.ACCELGOR, Species.ACCELGOR ]);
game.move.select(Moves.SPLASH, 0);
game.move.select(Moves.SPLASH, 1);
await game.forceEnemyMove(Moves.ENTRAINMENT, BattlerIndex.PLAYER);
await game.forceEnemyMove(Moves.SPLASH);
await game.setTurnOrder([ BattlerIndex.PLAYER, BattlerIndex.PLAYER_2, BattlerIndex.ENEMY, BattlerIndex.ENEMY_2 ]);
await game.phaseInterceptor.to("BerryPhase");
expect(game.scene.arena.getTag(ArenaTagType.NEUTRALIZING_GAS)).toBeDefined(); // Now one neut gas user is left
game.move.select(Moves.SPLASH, 0);
game.move.select(Moves.SPLASH, 1);
await game.forceEnemyMove(Moves.ENTRAINMENT, BattlerIndex.PLAYER_2);
await game.forceEnemyMove(Moves.SPLASH);
await game.setTurnOrder([ BattlerIndex.PLAYER, BattlerIndex.PLAYER_2, BattlerIndex.ENEMY, BattlerIndex.ENEMY_2 ]);
await game.phaseInterceptor.to("BerryPhase");
expect(game.scene.arena.getTag(ArenaTagType.NEUTRALIZING_GAS)).toBeUndefined(); // No neut gas users are left
});
it.todo("should deactivate when suppressed by gastro acid", async () => {
game.override.enemyMoveset(Moves.GASTRO_ACID);
await game.classicMode.startBattle([ Species.FEEBAS ]);
game.move.select(Moves.SPLASH);
await game.phaseInterceptor.to("BerryPhase");
expect(game.scene.arena.getTag(ArenaTagType.NEUTRALIZING_GAS)).toBeUndefined();
}); });
}); });