pokerogue/test/abilities/supreme-overlord.test.ts
Sirz Benjie 51d4c33de0
[Misc] Standardize-file-names (#6137)
* Standardize filenames to kebab-case

Co-authored-by: pymilkmaiden <cassiopeiamahler56@gmail.com>

* Move script outside of public folder

* Move update_exp_sprites to scripts

* Add ls-lint to lint file and directory names

* Update lefthook.yml to skip merge / rebase on all pre-commit commands

---------

Co-authored-by: pymilkmaiden <cassiopeiamahler56@gmail.com>
2025-07-24 16:38:31 -04:00

170 lines
5.9 KiB
TypeScript

import { allMoves } from "#data/data-lists";
import { AbilityId } from "#enums/ability-id";
import { BattlerIndex } from "#enums/battler-index";
import { MoveId } from "#enums/move-id";
import { SpeciesId } from "#enums/species-id";
import type { Move } from "#moves/move";
import { MoveEffectPhase } from "#phases/move-effect-phase";
import { GameManager } from "#test/test-utils/game-manager";
import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
describe("Abilities - Supreme Overlord", () => {
let phaserGame: Phaser.Game;
let game: GameManager;
let move: Move;
let basePower: number;
beforeAll(() => {
phaserGame = new Phaser.Game({
type: Phaser.HEADLESS,
});
});
afterEach(() => {
game.phaseInterceptor.restoreOg();
});
beforeEach(() => {
move = allMoves[MoveId.TACKLE];
basePower = move.power;
game = new GameManager(phaserGame);
game.override
.battleStyle("single")
.enemySpecies(SpeciesId.MAGIKARP)
.enemyLevel(100)
.startingLevel(1)
.enemyAbility(AbilityId.BALL_FETCH)
.ability(AbilityId.SUPREME_OVERLORD)
.enemyMoveset([MoveId.SPLASH])
.moveset([MoveId.TACKLE, MoveId.EXPLOSION, MoveId.LUNAR_DANCE]);
vi.spyOn(move, "calculateBattlePower");
});
it("should increase Power by 20% if 2 Pokemon are fainted in the party", async () => {
await game.classicMode.startBattle([SpeciesId.BULBASAUR, SpeciesId.CHARMANDER, SpeciesId.SQUIRTLE]);
game.move.select(MoveId.EXPLOSION);
await game.setTurnOrder([BattlerIndex.PLAYER, BattlerIndex.ENEMY]);
game.doSelectPartyPokemon(1);
await game.toNextTurn();
game.move.select(MoveId.EXPLOSION);
await game.setTurnOrder([BattlerIndex.PLAYER, BattlerIndex.ENEMY]);
game.doSelectPartyPokemon(2);
await game.toNextTurn();
game.move.select(MoveId.TACKLE);
await game.setTurnOrder([BattlerIndex.PLAYER, BattlerIndex.ENEMY]);
await game.phaseInterceptor.to(MoveEffectPhase);
expect(move.calculateBattlePower).toHaveReturnedWith(basePower * 1.2);
});
it("should increase Power by 30% if an ally fainted twice and another one once", async () => {
await game.classicMode.startBattle([SpeciesId.BULBASAUR, SpeciesId.CHARMANDER, SpeciesId.SQUIRTLE]);
/**
* Bulbasur faints once
*/
game.move.select(MoveId.EXPLOSION);
await game.setTurnOrder([BattlerIndex.PLAYER, BattlerIndex.ENEMY]);
game.doSelectPartyPokemon(1);
await game.toNextTurn();
/**
* Charmander faints once
*/
game.doRevivePokemon(1);
game.move.select(MoveId.EXPLOSION);
await game.setTurnOrder([BattlerIndex.PLAYER, BattlerIndex.ENEMY]);
game.doSelectPartyPokemon(1);
await game.toNextTurn();
/**
* Bulbasur faints twice
*/
game.move.select(MoveId.EXPLOSION);
await game.setTurnOrder([BattlerIndex.PLAYER, BattlerIndex.ENEMY]);
game.doSelectPartyPokemon(2);
await game.toNextTurn();
game.move.select(MoveId.TACKLE);
await game.setTurnOrder([BattlerIndex.PLAYER, BattlerIndex.ENEMY]);
await game.phaseInterceptor.to(MoveEffectPhase);
expect(move.calculateBattlePower).toHaveReturnedWith(basePower * 1.3);
});
it("should maintain its power during next battle if it is within the same arena encounter", async () => {
game.override.enemySpecies(SpeciesId.MAGIKARP).startingWave(1).enemyLevel(1).startingLevel(100);
await game.classicMode.startBattle([SpeciesId.BULBASAUR, SpeciesId.CHARMANDER, SpeciesId.SQUIRTLE]);
/**
* The first Pokemon faints and another Pokemon in the party is selected.
*/
game.move.select(MoveId.LUNAR_DANCE);
await game.setTurnOrder([BattlerIndex.ENEMY, BattlerIndex.PLAYER]);
game.doSelectPartyPokemon(1);
await game.toNextTurn();
/**
* Enemy Pokemon faints and new wave is entered.
*/
game.move.select(MoveId.TACKLE);
await game.setTurnOrder([BattlerIndex.ENEMY, BattlerIndex.PLAYER]);
await game.toNextWave();
game.move.select(MoveId.TACKLE);
await game.setTurnOrder([BattlerIndex.PLAYER, BattlerIndex.ENEMY]);
await game.phaseInterceptor.to("TurnEndPhase");
expect(move.calculateBattlePower).toHaveLastReturnedWith(basePower * 1.1);
});
it("should reset playerFaints count if we enter new trainer battle", async () => {
game.override.enemySpecies(SpeciesId.MAGIKARP).startingWave(4).enemyLevel(1).startingLevel(100);
await game.classicMode.startBattle([SpeciesId.BULBASAUR, SpeciesId.CHARMANDER, SpeciesId.SQUIRTLE]);
game.move.select(MoveId.LUNAR_DANCE);
await game.setTurnOrder([BattlerIndex.ENEMY, BattlerIndex.PLAYER]);
game.doSelectPartyPokemon(1);
await game.toNextTurn();
game.move.select(MoveId.TACKLE);
await game.setTurnOrder([BattlerIndex.ENEMY, BattlerIndex.PLAYER]);
await game.toNextWave();
game.move.select(MoveId.TACKLE);
await game.setTurnOrder([BattlerIndex.PLAYER, BattlerIndex.ENEMY]);
await game.phaseInterceptor.to("BerryPhase", false);
expect(move.calculateBattlePower).toHaveLastReturnedWith(basePower);
});
it("should reset playerFaints count if we enter new biome", async () => {
game.override.enemySpecies(SpeciesId.MAGIKARP).startingWave(10).enemyLevel(1).startingLevel(100);
await game.classicMode.startBattle([SpeciesId.BULBASAUR, SpeciesId.CHARMANDER, SpeciesId.SQUIRTLE]);
game.move.select(MoveId.LUNAR_DANCE);
await game.setTurnOrder([BattlerIndex.ENEMY, BattlerIndex.PLAYER]);
game.doSelectPartyPokemon(1);
await game.toNextTurn();
game.move.select(MoveId.TACKLE);
await game.setTurnOrder([BattlerIndex.ENEMY, BattlerIndex.PLAYER]);
await game.toNextWave();
game.move.select(MoveId.TACKLE);
await game.setTurnOrder([BattlerIndex.PLAYER, BattlerIndex.ENEMY]);
await game.phaseInterceptor.to("BerryPhase", false);
expect(move.calculateBattlePower).toHaveLastReturnedWith(basePower);
});
});