2024-08-22 06:49:33 -07:00
|
|
|
import { BattlerIndex } from "#app/battle";
|
|
|
|
import { TurnEndPhase } from "#app/phases/turn-end-phase";
|
2024-06-17 15:05:21 -07:00
|
|
|
import { Abilities } from "#enums/abilities";
|
|
|
|
import { Moves } from "#enums/moves";
|
|
|
|
import { Species } from "#enums/species";
|
2024-08-22 06:49:33 -07:00
|
|
|
import GameManager from "#test/utils/gameManager";
|
2024-07-25 16:10:38 -07:00
|
|
|
import Phaser from "phaser";
|
|
|
|
import { afterEach, beforeAll, beforeEach, describe, expect, test } from "vitest";
|
2024-06-17 15:05:21 -07:00
|
|
|
|
|
|
|
const TIMEOUT = 20 * 1000;
|
|
|
|
|
|
|
|
describe("Moves - Rage Powder", () => {
|
|
|
|
let phaserGame: Phaser.Game;
|
|
|
|
let game: GameManager;
|
|
|
|
|
|
|
|
beforeAll(() => {
|
|
|
|
phaserGame = new Phaser.Game({
|
|
|
|
type: Phaser.HEADLESS,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
afterEach(() => {
|
|
|
|
game.phaseInterceptor.restoreOg();
|
|
|
|
});
|
|
|
|
|
|
|
|
beforeEach(() => {
|
|
|
|
game = new GameManager(phaserGame);
|
2024-07-25 14:48:48 -07:00
|
|
|
game.override.battleType("double");
|
2024-07-25 15:24:07 -07:00
|
|
|
game.override.starterSpecies(Species.AMOONGUSS);
|
2024-07-25 14:57:47 -07:00
|
|
|
game.override.enemySpecies(Species.SNORLAX);
|
2024-07-25 15:29:19 -07:00
|
|
|
game.override.startingLevel(100);
|
2024-07-25 16:10:38 -07:00
|
|
|
game.override.enemyLevel(100);
|
2024-08-22 06:49:33 -07:00
|
|
|
game.override.moveset([Moves.FOLLOW_ME, Moves.RAGE_POWDER, Moves.SPOTLIGHT, Moves.QUICK_ATTACK]);
|
|
|
|
game.override.enemyMoveset([Moves.TACKLE, Moves.TACKLE, Moves.TACKLE, Moves.TACKLE]);
|
2024-06-17 15:05:21 -07:00
|
|
|
});
|
|
|
|
|
|
|
|
test(
|
|
|
|
"move effect should be bypassed by Grass type",
|
|
|
|
async () => {
|
2024-08-22 06:49:33 -07:00
|
|
|
game.override.enemyMoveset([Moves.RAGE_POWDER, Moves.RAGE_POWDER, Moves.RAGE_POWDER, Moves.RAGE_POWDER]);
|
2024-06-17 15:05:21 -07:00
|
|
|
|
2024-08-22 06:49:33 -07:00
|
|
|
await game.startBattle([Species.AMOONGUSS, Species.VENUSAUR]);
|
2024-06-17 15:05:21 -07:00
|
|
|
|
|
|
|
const enemyPokemon = game.scene.getEnemyField();
|
|
|
|
|
2024-06-20 12:02:17 -07:00
|
|
|
const enemyStartingHp = enemyPokemon.map(p => p.hp);
|
2024-06-17 15:05:21 -07:00
|
|
|
|
2024-08-22 06:49:33 -07:00
|
|
|
game.move.select(Moves.QUICK_ATTACK, 0, BattlerIndex.ENEMY);
|
|
|
|
game.move.select(Moves.QUICK_ATTACK, 1, BattlerIndex.ENEMY_2);
|
2024-06-20 02:11:29 -07:00
|
|
|
await game.phaseInterceptor.to(TurnEndPhase, false);
|
2024-06-17 15:05:21 -07:00
|
|
|
|
|
|
|
// If redirection was bypassed, both enemies should be damaged
|
2024-06-20 12:02:17 -07:00
|
|
|
expect(enemyPokemon[0].hp).toBeLessThan(enemyStartingHp[0]);
|
|
|
|
expect(enemyPokemon[1].hp).toBeLessThan(enemyStartingHp[1]);
|
2024-06-17 15:05:21 -07:00
|
|
|
}, TIMEOUT
|
|
|
|
);
|
|
|
|
|
|
|
|
test(
|
|
|
|
"move effect should be bypassed by Overcoat",
|
|
|
|
async () => {
|
2024-07-25 15:35:20 -07:00
|
|
|
game.override.ability(Abilities.OVERCOAT);
|
2024-08-22 06:49:33 -07:00
|
|
|
game.override.enemyMoveset([Moves.RAGE_POWDER, Moves.RAGE_POWDER, Moves.RAGE_POWDER, Moves.RAGE_POWDER]);
|
2024-06-17 15:05:21 -07:00
|
|
|
|
|
|
|
// Test with two non-Grass type player Pokemon
|
2024-08-22 06:49:33 -07:00
|
|
|
await game.startBattle([Species.BLASTOISE, Species.CHARIZARD]);
|
2024-06-17 15:05:21 -07:00
|
|
|
|
|
|
|
const enemyPokemon = game.scene.getEnemyField();
|
|
|
|
|
2024-06-20 12:02:17 -07:00
|
|
|
const enemyStartingHp = enemyPokemon.map(p => p.hp);
|
2024-06-17 15:05:21 -07:00
|
|
|
|
2024-08-22 06:49:33 -07:00
|
|
|
game.move.select(Moves.QUICK_ATTACK, 0, BattlerIndex.ENEMY);
|
|
|
|
game.move.select(Moves.QUICK_ATTACK, 1, BattlerIndex.ENEMY_2);
|
2024-06-20 02:11:29 -07:00
|
|
|
await game.phaseInterceptor.to(TurnEndPhase, false);
|
2024-06-17 15:05:21 -07:00
|
|
|
|
|
|
|
// If redirection was bypassed, both enemies should be damaged
|
2024-06-20 12:02:17 -07:00
|
|
|
expect(enemyPokemon[0].hp).toBeLessThan(enemyStartingHp[0]);
|
|
|
|
expect(enemyPokemon[1].hp).toBeLessThan(enemyStartingHp[1]);
|
2024-06-17 15:05:21 -07:00
|
|
|
}, TIMEOUT
|
|
|
|
);
|
|
|
|
});
|