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
This commit is contained in:
RedstonewolfX 2024-08-26 14:40:53 -04:00
parent 6225a020e0
commit e9b06bdf1b
3 changed files with 56 additions and 2 deletions

View File

@ -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);

View File

@ -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));
});
*/
});

View File

@ -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;
})
*/
});