pokerogue/test/abilities/flash_fire.test.ts

159 lines
5.4 KiB
TypeScript
Raw Permalink Normal View History

import { BattlerIndex } from "#app/battle";
import { BattlerTagType } from "#app/enums/battler-tag-type";
import { Species } from "#app/enums/species";
import { MovePhase } from "#app/phases/move-phase";
import { TurnEndPhase } from "#app/phases/turn-end-phase";
import { Abilities } from "#enums/abilities";
import { Moves } from "#enums/moves";
import { StatusEffect } from "#enums/status-effect";
import GameManager from "#test/testUtils/gameManager";
import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
describe("Abilities - Flash Fire", () => {
let phaserGame: Phaser.Game;
let game: GameManager;
beforeAll(() => {
phaserGame = new Phaser.Game({
type: Phaser.HEADLESS,
});
});
afterEach(() => {
game.phaseInterceptor.restoreOg();
});
beforeEach(() => {
game = new GameManager(phaserGame);
game.override
.battleType("single")
.ability(Abilities.FLASH_FIRE)
.enemyAbility(Abilities.BALL_FETCH)
.startingLevel(20)
.enemyLevel(20)
.disableCrits();
});
it("immune to Fire-type moves", async () => {
2024-10-04 13:08:31 +08:00
game.override.enemyMoveset([ Moves.EMBER ]).moveset(Moves.SPLASH);
await game.classicMode.startBattle([ Species.BLISSEY ]);
const blissey = game.scene.getPlayerPokemon()!;
game.move.select(Moves.SPLASH);
await game.phaseInterceptor.to(TurnEndPhase);
expect(blissey.hp).toBe(blissey.getMaxHp());
}, 20000);
it("not activate if the Pokémon is protected from the Fire-type move", async () => {
2024-10-04 13:08:31 +08:00
game.override.enemyMoveset([ Moves.EMBER ]).moveset([ Moves.PROTECT ]);
await game.classicMode.startBattle([ Species.BLISSEY ]);
const blissey = game.scene.getPlayerPokemon()!;
game.move.select(Moves.PROTECT);
await game.phaseInterceptor.to(TurnEndPhase);
expect(blissey!.getTag(BattlerTagType.FIRE_BOOST)).toBeUndefined();
}, 20000);
it("activated by Will-O-Wisp", async () => {
2024-10-04 13:08:31 +08:00
game.override.enemyMoveset([ Moves.WILL_O_WISP ]).moveset(Moves.SPLASH);
await game.classicMode.startBattle([ Species.BLISSEY ]);
const blissey = game.scene.getPlayerPokemon()!;
game.move.select(Moves.SPLASH);
await game.move.forceHit();
await game.phaseInterceptor.to(MovePhase, false);
await game.move.forceHit();
await game.phaseInterceptor.to(TurnEndPhase);
expect(blissey!.getTag(BattlerTagType.FIRE_BOOST)).toBeDefined();
}, 20000);
it("activated after being frozen", async () => {
2024-10-04 13:08:31 +08:00
game.override.enemyMoveset([ Moves.EMBER ]).moveset(Moves.SPLASH);
game.override.statusEffect(StatusEffect.FREEZE);
2024-10-04 13:08:31 +08:00
await game.classicMode.startBattle([ Species.BLISSEY ]);
const blissey = game.scene.getPlayerPokemon()!;
game.move.select(Moves.SPLASH);
await game.phaseInterceptor.to(TurnEndPhase);
expect(blissey!.getTag(BattlerTagType.FIRE_BOOST)).toBeDefined();
}, 20000);
it("not passing with baton pass", async () => {
2024-10-04 13:08:31 +08:00
game.override.enemyMoveset([ Moves.EMBER ]).moveset([ Moves.BATON_PASS ]);
await game.classicMode.startBattle([ Species.BLISSEY, Species.CHANSEY ]);
// ensure use baton pass after enemy moved
game.move.select(Moves.BATON_PASS);
2024-10-04 13:08:31 +08:00
await game.setTurnOrder([ BattlerIndex.ENEMY, BattlerIndex.PLAYER ]);
game.doSelectPartyPokemon(1);
await game.phaseInterceptor.to(TurnEndPhase);
const chansey = game.scene.getPlayerPokemon()!;
expect(game.scene.getPlayerPokemon()!.species.speciesId).toBe(Species.CHANSEY);
expect(chansey!.getTag(BattlerTagType.FIRE_BOOST)).toBeUndefined();
}, 20000);
it("boosts Fire-type move when the ability is activated", async () => {
2024-10-04 13:08:31 +08:00
game.override.enemyMoveset([ Moves.FIRE_PLEDGE ]).moveset([ Moves.EMBER, Moves.SPLASH ]);
game.override.enemyAbility(Abilities.FLASH_FIRE).ability(Abilities.NONE);
2024-10-04 13:08:31 +08:00
await game.classicMode.startBattle([ Species.BLISSEY ]);
const blissey = game.scene.getPlayerPokemon()!;
const initialHP = 1000;
blissey.hp = initialHP;
// first turn
game.move.select(Moves.EMBER);
2024-10-04 13:08:31 +08:00
await game.setTurnOrder([ BattlerIndex.ENEMY, BattlerIndex.PLAYER ]);
await game.phaseInterceptor.to(TurnEndPhase);
const originalDmg = initialHP - blissey.hp;
expect(blissey.hp > 0);
blissey.hp = initialHP;
// second turn
game.move.select(Moves.SPLASH);
await game.phaseInterceptor.to(TurnEndPhase);
const flashFireDmg = initialHP - blissey.hp;
expect(flashFireDmg).toBeGreaterThan(originalDmg);
}, 20000);
it("still activates regardless of accuracy check", async () => {
game.override.moveset(Moves.FIRE_PLEDGE).enemyMoveset(Moves.EMBER);
game.override.enemyAbility(Abilities.NONE).ability(Abilities.FLASH_FIRE);
game.override.enemySpecies(Species.BLISSEY);
2024-10-04 13:08:31 +08:00
await game.classicMode.startBattle([ Species.RATTATA ]);
const blissey = game.scene.getEnemyPokemon()!;
const initialHP = 1000;
blissey.hp = initialHP;
// first turn
game.move.select(Moves.FIRE_PLEDGE);
2024-10-04 13:08:31 +08:00
await game.setTurnOrder([ BattlerIndex.PLAYER, BattlerIndex.ENEMY ]);
await game.phaseInterceptor.to("MoveEffectPhase");
await game.move.forceMiss();
await game.phaseInterceptor.to(TurnEndPhase);
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);
});