Daily run items are generated within the new system

This commit is contained in:
Wlowscha 2025-06-17 22:03:25 +02:00
parent 9611948d80
commit 39be97ef8e
No known key found for this signature in database
GPG Key ID: 3C8F1AD330565D04
2 changed files with 10 additions and 8 deletions

View File

@ -26,14 +26,14 @@ export const trainerHeldItemPool: HeldItemTieredPool = {};
export const dailyStarterHeldItemPool: HeldItemTieredPool = {};
export function getDailyRunStarterHeldItems(party: PlayerPokemon[]) {
export function assignDailyRunStarterHeldItems(party: PlayerPokemon[]) {
for (const p of party) {
for (let m = 0; m < 3; m++) {
const tierValue = randSeedInt(64);
const tier = getDailyRewardTier(tierValue);
const item = getNewHeldItemFromPool(dailyStarterHeldItemPool[tier] as HeldItemPool, p);
const item = getNewHeldItemFromPool(dailyStarterHeldItemPool[tier] as HeldItemPool, party);
p.heldItemManager.add(item);
}
}
@ -143,8 +143,12 @@ export function getNewHeldItemFromCategory(
return null;
}
function getPoolWeights(pool: HeldItemPool, pokemon: Pokemon | Pokemon[]): number[] {
return pool.map(p => (typeof p.weight === "function" ? p.weight(coerceArray(pokemon)) : p.weight));
}
function getNewHeldItemFromPool(pool: HeldItemPool, pokemon: Pokemon | Pokemon[]): HeldItemId | HeldItemSpecs {
const weights = pool.map(p => (typeof p.weight === "function" ? p.weight(coerceArray(pokemon)) : p.weight));
const weights = getPoolWeights(pool, pokemon);
const entry = pool[pickWeightedIndex(weights)].entry;

View File

@ -6,9 +6,7 @@ import { getBiomeKey } from "#app/field/arena";
import { GameMode, getGameMode } from "#app/game-mode";
import { GameModes } from "#enums/game-modes";
import type { Modifier } from "#app/modifier/modifier";
import { getDailyRunStarterModifiers, regenerateModifierPoolThresholds } from "#app/modifier/modifier-type";
import { modifierTypes } from "#app/data/data-lists";
import { ModifierPoolType } from "#enums/modifier-pool-type";
import { Phase } from "#app/phase";
import type { SessionSaveData } from "#app/system/game-data";
import { Unlockables } from "#enums/unlockables";
@ -20,6 +18,7 @@ import { isLocal, isLocalServerConnected, isNullOrUndefined } from "#app/utils/c
import i18next from "i18next";
import { globalScene } from "#app/global-scene";
import Overrides from "#app/overrides";
import { assignDailyRunStarterHeldItems } from "#app/items/held-item-pool";
export class TitlePhase extends Phase {
public readonly phaseName = "TitlePhase";
@ -238,8 +237,6 @@ export class TitlePhase extends Phase {
loadPokemonAssets.push(starterPokemon.loadAssets());
}
regenerateModifierPoolThresholds(party, ModifierPoolType.DAILY_STARTER);
const modifiers: Modifier[] = Array(3)
.fill(null)
.map(() => modifierTypes.EXP_SHARE().withIdFromFunc(modifierTypes.EXP_SHARE).newModifier())
@ -249,9 +246,10 @@ export class TitlePhase extends Phase {
.map(() => modifierTypes.GOLDEN_EXP_CHARM().withIdFromFunc(modifierTypes.GOLDEN_EXP_CHARM).newModifier()),
)
.concat([modifierTypes.MAP().withIdFromFunc(modifierTypes.MAP).newModifier()])
.concat(getDailyRunStarterModifiers(party))
.filter(m => m !== null);
assignDailyRunStarterHeldItems(party);
for (const m of modifiers) {
globalScene.addModifier(m, true, false, false, true);
}