mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-08-10 17:39:31 +02:00
Expunged RewardFunc
This commit is contained in:
parent
b3f3aa56bd
commit
88e0a3d6ec
@ -3,9 +3,7 @@ import type { RewardId } from "#enums/reward-id";
|
||||
import type { TrainerItemId } from "#enums/trainer-item-id";
|
||||
import type { Pokemon } from "#field/pokemon";
|
||||
import type { allRewardsType } from "#items/all-rewards";
|
||||
import type { Reward, RewardGenerator } from "#items/reward";
|
||||
|
||||
export type RewardFunc = Reward | RewardGenerator;
|
||||
import type { RewardGenerator } from "#items/reward";
|
||||
|
||||
// TODO: Remove party from arguments can be accessed from `globalScene`
|
||||
export type WeightedRewardWeightFunc = (party: Pokemon[], rerollCount?: number) => number;
|
||||
|
@ -3,13 +3,12 @@ import { globalScene } from "#app/global-scene";
|
||||
import { pokemonEvolutions, pokemonPrevolutions } from "#balance/pokemon-evolutions";
|
||||
import { signatureSpecies } from "#balance/signature-species";
|
||||
import { tmSpecies } from "#balance/tms";
|
||||
import { allRewards } from "#data/data-lists";
|
||||
import { doubleBattleDialogue } from "#data/double-battle-dialogue";
|
||||
import { Gender } from "#data/gender";
|
||||
import type { PokemonSpecies, PokemonSpeciesFilter } from "#data/pokemon-species";
|
||||
import { AbilityId } from "#enums/ability-id";
|
||||
import { MoveId } from "#enums/move-id";
|
||||
import { PartyMemberStrength } from "#enums/party-member-strength";
|
||||
import type { PartyMemberStrength } from "#enums/party-member-strength";
|
||||
import { PokeballType } from "#enums/pokeball";
|
||||
import { PokemonType } from "#enums/pokemon-type";
|
||||
import { SpeciesId } from "#enums/species-id";
|
||||
@ -19,6 +18,8 @@ import { TrainerSlot } from "#enums/trainer-slot";
|
||||
import { TrainerType } from "#enums/trainer-type";
|
||||
import { TrainerVariant } from "#enums/trainer-variant";
|
||||
import type { EnemyPokemon } from "#field/pokemon";
|
||||
import { allRewards } from "#items/all-rewards";
|
||||
import type { Reward, RewardGenerator } from "#items/reward";
|
||||
import { PokemonMove } from "#moves/pokemon-move";
|
||||
import { getIsInitialized, initI18n } from "#plugins/i18n";
|
||||
import type { EvilTeam } from "#trainers/evil-admin-trainer-pools";
|
||||
@ -28,10 +29,9 @@ import {
|
||||
getGymLeaderPartyTemplate,
|
||||
getWavePartyTemplate,
|
||||
TrainerPartyCompoundTemplate,
|
||||
TrainerPartyTemplate,
|
||||
type TrainerPartyTemplate,
|
||||
trainerPartyTemplates,
|
||||
} from "#trainers/trainer-party-template";
|
||||
import type { RewardFunc } from "#types/rewards";
|
||||
import type {
|
||||
GenAIFunc,
|
||||
GenTrainerItemsFunc,
|
||||
@ -109,7 +109,7 @@ export class TrainerConfig {
|
||||
public victoryBgm: string;
|
||||
public genTrainerItemsFunc: GenTrainerItemsFunc;
|
||||
public genAIFuncs: GenAIFunc[] = [];
|
||||
public rewardFuncs: RewardFunc[] = [];
|
||||
public rewardFuncs: (Reward | RewardGenerator)[] = [];
|
||||
public partyTemplates: TrainerPartyTemplate[];
|
||||
public partyTemplateFunc: PartyTemplateFunc;
|
||||
public partyMemberFuncs: PartyMemberFuncs = {};
|
||||
@ -501,7 +501,7 @@ export class TrainerConfig {
|
||||
return this;
|
||||
}
|
||||
|
||||
setRewardFuncs(...rewardFuncs: (() => RewardFunc)[]): TrainerConfig {
|
||||
setRewardFuncs(...rewardFuncs: (Reward | RewardGenerator)[]): TrainerConfig {
|
||||
this.rewardFuncs = rewardFuncs.map(func => () => {
|
||||
const rewardFunc = func();
|
||||
const reward = rewardFunc();
|
||||
|
@ -52,19 +52,17 @@ export const RewardId = {
|
||||
MEMORY_MUSHROOM: 0x2B03,
|
||||
DNA_SPLICERS: 0x2B04,
|
||||
|
||||
HELD_ITEM: 0x2C01, // TODO: Remove?
|
||||
SPECIES_STAT_BOOSTER: 0x2C02,
|
||||
RARE_SPECIES_STAT_BOOSTER: 0x2C03,
|
||||
BASE_STAT_BOOSTER: 0x2C04,
|
||||
ATTACK_TYPE_BOOSTER: 0x2C05,
|
||||
BERRY: 0x2C06,
|
||||
SPECIES_STAT_BOOSTER: 0x2C01,
|
||||
RARE_SPECIES_STAT_BOOSTER: 0x2C02,
|
||||
BASE_STAT_BOOSTER: 0x2C03,
|
||||
ATTACK_TYPE_BOOSTER: 0x2C04,
|
||||
BERRY: 0x2C05,
|
||||
|
||||
TRAINER_ITEM: 0x2D01,
|
||||
TEMP_STAT_STAGE_BOOSTER: 0x2D02,
|
||||
DIRE_HIT: 0x2D03,
|
||||
LURE: 0x2D04,
|
||||
SUPER_LURE: 0x2D05,
|
||||
MAX_LURE: 0x2D06,
|
||||
TEMP_STAT_STAGE_BOOSTER: 0x2D01,
|
||||
DIRE_HIT: 0x2D02,
|
||||
LURE: 0x2D03,
|
||||
SUPER_LURE: 0x2D04,
|
||||
MAX_LURE: 0x2D05,
|
||||
|
||||
FORM_CHANGE_ITEM: 0x2E01,
|
||||
RARE_FORM_CHANGE_ITEM: 0x2E02,
|
||||
|
@ -3,7 +3,6 @@ import { RewardId } from "#enums/reward-id";
|
||||
import { RarityTier } from "#enums/reward-tier";
|
||||
import { TrainerItemId } from "#enums/trainer-item-id";
|
||||
import { VoucherType } from "#system/voucher";
|
||||
import type { RewardFunc } from "#types/rewards";
|
||||
import {
|
||||
AddMoneyReward,
|
||||
AddPokeballReward,
|
||||
@ -27,6 +26,8 @@ import {
|
||||
PokemonReviveReward,
|
||||
PokemonStatusHealReward,
|
||||
RememberMoveReward,
|
||||
type Reward,
|
||||
type RewardGenerator,
|
||||
SpeciesStatBoosterRewardGenerator,
|
||||
TempStatStageBoosterRewardGenerator,
|
||||
TeraTypeRewardGenerator,
|
||||
@ -184,7 +185,7 @@ export const allRewards = {
|
||||
|
||||
[RewardId.DIRE_HIT]: new LapsingTrainerItemReward(TrainerItemId.DIRE_HIT, RewardId.TEMP_STAT_STAGE_BOOSTER),
|
||||
} as const satisfies {
|
||||
[k in RewardId]: RewardFunc;
|
||||
[k in RewardId]: Reward | RewardGenerator;
|
||||
};
|
||||
|
||||
export type allRewardsType = typeof allRewards;
|
||||
|
@ -3,7 +3,7 @@ import { getRewardCategory, RewardCategoryId, RewardId } from "#enums/reward-id"
|
||||
import type { RarityTier } from "#enums/reward-tier";
|
||||
import type { TrainerItemId } from "#enums/trainer-item-id";
|
||||
import { allRewards } from "#items/all-rewards";
|
||||
import type { RewardFunc, RewardPoolId, RewardSpecs } from "#types/rewards";
|
||||
import type { RewardPoolId, RewardSpecs } from "#types/rewards";
|
||||
import { heldItemRarities } from "./held-item-default-tiers";
|
||||
import {
|
||||
HeldItemReward,
|
||||
@ -62,7 +62,7 @@ export function generateRewardOptionFromId<T extends RewardPoolId>(
|
||||
return new RewardOption(reward, upgradeCount, tier, cost);
|
||||
}
|
||||
|
||||
const rewardFunc = allRewards[id] as RewardFunc;
|
||||
const rewardFunc = allRewards[id] as Reward | RewardGenerator;
|
||||
const reward = rewardFunc instanceof RewardGenerator ? rewardFunc.generateReward(pregenArgs) : rewardFunc;
|
||||
if (reward) {
|
||||
const tier = tierOverride ?? rewardRarities[id];
|
||||
|
@ -1,7 +1,6 @@
|
||||
import { globalScene } from "#app/global-scene";
|
||||
import type { Reward } from "#items/reward";
|
||||
import type { Reward, RewardGenerator } from "#items/reward";
|
||||
import { BattlePhase } from "#phases/battle-phase";
|
||||
import type { RewardFunc } from "#types/rewards";
|
||||
import i18next from "i18next";
|
||||
|
||||
export class RewardPhase extends BattlePhase {
|
||||
@ -10,7 +9,7 @@ export class RewardPhase extends BattlePhase {
|
||||
public readonly phaseName: "RewardPhase" | "RibbonRewardPhase" | "GameOverRewardPhase" = "RewardPhase";
|
||||
protected reward: Reward;
|
||||
|
||||
constructor(rewardFunc: RewardFunc) {
|
||||
constructor(rewardFunc: Reward | RewardGenerator) {
|
||||
super();
|
||||
|
||||
this.reward = rewardFunc();
|
||||
|
@ -1,15 +1,15 @@
|
||||
import { globalScene } from "#app/global-scene";
|
||||
import type { PokemonSpecies } from "#data/pokemon-species";
|
||||
import { UiMode } from "#enums/ui-mode";
|
||||
import type { Reward, RewardGenerator } from "#items/reward";
|
||||
import { RewardPhase } from "#phases/reward-phase";
|
||||
import type { RewardFunc } from "#types/rewards";
|
||||
import i18next from "i18next";
|
||||
|
||||
export class RibbonRewardPhase extends RewardPhase {
|
||||
public readonly phaseName = "RibbonRewardPhase";
|
||||
private species: PokemonSpecies;
|
||||
|
||||
constructor(rewardFunc: RewardFunc, species: PokemonSpecies) {
|
||||
constructor(rewardFunc: Reward | RewardGenerator, species: PokemonSpecies) {
|
||||
super(rewardFunc);
|
||||
|
||||
this.species = species;
|
||||
|
@ -1,7 +1,6 @@
|
||||
import { globalScene } from "#app/global-scene";
|
||||
import { type Reward, RewardGenerator } from "#items/reward";
|
||||
import { BattlePhase } from "#phases/battle-phase";
|
||||
import type { RewardFunc } from "#types/rewards";
|
||||
import i18next from "i18next";
|
||||
|
||||
export class RewardPhase extends BattlePhase {
|
||||
@ -10,7 +9,7 @@ export class RewardPhase extends BattlePhase {
|
||||
public readonly phaseName: "RewardPhase" | "RibbonRewardPhase" | "GameOverRewardPhase" = "RewardPhase";
|
||||
protected reward: Reward;
|
||||
|
||||
constructor(rewardFunc: RewardFunc) {
|
||||
constructor(rewardFunc: Reward | RewardGenerator) {
|
||||
super();
|
||||
|
||||
const reward = rewardFunc();
|
||||
|
@ -5,8 +5,8 @@ import { Challenges } from "#enums/challenges";
|
||||
import { MysteryEncounterTier } from "#enums/mystery-encounter-tier";
|
||||
import { MysteryEncounterType } from "#enums/mystery-encounter-type";
|
||||
import { SpeciesId } from "#enums/species-id";
|
||||
import { TrainerItemId } from "#enums/trainer-item-id";
|
||||
import { TextStyle } from "#enums/text-style";
|
||||
import { TrainerItemId } from "#enums/trainer-item-id";
|
||||
import { WeatherType } from "#enums/weather-type";
|
||||
import { addTextObject } from "#ui/text";
|
||||
import type { nil } from "#utils/common";
|
||||
|
@ -5,8 +5,8 @@ import { Button } from "#enums/buttons";
|
||||
import { Command } from "#enums/command";
|
||||
import { PokemonType } from "#enums/pokemon-type";
|
||||
import { SpeciesId } from "#enums/species-id";
|
||||
import { TrainerItemId } from "#enums/trainer-item-id";
|
||||
import { TextStyle } from "#enums/text-style";
|
||||
import { TrainerItemId } from "#enums/trainer-item-id";
|
||||
import { UiMode } from "#enums/ui-mode";
|
||||
import type { CommandPhase } from "#phases/command-phase";
|
||||
import { PartyUiHandler, PartyUiMode } from "#ui/party-ui-handler";
|
||||
|
@ -56,4 +56,4 @@ export class ModifierHelper extends GameManagerHelper {
|
||||
private log(...params: any[]) {
|
||||
console.log("Modifiers:", ...params);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -56,4 +56,4 @@ export class ModifierHelper extends GameManagerHelper {
|
||||
private log(...params: any[]) {
|
||||
console.log("Modifiers:", ...params);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user