From 9062925cf8539d1b703d61749e7850c2c18817c7 Mon Sep 17 00:00:00 2001 From: RedstonewolfX <108761527+RedstonewolfX@users.noreply.github.com> Date: Wed, 18 Sep 2024 16:02:36 -0400 Subject: [PATCH] Almost there!! --- src/test/daily_mode.test.ts | 42 ++++++++++++++++++++--- src/test/utils/helpers/overridesHelper.ts | 24 ++++++------- 2 files changed, 49 insertions(+), 17 deletions(-) diff --git a/src/test/daily_mode.test.ts b/src/test/daily_mode.test.ts index 24e8edfdd3e..dea204a2d2c 100644 --- a/src/test/daily_mode.test.ts +++ b/src/test/daily_mode.test.ts @@ -7,6 +7,7 @@ import { Biome } from "#app/enums/biome"; import { BattleEndPhase } from "#app/phases/battle-end-phase"; import { Mode } from "#app/ui/ui"; import ModifierSelectUiHandler from "#app/ui/modifier-select-ui-handler"; +import Overrides from "#app/overrides"; //const TIMEOUT = 20 * 1000; @@ -60,7 +61,7 @@ describe("Shop modifications", async () => { .startingWave(9) .startingBiome(Biome.ICE_CAVE) // Will lead to Snowy Forest with randomly generated weather .battleType("single") - .shinyLevel(true, 2) + .shinyLevel(true) .startingLevel(100) // Avoid levelling up .enemyLevel(1000) // Avoid opponent dying before game.doKillOpponents() .disableTrainerWaves() @@ -75,11 +76,27 @@ describe("Shop modifications", async () => { itemPoolChecks.clear(); }); + it("should not have Eviolite and Mini Black Hole available in Classic if not unlocked", async () => { + await game.classicMode.runToSummon(); + expect(itemPoolChecks.get("EVIOLITE")).toBeDefined(); + expect(itemPoolChecks.get("EVIOLITE")).toBeFalsy(); + expect(itemPoolChecks.get("MINI_BLACK_HOLE")).toBeDefined(); + expect(itemPoolChecks.get("MINI_BLACK_HOLE")).toBeFalsy(); + game.move.select(Moves.KOWTOW_CLEAVE); + await game.phaseInterceptor.to("DamagePhase"); + await game.doKillOpponents(); + await game.phaseInterceptor.to(BattleEndPhase); + game.onNextPrompt("SelectModifierPhase", Mode.MODIFIER_SELECT, () => { + expect(game.scene.ui.getHandler()).toBeInstanceOf(ModifierSelectUiHandler); + expect(itemPoolChecks.get("EVIOLITE")).toBeDefined(); + expect(itemPoolChecks.get("EVIOLITE")).toBeFalsy(); + expect(itemPoolChecks.get("MINI_BLACK_HOLE")).toBeDefined(); + expect(itemPoolChecks.get("MINI_BLACK_HOLE")).toBeFalsy(); + }); + }); + it("should have Eviolite and Mini Black Hole available in Daily", async () => { await game.dailyMode.runToSummon(); - const party = game.scene.getParty(); - expect(party[0]).toBeDefined(); - expect(getPartyLuckValue(party)).toBe(0); expect(itemPoolChecks.get("EVIOLITE")).toBeDefined(); expect(itemPoolChecks.get("EVIOLITE")).toBeFalsy(); expect(itemPoolChecks.get("MINI_BLACK_HOLE")).toBeDefined(); @@ -96,5 +113,22 @@ describe("Shop modifications", async () => { expect(itemPoolChecks.get("MINI_BLACK_HOLE")).toBeTruthy(); }); }); + + it("should apply luck in Classic Mode", async () => { + await game.classicMode.runToSummon(); + const party = game.scene.getParty(); + expect(Overrides.SHINY_OVERRIDE).toBeTruthy(); + expect(party[0]).toBeDefined(); + expect(party[0].getLuck()).toBeGreaterThan(0); + expect(getPartyLuckValue(party)).toBeGreaterThan(0); + }); + + it("should not apply luck in Daily Run", async () => { + await game.dailyMode.runToSummon(); + const party = game.scene.getParty(); + expect(party[0]).toBeDefined(); + expect(party[0].getLuck()).toBeGreaterThan(0); + expect(getPartyLuckValue(party)).toBe(0); + }); }); //*/ diff --git a/src/test/utils/helpers/overridesHelper.ts b/src/test/utils/helpers/overridesHelper.ts index 52b23d112bf..d2a0cbdb2d7 100644 --- a/src/test/utils/helpers/overridesHelper.ts +++ b/src/test/utils/helpers/overridesHelper.ts @@ -327,21 +327,19 @@ export class OverridesHelper extends GameManagerHelper { /** * Override player shininess * @param shininess Whether the player's Pokemon should be shiny. + */ + shinyLevel(shininess: boolean): this { + vi.spyOn(Overrides, "SHINY_OVERRIDE", "get").mockReturnValue(shininess); + this.log(`Set player Pokemon as ${shininess ? "" : "not "}shiny!`); + return this; + } + /** + * Override player shiny variant * @param variant The player's shiny variant. */ - shinyLevel(shininess?: boolean, variant?: Variant): this { - if (shininess !== undefined) { - vi.spyOn(Overrides, "SHINY_OVERRIDE", "get").mockReturnValue(shininess); - } - if (variant !== undefined) { - vi.spyOn(Overrides, "VARIANT_OVERRIDE", "get").mockReturnValue(variant); - } - if (shininess !== undefined) { - this.log(`Set player Pokemon as ${shininess ? "" : "not "}shiny!`); - } - if (variant !== undefined) { - this.log(`Set player Pokemon's shiny variant to ${variant}!`); - } + variantLevel(variant: Variant): this { + vi.spyOn(Overrides, "VARIANT_OVERRIDE", "get").mockReturnValue(variant); + this.log(`Set player Pokemon's shiny variant to ${variant}!`); return this; }