mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-09-23 06:53:27 +02:00
foo
This commit is contained in:
parent
bf37a8ca51
commit
dbaa702035
@ -1,4 +1,5 @@
|
||||
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 { GameManager } from "#test/test-utils/game-manager";
|
||||
@ -24,7 +25,7 @@ describe("Abilities - Stall", () => {
|
||||
game.override
|
||||
.battleStyle("single")
|
||||
.criticalHits(false)
|
||||
.enemySpecies(SpeciesId.REGIELEKI)
|
||||
.enemySpecies(SpeciesId.SHUCKLE)
|
||||
.enemyAbility(AbilityId.STALL)
|
||||
.enemyMoveset(MoveId.QUICK_ATTACK)
|
||||
.moveset([MoveId.QUICK_ATTACK, MoveId.TACKLE]);
|
||||
@ -42,7 +43,7 @@ describe("Abilities - Stall", () => {
|
||||
const player = game.field.getPlayerPokemon();
|
||||
|
||||
game.move.select(MoveId.QUICK_ATTACK);
|
||||
|
||||
game.setTurnOrder([BattlerIndex.ENEMY, BattlerIndex.PLAYER]);
|
||||
await game.phaseInterceptor.to("MoveEndPhase", false);
|
||||
// The player Pokemon (without Stall) goes first despite having lower speed than the opponent.
|
||||
// The opponent Pokemon (with Stall) goes last despite having higher speed than the player Pokemon.
|
||||
@ -55,6 +56,7 @@ describe("Abilities - Stall", () => {
|
||||
const player = game.field.getPlayerPokemon();
|
||||
|
||||
game.move.select(MoveId.TACKLE);
|
||||
game.setTurnOrder([BattlerIndex.ENEMY, BattlerIndex.PLAYER]);
|
||||
|
||||
await game.phaseInterceptor.to("MoveEndPhase", false);
|
||||
// The opponent Pokemon (with Stall) goes first because its move is still within a higher priority bracket than its opponent.
|
||||
@ -69,6 +71,7 @@ describe("Abilities - Stall", () => {
|
||||
const player = game.field.getPlayerPokemon();
|
||||
|
||||
game.move.select(MoveId.TACKLE);
|
||||
game.setTurnOrder([BattlerIndex.ENEMY, BattlerIndex.PLAYER]);
|
||||
|
||||
await game.phaseInterceptor.to("MoveEndPhase", false);
|
||||
|
||||
|
@ -165,9 +165,11 @@ describe("Moves - Delayed Attacks", () => {
|
||||
|
||||
it("should trigger multiple pending attacks in order of creation, even if that order changes later on", async () => {
|
||||
game.override.battleStyle("double");
|
||||
await game.classicMode.startBattle([SpeciesId.MAGIKARP, SpeciesId.FEEBAS]);
|
||||
await game.classicMode.startBattle([SpeciesId.ALOMOMOLA, SpeciesId.BLISSEY]);
|
||||
|
||||
const [alomomola, blissey] = game.scene.getPlayerField();
|
||||
const [alomomola, blissey, karp1, karp2] = game.scene.getField();
|
||||
vi.spyOn(karp1, "getNameToRender").mockReturnValue("Karp 1");
|
||||
vi.spyOn(karp2, "getNameToRender").mockReturnValue("Karp 2");
|
||||
|
||||
const oldOrder = game.field.getSpeedOrder(true);
|
||||
|
||||
|
@ -52,13 +52,11 @@ import type { ModifierSelectUiHandler } from "#ui/modifier-select-ui-handler";
|
||||
import type { PartyUiHandler } from "#ui/party-ui-handler";
|
||||
import type { StarterSelectUiHandler } from "#ui/starter-select-ui-handler";
|
||||
import type { TargetSelectUiHandler } from "#ui/target-select-ui-handler";
|
||||
import { sortInSpeedOrder } from "#utils/speed-order";
|
||||
import * as speedOrderUtils from "#utils/speed-order";
|
||||
import fs from "node:fs";
|
||||
import { AES, enc } from "crypto-js";
|
||||
import { expect, vi } from "vitest";
|
||||
|
||||
vi.mock(import("#utils/speed-order"), { spy: true });
|
||||
|
||||
/**
|
||||
* Class to manage the game state and transitions between phases.
|
||||
*/
|
||||
@ -557,8 +555,7 @@ export class GameManager {
|
||||
this.scene.getField(true).map(p => p.getBattlerIndex() as Exclude<BattlerIndex, BattlerIndex.ATTACKER>),
|
||||
);
|
||||
|
||||
expect(vi.isMockFunction(sortInSpeedOrder)).toBe(true);
|
||||
vi.mocked(sortInSpeedOrder).mockImplementation(list => {
|
||||
vi.spyOn(speedOrderUtils, "sortInSpeedOrder").mockImplementation(list => {
|
||||
list.sort((a, b) => {
|
||||
const aBattlerIndex = (a instanceof Pokemon ? a : a.getPokemon()).getBattlerIndex() as Exclude<
|
||||
BattlerIndex,
|
||||
|
@ -61,7 +61,7 @@ export class FieldHelper extends GameManagerHelper {
|
||||
* Helper function to return all on-field {@linkcode Pokemon} in speed order (fastest first).
|
||||
* @param indices - Whether to only return {@linkcode BattlerIndex}es instead of full Pokemon objects
|
||||
* (such as for comparison with other speed order-related mechanisms); default `false`
|
||||
* @returns An array containing the {@linkcode BattlerIndex}es of all on-field {@linkcode Pokemon} on the field in order of descending Speed. \
|
||||
* @returns An array containing the {@linkcode BattlerIndex}es of all on-field `Pokemon` on the field in order of **descending** Speed. \
|
||||
* Speed ties are returned in increasing order of index.
|
||||
*
|
||||
* @remarks
|
||||
|
Loading…
Reference in New Issue
Block a user