mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-09-23 23:13:42 +02:00
* Add new priority queues * Add dynamic queue manager * Add timing modifier and fix post speed ordering * Make `phaseQueue` private * Fix `gameManager.setTurnOrder` * Update `findPhase` to also check dynamic queues * Modify existing phase manager methods to check dynamic queues * Fix move order persisting through tests * Fix magic coat/bounce * Use append for magic coat/bounce * Remove `getSpeedOrder` from `TurnStartPhase`, fix references to `getCommandOrder` in tests * Fix round queuing last instead of next * Add quick draw application * Add quick claw activation * Fix turn order tracking * Add move header queue to fix ordering * Fix abilities activating immediately on summon * Fix `postsummonphases` being shuffled (need to handle speed ties differently here) * Update speed order function * Add `StaticSwitchSummonPhase` * Fix magic coat/bounce error from conflict resolution * Remove conditional queue * Fix dancer and baton pass tests * Automatically queue consecutive Pokémon phases as dynamic * Move turn end phases queuing back to `TurnStartPhase` * Fix `LearnMovePhase` * Remove `PrependSplice` * Move DQM to phase manager * Fix various phases being pushed instead of unshifted * Remove `StaticSwitchSummonPhase` * Ensure the top queue is always at length - 1 * Fix encounter `PostSummonPhase`s and Revival Blessing * Fix move headers * Remove implicit ordering from DQM * Fix `PostSummonPhase`s in encounters running too early * Fix `tryRemovePhase` usages * Add `MovePhase` after `MoveEndPhase` automatically * Implement an `inSpeedOrder` function * Merge fixes * Fix encounter rewards * Defer `FaintPhase`s where splice was used previously * Separate speed order utils to avoid circular imports * Temporarily disable lunar dance test * Simplify deferral * Remove move priority modifier * Fix TS errors in code files * Fix ts errors in tests * Fix more test files * Fix postsummon + checkswitch ability activations * Fix `removeAll` * Reposition `positionalTagPhase` * Re-add `startCurrentPhase` * Avoid overwriting `currentPhase` after `turnStart` * Delete `switchSummonPhasePriorityQueue` * Update `phase-manager.ts` * Remove uses of `isNullOrUndefined` * Rename deferral methods * Update docs and use `getPlayerField(true)` in turn start phase * Use `.getEnemyField(true)` * Update docs for post summon phase priority queue (psppq) * Update speed order utils * Remove null from `nextPhase` * Update move phase timing modifier docs * Remove mention of phases from base priority queue class * Remove and replace `applyInSpeedOrder` * Don't sort weather effect phases * Order priority queues before removing - Add some `readonly` and `public` modifiers - Remove unused `queuedPhases` field from `MoveEffectPhase` * Fix linting in `phase-manager.ts` * Remove unnecessary turn order modification in Rage Fist test --------- Co-authored-by: Bertie690 <136088738+Bertie690@users.noreply.github.com> Co-authored-by: Sirz Benjie <142067137+SirzBenjie@users.noreply.github.com> Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
202 lines
6.8 KiB
TypeScript
202 lines
6.8 KiB
TypeScript
import { allMoves } from "#data/data-lists";
|
|
import { AbilityId } from "#enums/ability-id";
|
|
import { BattleType } from "#enums/battle-type";
|
|
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 { GameManager } from "#test/test-utils/game-manager";
|
|
import Phaser from "phaser";
|
|
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
|
|
|
|
describe("Moves - Rage Fist", () => {
|
|
let phaserGame: Phaser.Game;
|
|
let game: GameManager;
|
|
let move: Move;
|
|
|
|
beforeAll(() => {
|
|
phaserGame = new Phaser.Game({
|
|
type: Phaser.HEADLESS,
|
|
});
|
|
});
|
|
|
|
afterEach(() => {
|
|
game.phaseInterceptor.restoreOg();
|
|
});
|
|
|
|
beforeEach(() => {
|
|
move = allMoves[MoveId.RAGE_FIST];
|
|
game = new GameManager(phaserGame);
|
|
game.override
|
|
.battleStyle("single")
|
|
.moveset([MoveId.RAGE_FIST, MoveId.SPLASH, MoveId.SUBSTITUTE, MoveId.TIDY_UP])
|
|
.startingLevel(100)
|
|
.enemyLevel(1)
|
|
.enemySpecies(SpeciesId.MAGIKARP)
|
|
.enemyAbility(AbilityId.BALL_FETCH)
|
|
.enemyMoveset(MoveId.DOUBLE_KICK);
|
|
|
|
vi.spyOn(move, "calculateBattlePower");
|
|
});
|
|
|
|
it("should gain power per hit taken", async () => {
|
|
await game.classicMode.startBattle([SpeciesId.FEEBAS]);
|
|
|
|
game.move.select(MoveId.RAGE_FIST);
|
|
await game.setTurnOrder([BattlerIndex.ENEMY, BattlerIndex.PLAYER]);
|
|
await game.phaseInterceptor.to("TurnEndPhase");
|
|
|
|
expect(move.calculateBattlePower).toHaveLastReturnedWith(150);
|
|
});
|
|
|
|
it("caps at 6 hits taken", async () => {
|
|
await game.classicMode.startBattle([SpeciesId.FEEBAS]);
|
|
|
|
// spam splash against magikarp hitting us 2 times per turn
|
|
game.move.select(MoveId.SPLASH);
|
|
await game.toNextTurn();
|
|
game.move.select(MoveId.SPLASH);
|
|
await game.toNextTurn();
|
|
game.move.select(MoveId.SPLASH);
|
|
await game.toNextTurn();
|
|
|
|
game.move.select(MoveId.RAGE_FIST);
|
|
await game.setTurnOrder([BattlerIndex.ENEMY, BattlerIndex.PLAYER]);
|
|
await game.phaseInterceptor.to("TurnEndPhase");
|
|
|
|
// hit 8 times, but nothing else
|
|
expect(game.field.getPlayerPokemon().battleData.hitCount).toBe(8);
|
|
expect(move.calculateBattlePower).toHaveLastReturnedWith(350);
|
|
});
|
|
|
|
it("should not count substitute hits or confusion damage", async () => {
|
|
game.override.enemySpecies(SpeciesId.SHUCKLE).enemyMoveset([MoveId.CONFUSE_RAY, MoveId.DOUBLE_KICK]);
|
|
|
|
await game.classicMode.startBattle([SpeciesId.REGIROCK]);
|
|
|
|
game.move.select(MoveId.SUBSTITUTE);
|
|
await game.move.selectEnemyMove(MoveId.DOUBLE_KICK);
|
|
await game.setTurnOrder([BattlerIndex.PLAYER, BattlerIndex.ENEMY]);
|
|
await game.toNextTurn();
|
|
|
|
// no increase due to substitute
|
|
expect(game.field.getPlayerPokemon().battleData.hitCount).toBe(0);
|
|
|
|
// remove substitute and get confused
|
|
game.move.select(MoveId.TIDY_UP);
|
|
await game.move.selectEnemyMove(MoveId.CONFUSE_RAY);
|
|
await game.setTurnOrder([BattlerIndex.PLAYER, BattlerIndex.ENEMY]);
|
|
await game.toNextTurn();
|
|
|
|
game.move.select(MoveId.RAGE_FIST);
|
|
await game.move.selectEnemyMove(MoveId.CONFUSE_RAY);
|
|
await game.setTurnOrder([BattlerIndex.PLAYER, BattlerIndex.ENEMY]);
|
|
await game.move.forceConfusionActivation(true);
|
|
await game.toNextTurn();
|
|
|
|
// didn't go up from hitting ourself
|
|
expect(game.field.getPlayerPokemon().battleData.hitCount).toBe(0);
|
|
});
|
|
|
|
it("should maintain hits recieved between wild waves", async () => {
|
|
await game.classicMode.startBattle([SpeciesId.FEEBAS]);
|
|
|
|
game.move.select(MoveId.RAGE_FIST);
|
|
await game.setTurnOrder([BattlerIndex.ENEMY, BattlerIndex.PLAYER]);
|
|
await game.toNextWave();
|
|
|
|
expect(game.field.getPlayerPokemon().battleData.hitCount).toBe(2);
|
|
|
|
game.move.select(MoveId.RAGE_FIST);
|
|
await game.setTurnOrder([BattlerIndex.ENEMY, BattlerIndex.PLAYER]);
|
|
await game.phaseInterceptor.to("TurnEndPhase");
|
|
|
|
expect(game.field.getPlayerPokemon().battleData.hitCount).toBe(4);
|
|
expect(move.calculateBattlePower).toHaveLastReturnedWith(250);
|
|
});
|
|
|
|
it("should reset hits recieved before trainer battles", async () => {
|
|
await game.classicMode.startBattle([SpeciesId.IRON_HANDS]);
|
|
|
|
const ironHands = game.field.getPlayerPokemon();
|
|
expect(ironHands).toBeDefined();
|
|
|
|
// beat up a magikarp
|
|
game.move.select(MoveId.RAGE_FIST);
|
|
await game.move.selectEnemyMove(MoveId.DOUBLE_KICK);
|
|
await game.setTurnOrder([BattlerIndex.ENEMY, BattlerIndex.PLAYER]);
|
|
await game.phaseInterceptor.to("TurnEndPhase");
|
|
|
|
expect(game.isVictory()).toBe(true);
|
|
expect(ironHands.battleData.hitCount).toBe(2);
|
|
expect(move.calculateBattlePower).toHaveLastReturnedWith(150);
|
|
|
|
game.override.battleType(BattleType.TRAINER);
|
|
await game.toNextWave();
|
|
|
|
expect(ironHands.battleData.hitCount).toBe(0);
|
|
});
|
|
|
|
it("should reset hits recieved before new biome", async () => {
|
|
game.override.enemySpecies(SpeciesId.MAGIKARP).startingWave(10);
|
|
|
|
await game.classicMode.startBattle([SpeciesId.MAGIKARP]);
|
|
|
|
game.move.select(MoveId.RAGE_FIST);
|
|
await game.setTurnOrder([BattlerIndex.ENEMY, BattlerIndex.PLAYER]);
|
|
await game.toNextTurn();
|
|
|
|
game.move.select(MoveId.RAGE_FIST);
|
|
await game.setTurnOrder([BattlerIndex.ENEMY, BattlerIndex.PLAYER]);
|
|
await game.phaseInterceptor.to("BerryPhase", false);
|
|
|
|
expect(move.calculateBattlePower).toHaveLastReturnedWith(150);
|
|
});
|
|
|
|
it("should not reset if switched out or on reload", async () => {
|
|
game.override.enemyMoveset(MoveId.TACKLE);
|
|
|
|
const getPartyHitCount = () =>
|
|
game.scene
|
|
.getPlayerParty()
|
|
.filter(p => !!p)
|
|
.map(m => m.battleData.hitCount);
|
|
|
|
await game.classicMode.startBattle([SpeciesId.CHARIZARD, SpeciesId.BLASTOISE]);
|
|
|
|
// Charizard hit
|
|
game.move.select(MoveId.SPLASH);
|
|
await game.toNextTurn();
|
|
expect(getPartyHitCount()).toEqual([1, 0]);
|
|
|
|
// blastoise switched in & hit
|
|
game.doSwitchPokemon(1);
|
|
await game.toNextTurn();
|
|
expect(getPartyHitCount()).toEqual([1, 1]);
|
|
|
|
// charizard switched in & hit
|
|
game.doSwitchPokemon(1);
|
|
await game.toNextTurn();
|
|
expect(getPartyHitCount()).toEqual([2, 1]);
|
|
|
|
// Charizard rage fist
|
|
game.move.select(MoveId.RAGE_FIST);
|
|
await game.phaseInterceptor.to("MoveEndPhase");
|
|
|
|
const charizard = game.field.getPlayerPokemon();
|
|
expect(charizard).toBeDefined();
|
|
expect(charizard.species.speciesId).toBe(SpeciesId.CHARIZARD);
|
|
expect(move.calculateBattlePower).toHaveLastReturnedWith(150);
|
|
|
|
// go to new wave, reload game and beat up another poor sap
|
|
await game.toNextWave();
|
|
|
|
await game.reload.reloadSession();
|
|
|
|
// outsped and oneshot means power rmains same as prior
|
|
game.move.select(MoveId.RAGE_FIST);
|
|
await game.phaseInterceptor.to("MoveEndPhase");
|
|
expect(move.calculateBattlePower).toHaveLastReturnedWith(150);
|
|
});
|
|
});
|