mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-08-09 08:59:29 +02:00
Removed WeightedReward
This commit is contained in:
parent
be017438ff
commit
238ed3e23d
@ -25,9 +25,6 @@ cases to assign modifiers. This usage is now deprecated, as we have separate poo
|
|||||||
However, `getNewRewardOption` is not called directly by `generatePlayerRewardOptions`. Instead, it is filtered
|
However, `getNewRewardOption` is not called directly by `generatePlayerRewardOptions`. Instead, it is filtered
|
||||||
by `getRewardOptionWithRetry`, which also checks existing rewards to minimize the chance of duplicates.
|
by `getRewardOptionWithRetry`, which also checks existing rewards to minimize the chance of duplicates.
|
||||||
|
|
||||||
Note that the pool contains `WeightedReward` instances, which contain either a `Reward` or a `RewardGenerator`.
|
|
||||||
Once a pool entry is chosen, a specific `Reward` is generated accordingly and put in the returned `RewardOption`.
|
|
||||||
|
|
||||||
This will allow more customization in creating pools for challenges, MEs etc.
|
This will allow more customization in creating pools for challenges, MEs etc.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -36,7 +36,6 @@ import { SPECIES_STAT_BOOSTER_ITEMS, type SpeciesStatBoostHeldItem } from "#item
|
|||||||
import { TrainerItemEffect, tempStatToTrainerItem } from "#items/trainer-item";
|
import { TrainerItemEffect, tempStatToTrainerItem } from "#items/trainer-item";
|
||||||
import type { PokemonMove } from "#moves/pokemon-move";
|
import type { PokemonMove } from "#moves/pokemon-move";
|
||||||
import { getVoucherTypeIcon, getVoucherTypeName, type VoucherType } from "#system/voucher";
|
import { getVoucherTypeIcon, getVoucherTypeName, type VoucherType } from "#system/voucher";
|
||||||
import type { RewardFunc, WeightedRewardWeightFunc } from "#types/rewards";
|
|
||||||
import type { Exact } from "#types/type-helpers";
|
import type { Exact } from "#types/type-helpers";
|
||||||
import type { PokemonMoveSelectFilter, PokemonSelectFilter } from "#ui/party-ui-handler";
|
import type { PokemonMoveSelectFilter, PokemonSelectFilter } from "#ui/party-ui-handler";
|
||||||
import { PartyUiHandler } from "#ui/party-ui-handler";
|
import { PartyUiHandler } from "#ui/party-ui-handler";
|
||||||
@ -86,7 +85,6 @@ for example. The entries of rewardInitObj are used in the RewardPool.
|
|||||||
|
|
||||||
There are some more derived classes, in particular:
|
There are some more derived classes, in particular:
|
||||||
RewardGenerator, which creates Reward instances from a certain group (e.g. TMs, nature mints, or berries);
|
RewardGenerator, which creates Reward instances from a certain group (e.g. TMs, nature mints, or berries);
|
||||||
WeightedReward, which is a Reward with an attached weight or weight function to be used in pools;
|
|
||||||
and RewardOption, which is displayed during the select reward phase at the end of each encounter.
|
and RewardOption, which is displayed during the select reward phase at the end of each encounter.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -1508,22 +1506,6 @@ export class FormChangeItemRewardGenerator extends RewardGenerator {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class WeightedReward {
|
|
||||||
public reward: Reward | RewardGenerator;
|
|
||||||
public weight: number | WeightedRewardWeightFunc;
|
|
||||||
public maxWeight: number | WeightedRewardWeightFunc;
|
|
||||||
|
|
||||||
constructor(
|
|
||||||
rewardFunc: RewardFunc,
|
|
||||||
weight: number | WeightedRewardWeightFunc,
|
|
||||||
maxWeight?: number | WeightedRewardWeightFunc,
|
|
||||||
) {
|
|
||||||
this.reward = rewardFunc();
|
|
||||||
this.weight = weight;
|
|
||||||
this.maxWeight = maxWeight || (!(weight instanceof Function) ? weight : 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export class RewardOption {
|
export class RewardOption {
|
||||||
public type: Reward;
|
public type: Reward;
|
||||||
public upgradeCount: number;
|
public upgradeCount: number;
|
||||||
|
Loading…
Reference in New Issue
Block a user