mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-03-06 09:58:10 +00:00
* Create Getters, Setters, and Types * Work on `pokemon.ts` * Adjust Types, Refactor `White Herb` Modifier * Migrate `TempBattleStat` Usage * Refactor `PokemonBaseStatModifier` Slightly * Remove `BattleStat`, Use "Stat Stages" & New Names * Address Phase `integers` * Finalize `BattleStat` Removal * Address Minor Manual NITs * Apply Own Review Suggestions * Fix Syntax Error * Add Docs * Overhaul X Items * Implement Guard and Power Split with Unit Tests * Add Several Unit Tests and Fixes * Implement Speed Swap with Unit Tests * Fix Keys in Summary Menu * Fix Starf Berry Raising EVA and ACC * Fix Contrary & Simple, Verify with Unit Tests * Implement Power & Guard Swap with Unit Tests * Add Move Effect Message to Speed Swap * Add Move Effect Message to Power & Guard Split * Add Localization Entries * Adjust Last X Item Unit Test * Overhaul X Items Unit Tests * Finish Missing Docs * Revamp Crit-Based Unit Tests & Dire Hit * Address Initial NITs * Apply NIT Batch Co-authored-by: flx-sta <50131232+flx-sta@users.noreply.github.com> * Fix Moody Test * Address Multiple Messages for `ProtectStatAbAttr` * Change `ignoreOverride` to `bypassSummonData` * Adjust Italian Localization Co-authored-by: Niccolò <123510358+NicusPulcis@users.noreply.github.com> * Fix Moody --------- Co-authored-by: flx-sta <50131232+flx-sta@users.noreply.github.com> Co-authored-by: Niccolò <123510358+NicusPulcis@users.noreply.github.com>
83 lines
2.7 KiB
TypeScript
83 lines
2.7 KiB
TypeScript
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
|
|
import Phaser from "phaser";
|
|
import GameManager from "#app/test/utils/gameManager";
|
|
import { Species } from "#enums/species";
|
|
import { TurnEndPhase } from "#app/phases/turn-end-phase";
|
|
import { Moves } from "#enums/moves";
|
|
import { Stat } from "#enums/stat";
|
|
import { Abilities } from "#enums/abilities";
|
|
import { SPLASH_ONLY } from "../utils/testUtils";
|
|
|
|
describe("Moves - Power Split", () => {
|
|
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")
|
|
.enemyAbility(Abilities.NONE)
|
|
.enemySpecies(Species.MEW)
|
|
.enemyLevel(200)
|
|
.moveset([ Moves.POWER_SPLIT ])
|
|
.ability(Abilities.NONE);
|
|
});
|
|
|
|
it("should average the user's ATK and SPATK stats with those of the target", async () => {
|
|
game.override.enemyMoveset(SPLASH_ONLY);
|
|
await game.startBattle([
|
|
Species.INDEEDEE
|
|
]);
|
|
|
|
const player = game.scene.getPlayerPokemon()!;
|
|
const enemy = game.scene.getEnemyPokemon()!;
|
|
|
|
const avgAtk = Math.floor((player.getStat(Stat.ATK, false) + enemy.getStat(Stat.ATK, false)) / 2);
|
|
const avgSpAtk = Math.floor((player.getStat(Stat.SPATK, false) + enemy.getStat(Stat.SPATK, false)) / 2);
|
|
|
|
game.move.select(Moves.POWER_SPLIT);
|
|
await game.phaseInterceptor.to(TurnEndPhase);
|
|
|
|
expect(player.getStat(Stat.ATK, false)).toBe(avgAtk);
|
|
expect(enemy.getStat(Stat.ATK, false)).toBe(avgAtk);
|
|
|
|
expect(player.getStat(Stat.SPATK, false)).toBe(avgSpAtk);
|
|
expect(enemy.getStat(Stat.SPATK, false)).toBe(avgSpAtk);
|
|
}, 20000);
|
|
|
|
it("should be idempotent", async () => {
|
|
game.override.enemyMoveset(new Array(4).fill(Moves.POWER_SPLIT));
|
|
await game.startBattle([
|
|
Species.INDEEDEE
|
|
]);
|
|
|
|
const player = game.scene.getPlayerPokemon()!;
|
|
const enemy = game.scene.getEnemyPokemon()!;
|
|
|
|
const avgAtk = Math.floor((player.getStat(Stat.ATK, false) + enemy.getStat(Stat.ATK, false)) / 2);
|
|
const avgSpAtk = Math.floor((player.getStat(Stat.SPATK, false) + enemy.getStat(Stat.SPATK, false)) / 2);
|
|
|
|
game.move.select(Moves.POWER_SPLIT);
|
|
await game.phaseInterceptor.to(TurnEndPhase);
|
|
|
|
game.move.select(Moves.POWER_SPLIT);
|
|
await game.phaseInterceptor.to(TurnEndPhase);
|
|
|
|
expect(player.getStat(Stat.ATK, false)).toBe(avgAtk);
|
|
expect(enemy.getStat(Stat.ATK, false)).toBe(avgAtk);
|
|
|
|
expect(player.getStat(Stat.SPATK, false)).toBe(avgSpAtk);
|
|
expect(enemy.getStat(Stat.SPATK, false)).toBe(avgSpAtk);
|
|
}, 20000);
|
|
});
|