diff --git a/src/items/held-item-pool.ts b/src/items/held-item-pool.ts index 8d2bbc413db..676fa798765 100644 --- a/src/items/held-item-pool.ts +++ b/src/items/held-item-pool.ts @@ -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; diff --git a/src/phases/title-phase.ts b/src/phases/title-phase.ts index 5e36081b899..72132635c1b 100644 --- a/src/phases/title-phase.ts +++ b/src/phases/title-phase.ts @@ -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); }