Revert "Hopefully fixed tests since we use Phaser.Math.RND.frac"

This reverts commit 0eac761e72.
This commit is contained in:
Bertie690 2025-05-04 09:43:56 -04:00
parent 0eac761e72
commit 239805ac23
5 changed files with 14 additions and 10 deletions

View File

@ -160,7 +160,7 @@ describe("Abilities - Harvest", () => {
// ate 1 berry and recovered it
expect(regieleki.battleData.berriesEaten).toEqual([]);
expectBerriesContaining({ name: "BERRY", type: BerryType.PETAYA, count: 1 });
expect(getPlayerBerries()).toEqual([expect.objectContaining({ berryType: BerryType.PETAYA, stackCount: 1 })]);
expect(game.scene.getPlayerPokemon()?.getStatStage(Stat.SPATK)).toBe(1);
// heal up so harvest doesn't proc and kill enemy

View File

@ -9,7 +9,6 @@ import { StatusEffect } from "#enums/status-effect";
import GameManager from "#test/testUtils/gameManager";
import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
import { randSeedFloat } from "#app/utils/common";
describe("Double Battles", () => {
const DOUBLE_CHANCE = 8; // Normal chance of double battle is 1/8
@ -63,7 +62,9 @@ describe("Double Battles", () => {
let doubleCount = 0;
let singleCount = 0;
vi.fn(randSeedFloat).mockImplementation(() => rngSweepProgress);
vi.spyOn(Phaser.Math.RND, "realInRange").mockImplementation((min: number, max: number) => {
return rngSweepProgress * (max - min) + min;
});
game.override
.enemyMoveset(Moves.SPLASH)

View File

@ -1,7 +1,6 @@
import { Egg } from "#app/data/egg";
import { EggSourceType } from "#app/enums/egg-source-types";
import { EggTier } from "#app/enums/egg-type";
import { randSeedFloat } from "#app/utils/common";
import { Species } from "#enums/species";
import GameManager from "#test/testUtils/gameManager";
import Phaser from "phaser";
@ -10,7 +9,7 @@ import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vite
describe("Manaphy Eggs", () => {
let phaserGame: Phaser.Game;
let game: GameManager;
const EGG_HATCH_COUNT = 48;
const EGG_HATCH_COUNT: number = 48;
let rngSweepProgress = 0;
beforeAll(() => {
@ -34,7 +33,9 @@ describe("Manaphy Eggs", () => {
* possible RNG outcomes. This will let us quickly and consistently find
* the probability of each RNG outcome.
*/
vi.fn(randSeedFloat).mockImplementation(() => rngSweepProgress);
vi.spyOn(Phaser.Math.RND, "realInRange").mockImplementation((min: number, max: number) => {
return rngSweepProgress * (max - min) + min;
});
});
it("should have correct Manaphy rates and Rare Egg Move rates, from the egg gacha", () => {

View File

@ -20,7 +20,6 @@ import {
} from "#app/data/mystery-encounters/encounters/safari-zone-encounter";
import * as EncounterPhaseUtils from "#app/data/mystery-encounters/utils/encounter-phase-utils";
import { NON_LEGEND_PARADOX_POKEMON } from "#app/data/balance/special-species-groups";
import { randSeedFloat } from "#app/utils/common";
const namespace = "mysteryEncounters/safariZone";
const defaultParty = [Species.LAPRAS, Species.GENGAR, Species.ABRA];
@ -135,7 +134,9 @@ describe("Safari Zone - Mystery Encounter", () => {
const NUM_ROLLS = 2000; // As long as this is greater than total number of species, this should cover all possible RNG rolls
let rngSweepProgress = 0; // Will simulate full range of RNG rolls by steadily increasing from 0 to 1
vi.fn(randSeedFloat).mockImplementation(() => rngSweepProgress);
vi.spyOn(Phaser.Math.RND, "realInRange").mockImplementation((min: number, max: number) => {
return rngSweepProgress * (max - min) + min;
});
vi.spyOn(Phaser.Math.RND, "shuffle").mockImplementation((arr: any[]) => arr);
for (let i = 0; i < NUM_ROLLS; i++) {

View File

@ -21,7 +21,6 @@ import { MysteryEncounterTier } from "#enums/mystery-encounter-tier";
import { initSceneWithoutEncounterPhase } from "#test/testUtils/gameManagerUtils";
import { MysteryEncounterPhase } from "#app/phases/mystery-encounter-phases";
import { NON_LEGEND_PARADOX_POKEMON } from "#app/data/balance/special-species-groups";
import { randSeedFloat } from "#app/utils/common";
const namespace = "mysteryEncounters/thePokemonSalesman";
const defaultParty = [Species.LAPRAS, Species.GENGAR, Species.ABRA];
@ -196,7 +195,9 @@ describe("The Pokemon Salesman - Mystery Encounter", () => {
const NUM_ROLLS = 2000; // As long as this is greater than total number of species, this should cover all possible RNG rolls
let rngSweepProgress = 0; // Will simulate full range of RNG rolls by steadily increasing from 0 to 1
vi.fn(randSeedFloat).mockImplementation(() => rngSweepProgress);
vi.spyOn(Phaser.Math.RND, "realInRange").mockImplementation((min: number, max: number) => {
return rngSweepProgress * (max - min) + min;
});
vi.spyOn(Phaser.Math.RND, "shuffle").mockImplementation((arr: any[]) => arr);
for (let i = 0; i < NUM_ROLLS; i++) {