update unit tests

This commit is contained in:
ImperialSympathizer 2024-08-08 17:38:41 -04:00
parent ba637e80e2
commit de928e5d7e
8 changed files with 19 additions and 3 deletions

View File

@ -2760,7 +2760,7 @@ export default class BattleScene extends SceneBase {
const previousEncounter = this.mysteryEncounterData.encounteredEvents?.length > 0 ? this.mysteryEncounterData.encounteredEvents[this.mysteryEncounterData.encounteredEvents.length - 1][0] : null;
const biomeMysteryEncounters = mysteryEncountersByBiome.get(this.arena.biomeType) ?? [];
// If no valid encounters exist at tier, checks next tier down, continuing until there are some encounters available
while (availableEncounters.length === 0 && tier >= 0) {
while (availableEncounters.length === 0 && tier !== null) {
availableEncounters = biomeMysteryEncounters
.filter((encounterType) => {
const encounterCandidate = allMysteryEncounters[encounterType];
@ -2784,7 +2784,16 @@ export default class BattleScene extends SceneBase {
return true;
})
.map((m) => (allMysteryEncounters[m]));
tier--;
// Decrement tier
if (tier === MysteryEncounterTier.ROGUE) {
tier = MysteryEncounterTier.ULTRA;
} else if (tier === MysteryEncounterTier.ULTRA) {
tier = MysteryEncounterTier.GREAT;
} else if (tier === MysteryEncounterTier.GREAT) {
tier = MysteryEncounterTier.COMMON;
} else {
tier = null; // Ends loop
}
}
// If absolutely no encounters are available, spawn 0th encounter

View File

@ -81,6 +81,7 @@ describe("Absolute Avarice - Mystery Encounter", () => {
});
it("should not spawn outside of proper biomes", async () => {
game.override.mysteryEncounterTier(MysteryEncounterTier.GREAT);
game.override.startingBiome(Biome.VOLCANO);
await game.runToMysteryEncounter();
@ -96,6 +97,7 @@ describe("Absolute Avarice - Mystery Encounter", () => {
});
it("should spawn if player has enough berries", async () => {
game.override.mysteryEncounterTier(MysteryEncounterTier.GREAT);
game.override.starterHeldItems([{name: "BERRY", count: 2, type: BerryType.SITRUS}, {name: "BERRY", count: 3, type: BerryType.GANLON}]);
await game.runToMysteryEncounter();

View File

@ -72,6 +72,7 @@ describe("An Offer You Can't Refuse - Mystery Encounter", () => {
});
it("should not spawn outside of HUMAN_TRANSITABLE_BIOMES", async () => {
game.override.mysteryEncounterTier(MysteryEncounterTier.GREAT);
game.override.startingBiome(Biome.VOLCANO);
await game.runToMysteryEncounter();

View File

@ -72,6 +72,7 @@ describe("Department Store Sale - Mystery Encounter", () => {
});
it("should not spawn outside of CIVILIZATION_ENCOUNTER_BIOMES", async () => {
game.override.mysteryEncounterTier(MysteryEncounterTier.COMMON);
game.override.startingBiome(Biome.VOLCANO);
await game.runToMysteryEncounter();

View File

@ -66,6 +66,7 @@ describe("Lost at Sea - Mystery Encounter", () => {
});
it("should not spawn outside of sea biome", async () => {
game.override.mysteryEncounterTier(MysteryEncounterTier.COMMON);
game.override.startingBiome(Biome.MOUNTAIN);
await game.runToMysteryEncounter();

View File

@ -71,6 +71,7 @@ describe("Mysterious Challengers - Mystery Encounter", () => {
});
it("should not spawn outside of HUMAN_TRANSITABLE_BIOMES", async () => {
game.override.mysteryEncounterTier(MysteryEncounterTier.GREAT);
game.override.startingBiome(Biome.VOLCANO);
await game.runToMysteryEncounter();
@ -86,7 +87,6 @@ describe("Mysterious Challengers - Mystery Encounter", () => {
});
it("should not run above wave 179", async () => {
game.override.mysteryEncounterTier(MysteryEncounterTier.GREAT);
game.override.startingWave(181);
await game.runToMysteryEncounter();

View File

@ -69,6 +69,7 @@ describe("The Pokemon Salesman - Mystery Encounter", () => {
});
it("should not spawn outside of HUMAN_TRANSITABLE_BIOMES", async () => {
game.override.mysteryEncounterTier(MysteryEncounterTier.ULTRA);
game.override.startingBiome(Biome.VOLCANO);
await game.runToMysteryEncounter();

View File

@ -75,6 +75,7 @@ describe("The Strong Stuff - Mystery Encounter", () => {
});
it("should not spawn outside of CAVE biome", async () => {
game.override.mysteryEncounterTier(MysteryEncounterTier.COMMON);
game.override.startingBiome(Biome.MOUNTAIN);
await game.runToMysteryEncounter();