making tests more rigorous

This commit is contained in:
PrabbyDD 2024-09-20 22:33:18 -07:00
parent b8ad707f8b
commit 6ba4540915
4 changed files with 33 additions and 21 deletions

View File

@ -145,13 +145,14 @@ describe("Abilities - Dry Skin", () => {
it("opposing water moves still heal regardless of accuracy check", async () => { it("opposing water moves still heal regardless of accuracy check", async () => {
await game.classicMode.startBattle(); await game.classicMode.startBattle();
const enemyPokemon = game.scene.getEnemyPokemon()!; const enemy = game.scene.getEnemyPokemon()!;
game.move.select(Moves.WATER_GUN); game.move.select(Moves.WATER_GUN);
enemy.hp = enemy.hp - 1;
await game.phaseInterceptor.to("MoveEffectPhase"); await game.phaseInterceptor.to("MoveEffectPhase");
await game.move.forceMiss(); await game.move.forceMiss();
await game.phaseInterceptor.to("BerryPhase", false); await game.phaseInterceptor.to("BerryPhase", false);
expect(enemyPokemon.hp).toBe(enemyPokemon.getMaxHp()); expect(enemy.hp).toBe(enemy.getMaxHp());
}); });
}); });

View File

@ -38,7 +38,7 @@ describe("Abilities - Flash Fire", () => {
it("immune to Fire-type moves", async () => { it("immune to Fire-type moves", async () => {
game.override.enemyMoveset([Moves.EMBER]).moveset(Moves.SPLASH); game.override.enemyMoveset([Moves.EMBER]).moveset(Moves.SPLASH);
await game.startBattle([Species.BLISSEY]); await game.classicMode.startBattle([Species.BLISSEY]);
const blissey = game.scene.getPlayerPokemon()!; const blissey = game.scene.getPlayerPokemon()!;
@ -49,7 +49,7 @@ describe("Abilities - Flash Fire", () => {
it("not activate if the Pokémon is protected from the Fire-type move", async () => { it("not activate if the Pokémon is protected from the Fire-type move", async () => {
game.override.enemyMoveset([Moves.EMBER]).moveset([Moves.PROTECT]); game.override.enemyMoveset([Moves.EMBER]).moveset([Moves.PROTECT]);
await game.startBattle([Species.BLISSEY]); await game.classicMode.startBattle([Species.BLISSEY]);
const blissey = game.scene.getPlayerPokemon()!; const blissey = game.scene.getPlayerPokemon()!;
@ -60,7 +60,7 @@ describe("Abilities - Flash Fire", () => {
it("activated by Will-O-Wisp", async () => { it("activated by Will-O-Wisp", async () => {
game.override.enemyMoveset([Moves.WILL_O_WISP]).moveset(Moves.SPLASH); game.override.enemyMoveset([Moves.WILL_O_WISP]).moveset(Moves.SPLASH);
await game.startBattle([Species.BLISSEY]); await game.classicMode.startBattle([Species.BLISSEY]);
const blissey = game.scene.getPlayerPokemon()!; const blissey = game.scene.getPlayerPokemon()!;
@ -76,7 +76,7 @@ describe("Abilities - Flash Fire", () => {
it("activated after being frozen", async () => { it("activated after being frozen", async () => {
game.override.enemyMoveset([Moves.EMBER]).moveset(Moves.SPLASH); game.override.enemyMoveset([Moves.EMBER]).moveset(Moves.SPLASH);
game.override.statusEffect(StatusEffect.FREEZE); game.override.statusEffect(StatusEffect.FREEZE);
await game.startBattle([Species.BLISSEY]); await game.classicMode.startBattle([Species.BLISSEY]);
const blissey = game.scene.getPlayerPokemon()!; const blissey = game.scene.getPlayerPokemon()!;
@ -88,7 +88,7 @@ describe("Abilities - Flash Fire", () => {
it("not passing with baton pass", async () => { it("not passing with baton pass", async () => {
game.override.enemyMoveset([Moves.EMBER]).moveset([Moves.BATON_PASS]); game.override.enemyMoveset([Moves.EMBER]).moveset([Moves.BATON_PASS]);
await game.startBattle([Species.BLISSEY, Species.CHANSEY]); await game.classicMode.startBattle([Species.BLISSEY, Species.CHANSEY]);
// ensure use baton pass after enemy moved // ensure use baton pass after enemy moved
game.move.select(Moves.BATON_PASS); game.move.select(Moves.BATON_PASS);
@ -105,7 +105,7 @@ describe("Abilities - Flash Fire", () => {
it("boosts Fire-type move when the ability is activated", async () => { it("boosts Fire-type move when the ability is activated", async () => {
game.override.enemyMoveset([Moves.FIRE_PLEDGE]).moveset([Moves.EMBER, Moves.SPLASH]); game.override.enemyMoveset([Moves.FIRE_PLEDGE]).moveset([Moves.EMBER, Moves.SPLASH]);
game.override.enemyAbility(Abilities.FLASH_FIRE).ability(Abilities.NONE); game.override.enemyAbility(Abilities.FLASH_FIRE).ability(Abilities.NONE);
await game.startBattle([Species.BLISSEY]); await game.classicMode.startBattle([Species.BLISSEY]);
const blissey = game.scene.getPlayerPokemon()!; const blissey = game.scene.getPlayerPokemon()!;
const initialHP = 1000; const initialHP = 1000;
blissey.hp = initialHP; blissey.hp = initialHP;
@ -128,21 +128,31 @@ describe("Abilities - Flash Fire", () => {
}, 20000); }, 20000);
it("still activates regardless of accuracy check", async () => { it("still activates regardless of accuracy check", async () => {
game.override.moveset(Moves.FLAMETHROWER); game.override.moveset(Moves.FIRE_PLEDGE).enemyMoveset(Moves.EMBER);
game.override.enemyMoveset(Moves.SPLASH); game.override.enemyAbility(Abilities.NONE).ability(Abilities.FLASH_FIRE);
game.override.enemySpecies(Species.MAGIKARP); game.override.enemySpecies(Species.BLISSEY);
game.override.enemyAbility(Abilities.FLASH_FIRE); await game.classicMode.startBattle([Species.RATTATA]);
await game.classicMode.startBattle(); const blissey = game.scene.getEnemyPokemon()!;
const initialHP = 1000;
blissey.hp = initialHP;
const enemyPokemon = game.scene.getEnemyPokemon()!; // first turn
game.move.select(Moves.FIRE_PLEDGE);
game.move.select(Moves.FLAMETHROWER); await game.setTurnOrder([BattlerIndex.PLAYER, BattlerIndex.ENEMY]);
await game.setTurnOrder([BattlerIndex.ENEMY, BattlerIndex.PLAYER]);
await game.phaseInterceptor.to("MoveEffectPhase"); await game.phaseInterceptor.to("MoveEffectPhase");
await game.move.forceMiss(); await game.move.forceMiss();
await game.phaseInterceptor.to("BerryPhase", false); await game.phaseInterceptor.to(TurnEndPhase);
expect(enemyPokemon.hp).toBe(enemyPokemon.getMaxHp()); const originalDmg = initialHP - blissey.hp;
expect(blissey.hp > 0);
blissey.hp = initialHP;
// second turn
game.move.select(Moves.FIRE_PLEDGE);
await game.phaseInterceptor.to(TurnEndPhase);
const flashFireDmg = initialHP - blissey.hp;
expect(flashFireDmg).toBeGreaterThan(originalDmg);
}, 20000); }, 20000);
}); });

View File

@ -181,6 +181,6 @@ describe("Abilities - Sap Sipper", () => {
await game.move.forceMiss(); await game.move.forceMiss();
await game.phaseInterceptor.to("BerryPhase", false); await game.phaseInterceptor.to("BerryPhase", false);
expect(enemyPokemon.hp).toBe(enemyPokemon.getMaxHp()); expect(enemyPokemon.getStatStage(Stat.ATK)).toBe(1);
}); });
}); });

View File

@ -63,6 +63,7 @@ describe("Abilities - Volt Absorb", () => {
const enemyPokemon = game.scene.getEnemyPokemon()!; const enemyPokemon = game.scene.getEnemyPokemon()!;
game.move.select(Moves.THUNDERBOLT); game.move.select(Moves.THUNDERBOLT);
enemyPokemon.hp = enemyPokemon.hp - 1;
await game.setTurnOrder([BattlerIndex.ENEMY, BattlerIndex.PLAYER]); await game.setTurnOrder([BattlerIndex.ENEMY, BattlerIndex.PLAYER]);
await game.phaseInterceptor.to("MoveEffectPhase"); await game.phaseInterceptor.to("MoveEffectPhase");