mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-06-29 21:12:45 +02:00
Simplified HeldItemReward
This commit is contained in:
parent
298325f726
commit
5c93a0c9b0
@ -147,7 +147,7 @@ export enum ModifierPoolType {
|
|||||||
DAILY_STARTER,
|
DAILY_STARTER,
|
||||||
}
|
}
|
||||||
|
|
||||||
type NewModifierFunc = (type: ModifierType, args: any[]) => Modifier;
|
type NewModifierFunc = (type: ModifierType, args: any[]) => Modifier | null;
|
||||||
|
|
||||||
export class ModifierType {
|
export class ModifierType {
|
||||||
public id: string;
|
public id: string;
|
||||||
@ -430,11 +430,11 @@ export class PokemonHeldItemModifierType extends PokemonModifierType {
|
|||||||
|
|
||||||
export class PokemonHeldItemReward extends PokemonModifierType {
|
export class PokemonHeldItemReward extends PokemonModifierType {
|
||||||
public itemId: HeldItemId;
|
public itemId: HeldItemId;
|
||||||
constructor(itemId: HeldItemId, newModifierFunc: NewModifierFunc, group?: string, soundName?: string) {
|
constructor(itemId: HeldItemId, group?: string, soundName?: string) {
|
||||||
super(
|
super(
|
||||||
"",
|
"",
|
||||||
"",
|
"",
|
||||||
newModifierFunc,
|
() => null,
|
||||||
(pokemon: PlayerPokemon) => {
|
(pokemon: PlayerPokemon) => {
|
||||||
const hasItem = pokemon.heldItemManager.hasItem(this.itemId);
|
const hasItem = pokemon.heldItemManager.hasItem(this.itemId);
|
||||||
const maxStackCount = allHeldItems[this.itemId].getMaxStackCount();
|
const maxStackCount = allHeldItems[this.itemId].getMaxStackCount();
|
||||||
@ -866,11 +866,7 @@ export class BerryReward extends PokemonHeldItemReward implements GeneratedPersi
|
|||||||
|
|
||||||
constructor(berryType: BerryType) {
|
constructor(berryType: BerryType) {
|
||||||
const itemId = berryTypeToHeldItem[berryType];
|
const itemId = berryTypeToHeldItem[berryType];
|
||||||
super(
|
super(itemId);
|
||||||
itemId,
|
|
||||||
// Next argument is useless
|
|
||||||
(type, args) => new BerryModifier(type, (args[0] as Pokemon).id, berryType),
|
|
||||||
);
|
|
||||||
|
|
||||||
this.berryType = berryType;
|
this.berryType = berryType;
|
||||||
this.id = "BERRY"; // needed to prevent harvest item deletion; remove after modifier rework
|
this.id = "BERRY"; // needed to prevent harvest item deletion; remove after modifier rework
|
||||||
@ -887,11 +883,7 @@ export class AttackTypeBoosterReward extends PokemonHeldItemReward implements Ge
|
|||||||
|
|
||||||
constructor(moveType: PokemonType, boostPercent: number) {
|
constructor(moveType: PokemonType, boostPercent: number) {
|
||||||
const itemId = attackTypeToHeldItem[moveType];
|
const itemId = attackTypeToHeldItem[moveType];
|
||||||
super(
|
super(itemId);
|
||||||
itemId,
|
|
||||||
// Next argument is useless
|
|
||||||
(_type, args) => new AttackTypeBoosterModifier(this, (args[0] as Pokemon).id, moveType, boostPercent),
|
|
||||||
);
|
|
||||||
this.moveType = moveType;
|
this.moveType = moveType;
|
||||||
this.boostPercent = boostPercent;
|
this.boostPercent = boostPercent;
|
||||||
}
|
}
|
||||||
@ -1058,7 +1050,7 @@ export class BaseStatBoosterReward extends PokemonHeldItemReward implements Gene
|
|||||||
constructor(stat: PermanentStat) {
|
constructor(stat: PermanentStat) {
|
||||||
const key = statBoostItems[stat];
|
const key = statBoostItems[stat];
|
||||||
const itemId = permanentStatToHeldItem[stat];
|
const itemId = permanentStatToHeldItem[stat];
|
||||||
super(itemId, (_type, args) => new BaseStatModifier(this, (args[0] as Pokemon).id, this.stat));
|
super(itemId);
|
||||||
|
|
||||||
this.stat = stat;
|
this.stat = stat;
|
||||||
this.key = key;
|
this.key = key;
|
||||||
@ -2144,6 +2136,8 @@ export const modifierTypes = {
|
|||||||
|
|
||||||
SACRED_ASH: () => new AllPokemonFullReviveModifierType("modifierType:ModifierType.SACRED_ASH", "sacred_ash"),
|
SACRED_ASH: () => new AllPokemonFullReviveModifierType("modifierType:ModifierType.SACRED_ASH", "sacred_ash"),
|
||||||
|
|
||||||
|
REVIVER_SEED_REWARD: () => new PokemonHeldItemReward(HeldItemId.REVIVER_SEED),
|
||||||
|
|
||||||
REVIVER_SEED: () =>
|
REVIVER_SEED: () =>
|
||||||
new PokemonHeldItemModifierType(
|
new PokemonHeldItemModifierType(
|
||||||
"modifierType:ModifierType.REVIVER_SEED",
|
"modifierType:ModifierType.REVIVER_SEED",
|
||||||
@ -2151,11 +2145,7 @@ export const modifierTypes = {
|
|||||||
(type, args) => new PokemonInstantReviveModifier(type, (args[0] as Pokemon).id),
|
(type, args) => new PokemonInstantReviveModifier(type, (args[0] as Pokemon).id),
|
||||||
),
|
),
|
||||||
|
|
||||||
WHITE_HERB_REWARD: () =>
|
WHITE_HERB_REWARD: () => new PokemonHeldItemReward(HeldItemId.WHITE_HERB),
|
||||||
new PokemonHeldItemReward(
|
|
||||||
HeldItemId.WHITE_HERB,
|
|
||||||
(type, args) => new ResetNegativeStatStageModifier(type, (args[0] as Pokemon).id),
|
|
||||||
),
|
|
||||||
|
|
||||||
// TODO: Remove the old one
|
// TODO: Remove the old one
|
||||||
WHITE_HERB: () =>
|
WHITE_HERB: () =>
|
||||||
@ -2314,16 +2304,8 @@ export const modifierTypes = {
|
|||||||
GOLDEN_EXP_CHARM: () =>
|
GOLDEN_EXP_CHARM: () =>
|
||||||
new ExpBoosterModifierType("modifierType:ModifierType.GOLDEN_EXP_CHARM", "golden_exp_charm", 100),
|
new ExpBoosterModifierType("modifierType:ModifierType.GOLDEN_EXP_CHARM", "golden_exp_charm", 100),
|
||||||
|
|
||||||
LUCKY_EGG_REWARD: () =>
|
LUCKY_EGG_REWARD: () => new PokemonHeldItemReward(HeldItemId.LUCKY_EGG),
|
||||||
new PokemonHeldItemReward(
|
GOLDEN_EGG_REWARD: () => new PokemonHeldItemReward(HeldItemId.GOLDEN_EGG),
|
||||||
HeldItemId.LUCKY_EGG,
|
|
||||||
(type, args) => new ExpBoosterModifier(type, (args[0] as Pokemon).id),
|
|
||||||
),
|
|
||||||
GOLDEN_EGG_REWARD: () =>
|
|
||||||
new PokemonHeldItemReward(
|
|
||||||
HeldItemId.GOLDEN_EGG,
|
|
||||||
(type, args) => new ExpBoosterModifier(type, (args[0] as Pokemon).id),
|
|
||||||
),
|
|
||||||
|
|
||||||
// TODO: Remove these when refactor is done
|
// TODO: Remove these when refactor is done
|
||||||
LUCKY_EGG: () => new PokemonExpBoosterModifierType("modifierType:ModifierType.LUCKY_EGG", "lucky_egg", 40),
|
LUCKY_EGG: () => new PokemonExpBoosterModifierType("modifierType:ModifierType.LUCKY_EGG", "lucky_egg", 40),
|
||||||
@ -2458,17 +2440,9 @@ export const modifierTypes = {
|
|||||||
(type, args) => new FlinchChanceModifier(type, (args[0] as Pokemon).id),
|
(type, args) => new FlinchChanceModifier(type, (args[0] as Pokemon).id),
|
||||||
),
|
),
|
||||||
|
|
||||||
LEFTOVERS_REWARD: () =>
|
LEFTOVERS_REWARD: () => new PokemonHeldItemReward(HeldItemId.LEFTOVERS),
|
||||||
new PokemonHeldItemReward(
|
|
||||||
HeldItemId.LEFTOVERS,
|
|
||||||
(type, args) => new TurnHealModifier(type, (args[0] as Pokemon).id),
|
|
||||||
),
|
|
||||||
|
|
||||||
SHELL_BELL_REWARD: () =>
|
SHELL_BELL_REWARD: () => new PokemonHeldItemReward(HeldItemId.SHELL_BELL),
|
||||||
new PokemonHeldItemReward(
|
|
||||||
HeldItemId.SHELL_BELL,
|
|
||||||
(type, args) => new HitHealModifier(type, (args[0] as Pokemon).id),
|
|
||||||
),
|
|
||||||
|
|
||||||
LEFTOVERS: () =>
|
LEFTOVERS: () =>
|
||||||
new PokemonHeldItemModifierType(
|
new PokemonHeldItemModifierType(
|
||||||
|
Loading…
Reference in New Issue
Block a user