From e9b06bdf1b4750f4dba727b920796863c72a697a Mon Sep 17 00:00:00 2001 From: RedstonewolfX <108761527+RedstonewolfX@users.noreply.github.com> Date: Mon, 26 Aug 2024 14:40:53 -0400 Subject: [PATCH] Try (and fail) to write tests Wrote a check (that might not even work) to make sure the player starts with a Map in the Daily Run Attempted to write a check to see if Eviolite spawns in Daily Run, but can't figure out how to look for the right thing in the loot table Attempted to write a check for shiny luck, but don't know how to manually set luck --- src/modifier/modifier-type.ts | 28 ++++++++++++++++++++++++++-- src/test/daily_mode.test.ts | 12 ++++++++++++ src/test/game-mode.test.ts | 18 ++++++++++++++++++ 3 files changed, 56 insertions(+), 2 deletions(-) diff --git a/src/modifier/modifier-type.ts b/src/modifier/modifier-type.ts index 0cf3ea66def..20835e745f7 100644 --- a/src/modifier/modifier-type.ts +++ b/src/modifier/modifier-type.ts @@ -1597,7 +1597,7 @@ const modifierPool: ModifierPool = { new WeightedModifierType(modifierTypes.AMULET_COIN, skipInLastClassicWaveOrDefault(3)), new WeightedModifierType(modifierTypes.EVIOLITE, (party: Pokemon[]) => { const { gameMode, gameData } = party[0].scene; - if (!gameMode.isFreshStartChallenge() && !gameMode.isDaily && gameData.unlocks[Unlockables.EVIOLITE]) { + if (gameMode.isDaily || (!gameMode.isFreshStartChallenge() && gameData.unlocks[Unlockables.EVIOLITE])) { return party.some(p => ((p.getSpeciesForm(true).speciesId in pokemonEvolutions) || (p.isFusion() && (p.getFusionSpeciesForm(true).speciesId in pokemonEvolutions))) && !p.getHeldItems().some(i => i instanceof Modifiers.EvolutionStatBoosterModifier)) ? 10 : 0; } return 0; @@ -1675,7 +1675,7 @@ const modifierPool: ModifierPool = { new WeightedModifierType(modifierTypes.MULTI_LENS, 18), new WeightedModifierType(modifierTypes.VOUCHER_PREMIUM, (party: Pokemon[], rerollCount: integer) => !party[0].scene.gameMode.isDaily && !party[0].scene.gameMode.isEndless && !party[0].scene.gameMode.isSplicedOnly ? Math.max(5 - rerollCount * 2, 0) : 0, 5), new WeightedModifierType(modifierTypes.DNA_SPLICERS, (party: Pokemon[]) => !party[0].scene.gameMode.isSplicedOnly && party.filter(p => !p.fusionSpecies).length > 1 ? 24 : 0, 24), - new WeightedModifierType(modifierTypes.MINI_BLACK_HOLE, (party: Pokemon[]) => (!party[0].scene.gameMode.isFreshStartChallenge() && party[0].scene.gameData.unlocks[Unlockables.MINI_BLACK_HOLE]) ? 1 : 0, 1), + new WeightedModifierType(modifierTypes.MINI_BLACK_HOLE, (party: Pokemon[]) => (party[0].scene.gameMode.isDaily || (!party[0].scene.gameMode.isFreshStartChallenge() && party[0].scene.gameData.unlocks[Unlockables.MINI_BLACK_HOLE])) ? 1 : 0, 1), ].map(m => { m.setTier(ModifierTier.MASTER); return m; }) @@ -2090,6 +2090,30 @@ export function getDailyRunStarterModifiers(party: PlayerPokemon[]): Modifiers.P return ret; } +/* +export function getModifierThresholdPool(poolType: ModifierPoolType) { + let thresholds: {} + switch (poolType) { + case ModifierPoolType.PLAYER: + thresholds = modifierPoolThresholds; + break; + case ModifierPoolType.WILD: + thresholds = enemyModifierPoolThresholds; + break; + case ModifierPoolType.TRAINER: + thresholds = enemyModifierPoolThresholds; + break; + case ModifierPoolType.ENEMY_BUFF: + thresholds = enemyBuffModifierPoolThresholds; + break; + case ModifierPoolType.DAILY_STARTER: + thresholds = dailyStarterModifierPoolThresholds; + break; + } + return thresholds; +} +*/ + function getNewModifierTypeOption(party: Pokemon[], poolType: ModifierPoolType, tier?: ModifierTier, upgradeCount?: integer, retryCount: integer = 0): ModifierTypeOption | null { const player = !poolType; const pool = getModifierPoolForType(poolType); diff --git a/src/test/daily_mode.test.ts b/src/test/daily_mode.test.ts index 5cc61a62874..ebc19c0b6de 100644 --- a/src/test/daily_mode.test.ts +++ b/src/test/daily_mode.test.ts @@ -1,5 +1,6 @@ import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; import GameManager from "./utils/gameManager"; +import { MapModifier } from "#app/modifier/modifier.js"; describe("Daily Mode", () => { let phaserGame: Phaser.Game; @@ -28,5 +29,16 @@ describe("Daily Mode", () => { expect(pkm.level).toBe(20); expect(pkm.moveset.length).toBeGreaterThan(0); }); + expect(game.scene.getModifiers(MapModifier).length).toBeGreaterThan(0); }); + + /* + Can't figure out how to check the shop's item pool :( + describe("Shop modifications", async () => { + const modifierPhase = new SelectModifierPhase(game.scene); + game.scene.unshiftPhase(modifierPhase); + await game.phaseInterceptor.run(SelectModifierPhase); + expect(getModifierThresholdPool(ModifierPoolType.PLAYER)); + }); + */ }); diff --git a/src/test/game-mode.test.ts b/src/test/game-mode.test.ts index ccec3a3aa16..b3f014d0154 100644 --- a/src/test/game-mode.test.ts +++ b/src/test/game-mode.test.ts @@ -41,4 +41,22 @@ describe("game-mode", () => { expect(classicGameMode.isWaveTrainer(19, arena)).toBeFalsy(); }); }); + /* + Need to figure out how to override my party members' luck to calculate this + describe("Luck Check", async () => { + let classicGameMode: GameMode; + let dailyGameMode: GameMode; + beforeEach(() => { + classicGameMode = getGameMode(GameModes.CLASSIC); + dailyGameMode = getGameMode(GameModes.DAILY); + }); + const party = game.scene.getParty(); + const oldmode = game.scene.gameMode; + game.scene.gameMode = classicGameMode!; + expect(getPartyLuckValue(party)).toBe(3); + game.scene.gameMode = dailyGameMode!; + expect(getPartyLuckValue(party)).toBe(0); + game.scene.gameMode = oldmode; + }) + */ });