Almost there!!

This commit is contained in:
RedstonewolfX 2024-09-18 16:02:36 -04:00
parent 696a52fe15
commit 9062925cf8
2 changed files with 49 additions and 17 deletions

View File

@ -7,6 +7,7 @@ import { Biome } from "#app/enums/biome";
import { BattleEndPhase } from "#app/phases/battle-end-phase"; import { BattleEndPhase } from "#app/phases/battle-end-phase";
import { Mode } from "#app/ui/ui"; import { Mode } from "#app/ui/ui";
import ModifierSelectUiHandler from "#app/ui/modifier-select-ui-handler"; import ModifierSelectUiHandler from "#app/ui/modifier-select-ui-handler";
import Overrides from "#app/overrides";
//const TIMEOUT = 20 * 1000; //const TIMEOUT = 20 * 1000;
@ -60,7 +61,7 @@ describe("Shop modifications", async () => {
.startingWave(9) .startingWave(9)
.startingBiome(Biome.ICE_CAVE) // Will lead to Snowy Forest with randomly generated weather .startingBiome(Biome.ICE_CAVE) // Will lead to Snowy Forest with randomly generated weather
.battleType("single") .battleType("single")
.shinyLevel(true, 2) .shinyLevel(true)
.startingLevel(100) // Avoid levelling up .startingLevel(100) // Avoid levelling up
.enemyLevel(1000) // Avoid opponent dying before game.doKillOpponents() .enemyLevel(1000) // Avoid opponent dying before game.doKillOpponents()
.disableTrainerWaves() .disableTrainerWaves()
@ -75,11 +76,27 @@ describe("Shop modifications", async () => {
itemPoolChecks.clear(); 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 () => { it("should have Eviolite and Mini Black Hole available in Daily", async () => {
await game.dailyMode.runToSummon(); 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")).toBeDefined();
expect(itemPoolChecks.get("EVIOLITE")).toBeFalsy(); expect(itemPoolChecks.get("EVIOLITE")).toBeFalsy();
expect(itemPoolChecks.get("MINI_BLACK_HOLE")).toBeDefined(); expect(itemPoolChecks.get("MINI_BLACK_HOLE")).toBeDefined();
@ -96,5 +113,22 @@ describe("Shop modifications", async () => {
expect(itemPoolChecks.get("MINI_BLACK_HOLE")).toBeTruthy(); 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);
});
}); });
//*/ //*/

View File

@ -327,21 +327,19 @@ export class OverridesHelper extends GameManagerHelper {
/** /**
* Override player shininess * Override player shininess
* @param shininess Whether the player's Pokemon should be shiny. * @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. * @param variant The player's shiny variant.
*/ */
shinyLevel(shininess?: boolean, variant?: Variant): this { variantLevel(variant: Variant): this {
if (shininess !== undefined) { vi.spyOn(Overrides, "VARIANT_OVERRIDE", "get").mockReturnValue(variant);
vi.spyOn(Overrides, "SHINY_OVERRIDE", "get").mockReturnValue(shininess); this.log(`Set player Pokemon's shiny variant to ${variant}!`);
}
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}!`);
}
return this; return this;
} }