mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-06-21 09:02:47 +02:00
* Fixed issue with falsy issue within condition to get a stat for IV scanner * add fix setting code to prevent form/variant bug when default form/variant setting is wrong. in addition, that fix code include gender fix, so i revert old gender fix. update wrong log message. * [Hotfix] Fix Memory Mushroom not showing relearner moves (#3619) * Fix Memory Mushroom not showing relearner moves * Fix rollout test * Rewrite player faint logic in FaintPhase (#3614) * 867 runerigus sprite (#3629) cropped static frames, fixed cropped sprite set runerigus exp to use the shiny exp's animation verified all hex colors are unchanged - fixed ultra necrozma exp front variant swapped arrays. - xatu female eye color fix * [Bug] Preventing the MBH from being stolen in Endless (#3630) * Endless MBH Fix * add import * Revert "add import" This reverts commit814a4059c2
. * Revert "Endless MBH Fix" This reverts commit8eb4481301
. * removed newline --------- Co-authored-by: Frederico Santos <frederico.f.santos@tecnico.ulisboa.pt> Co-authored-by: frutescens <info@laptop> * [Bug] Fix type-hints for immunity (#3620) * enable mock containers to be found by name * enable mock text to be found by name * add test coverage for type-hints Only for "immunity" and "status moves" * fix wrong message key of curse(ghost type) (#3631) Co-authored-by: Frederico Santos <frederico.f.santos@tecnico.ulisboa.pt> * [Hotfix] Steal-able Mini Black Hole Pt 2 (#3632) * Still have no idea where Eternatus is given the MBH.... * typedocs --------- Co-authored-by: frutescens <info@laptop> * [Hotfix] Abilities that prevent ATK drops no longer stop other stat drops (#3624) * Abilities that prevent ATK drops no longer stop other stat drops * Apply suggestions from code review Co-authored-by: Mumble <kimjoanne@protonmail.com> * Add `isNullOrUndefined()` utility function --------- * Grip Claw now shows the proper pokemon nickname (#3634) Co-authored-by: frutescens <info@laptop> --------- Co-authored-by: Opaque02 <66582645+Opaque02@users.noreply.github.com> Co-authored-by: KimJeongSun <leo@atlaslabs.ai> Co-authored-by: Frederico Santos <frederico.f.santos@tecnico.ulisboa.pt> Co-authored-by: innerthunder <168692175+innerthunder@users.noreply.github.com> Co-authored-by: cam <lrlrliwoo@gmail.com> Co-authored-by: Mumble <kimjoanne@protonmail.com> Co-authored-by: frutescens <info@laptop> Co-authored-by: flx-sta <50131232+flx-sta@users.noreply.github.com> Co-authored-by: Enoch <enoch.jwsong@gmail.com> Co-authored-by: Mumble <171087428+frutescens@users.noreply.github.com>
83 lines
3.0 KiB
TypeScript
83 lines
3.0 KiB
TypeScript
import { allMoves } from "#app/data/move.js";
|
|
import { CommandPhase } from "#app/phases";
|
|
import GameManager from "#test/utils/gameManager";
|
|
import { getMovePosition } from "#test/utils/gameManagerUtils";
|
|
import { Abilities } from "#enums/abilities";
|
|
import { Moves } from "#enums/moves";
|
|
import { Species } from "#enums/species";
|
|
import Phaser from "phaser";
|
|
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
|
|
import { SPLASH_ONLY } from "#test/utils/testUtils";
|
|
|
|
describe("Moves - Rollout", () => {
|
|
let phaserGame: Phaser.Game;
|
|
let game: GameManager;
|
|
const TIMEOUT = 20 * 1000;
|
|
|
|
beforeAll(() => {
|
|
phaserGame = new Phaser.Game({
|
|
type: Phaser.HEADLESS,
|
|
});
|
|
});
|
|
|
|
afterEach(() => {
|
|
game.phaseInterceptor.restoreOg();
|
|
});
|
|
|
|
beforeEach(() => {
|
|
game = new GameManager(phaserGame);
|
|
game.override.disableCrits();
|
|
game.override.battleType("single");
|
|
game.override.starterSpecies(Species.RATTATA);
|
|
game.override.ability(Abilities.NONE);
|
|
game.override.enemySpecies(Species.BIDOOF);
|
|
game.override.enemyAbility(Abilities.NONE);
|
|
game.override.startingLevel(100);
|
|
game.override.enemyLevel(100);
|
|
game.override.enemyMoveset(SPLASH_ONLY);
|
|
});
|
|
|
|
it("should double it's dmg on sequential uses but reset after 5", async () => {
|
|
game.override.moveset([Moves.ROLLOUT]);
|
|
vi.spyOn(allMoves[Moves.ROLLOUT], "accuracy", "get").mockReturnValue(100); //always hit
|
|
|
|
const variance = 5;
|
|
const turns = 6;
|
|
const dmgHistory: number[] = [];
|
|
|
|
await game.startBattle();
|
|
|
|
const playerPkm = game.scene.getParty()[0];
|
|
vi.spyOn(playerPkm, "stats", "get").mockReturnValue([500000, 1, 1, 1, 1, 1]); // HP, ATK, DEF, SPATK, SPDEF, SPD
|
|
|
|
const enemyPkm = game.scene.getEnemyParty()[0];
|
|
vi.spyOn(enemyPkm, "stats", "get").mockReturnValue([500000, 1, 1, 1, 1, 1]); // HP, ATK, DEF, SPATK, SPDEF, SPD
|
|
vi.spyOn(enemyPkm, "getHeldItems").mockReturnValue([]); //no berries
|
|
|
|
enemyPkm.hp = enemyPkm.getMaxHp();
|
|
let previousHp = enemyPkm.hp;
|
|
|
|
for (let i = 0; i < turns; i++) {
|
|
game.doAttack(getMovePosition(game.scene, 0, Moves.ROLLOUT));
|
|
await game.phaseInterceptor.to(CommandPhase);
|
|
|
|
dmgHistory.push(previousHp - enemyPkm.hp);
|
|
previousHp = enemyPkm.hp;
|
|
}
|
|
|
|
const [turn1Dmg, turn2Dmg, turn3Dmg, turn4Dmg, turn5Dmg, turn6Dmg] = dmgHistory;
|
|
|
|
expect(turn2Dmg).toBeGreaterThanOrEqual(turn1Dmg * 2 - variance);
|
|
expect(turn2Dmg).toBeLessThanOrEqual(turn1Dmg * 2 + variance);
|
|
expect(turn3Dmg).toBeGreaterThanOrEqual(turn2Dmg * 2 - variance);
|
|
expect(turn3Dmg).toBeLessThanOrEqual(turn2Dmg * 2 + variance);
|
|
expect(turn4Dmg).toBeGreaterThanOrEqual(turn3Dmg * 2 - variance);
|
|
expect(turn4Dmg).toBeLessThanOrEqual(turn3Dmg * 2 + variance);
|
|
expect(turn5Dmg).toBeGreaterThanOrEqual(turn4Dmg * 2 - variance);
|
|
expect(turn5Dmg).toBeLessThanOrEqual(turn4Dmg * 2 + variance);
|
|
// reset
|
|
expect(turn6Dmg).toBeGreaterThanOrEqual(turn1Dmg - variance);
|
|
expect(turn6Dmg).toBeLessThanOrEqual(turn1Dmg + variance);
|
|
}, TIMEOUT);
|
|
});
|