mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-08-08 08:29:37 +02:00
Daily run items are generated within the new system
This commit is contained in:
parent
9611948d80
commit
39be97ef8e
@ -26,14 +26,14 @@ export const trainerHeldItemPool: HeldItemTieredPool = {};
|
|||||||
|
|
||||||
export const dailyStarterHeldItemPool: HeldItemTieredPool = {};
|
export const dailyStarterHeldItemPool: HeldItemTieredPool = {};
|
||||||
|
|
||||||
export function getDailyRunStarterHeldItems(party: PlayerPokemon[]) {
|
export function assignDailyRunStarterHeldItems(party: PlayerPokemon[]) {
|
||||||
for (const p of party) {
|
for (const p of party) {
|
||||||
for (let m = 0; m < 3; m++) {
|
for (let m = 0; m < 3; m++) {
|
||||||
const tierValue = randSeedInt(64);
|
const tierValue = randSeedInt(64);
|
||||||
|
|
||||||
const tier = getDailyRewardTier(tierValue);
|
const tier = getDailyRewardTier(tierValue);
|
||||||
|
|
||||||
const item = getNewHeldItemFromPool(dailyStarterHeldItemPool[tier] as HeldItemPool, p);
|
const item = getNewHeldItemFromPool(dailyStarterHeldItemPool[tier] as HeldItemPool, party);
|
||||||
p.heldItemManager.add(item);
|
p.heldItemManager.add(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -143,8 +143,12 @@ export function getNewHeldItemFromCategory(
|
|||||||
return null;
|
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 {
|
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;
|
const entry = pool[pickWeightedIndex(weights)].entry;
|
||||||
|
|
||||||
|
@ -6,9 +6,7 @@ import { getBiomeKey } from "#app/field/arena";
|
|||||||
import { GameMode, getGameMode } from "#app/game-mode";
|
import { GameMode, getGameMode } from "#app/game-mode";
|
||||||
import { GameModes } from "#enums/game-modes";
|
import { GameModes } from "#enums/game-modes";
|
||||||
import type { Modifier } from "#app/modifier/modifier";
|
import type { Modifier } from "#app/modifier/modifier";
|
||||||
import { getDailyRunStarterModifiers, regenerateModifierPoolThresholds } from "#app/modifier/modifier-type";
|
|
||||||
import { modifierTypes } from "#app/data/data-lists";
|
import { modifierTypes } from "#app/data/data-lists";
|
||||||
import { ModifierPoolType } from "#enums/modifier-pool-type";
|
|
||||||
import { Phase } from "#app/phase";
|
import { Phase } from "#app/phase";
|
||||||
import type { SessionSaveData } from "#app/system/game-data";
|
import type { SessionSaveData } from "#app/system/game-data";
|
||||||
import { Unlockables } from "#enums/unlockables";
|
import { Unlockables } from "#enums/unlockables";
|
||||||
@ -20,6 +18,7 @@ import { isLocal, isLocalServerConnected, isNullOrUndefined } from "#app/utils/c
|
|||||||
import i18next from "i18next";
|
import i18next from "i18next";
|
||||||
import { globalScene } from "#app/global-scene";
|
import { globalScene } from "#app/global-scene";
|
||||||
import Overrides from "#app/overrides";
|
import Overrides from "#app/overrides";
|
||||||
|
import { assignDailyRunStarterHeldItems } from "#app/items/held-item-pool";
|
||||||
|
|
||||||
export class TitlePhase extends Phase {
|
export class TitlePhase extends Phase {
|
||||||
public readonly phaseName = "TitlePhase";
|
public readonly phaseName = "TitlePhase";
|
||||||
@ -238,8 +237,6 @@ export class TitlePhase extends Phase {
|
|||||||
loadPokemonAssets.push(starterPokemon.loadAssets());
|
loadPokemonAssets.push(starterPokemon.loadAssets());
|
||||||
}
|
}
|
||||||
|
|
||||||
regenerateModifierPoolThresholds(party, ModifierPoolType.DAILY_STARTER);
|
|
||||||
|
|
||||||
const modifiers: Modifier[] = Array(3)
|
const modifiers: Modifier[] = Array(3)
|
||||||
.fill(null)
|
.fill(null)
|
||||||
.map(() => modifierTypes.EXP_SHARE().withIdFromFunc(modifierTypes.EXP_SHARE).newModifier())
|
.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()),
|
.map(() => modifierTypes.GOLDEN_EXP_CHARM().withIdFromFunc(modifierTypes.GOLDEN_EXP_CHARM).newModifier()),
|
||||||
)
|
)
|
||||||
.concat([modifierTypes.MAP().withIdFromFunc(modifierTypes.MAP).newModifier()])
|
.concat([modifierTypes.MAP().withIdFromFunc(modifierTypes.MAP).newModifier()])
|
||||||
.concat(getDailyRunStarterModifiers(party))
|
|
||||||
.filter(m => m !== null);
|
.filter(m => m !== null);
|
||||||
|
|
||||||
|
assignDailyRunStarterHeldItems(party);
|
||||||
|
|
||||||
for (const m of modifiers) {
|
for (const m of modifiers) {
|
||||||
globalScene.addModifier(m, true, false, false, true);
|
globalScene.addModifier(m, true, false, false, true);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user