mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-09-24 15:33:29 +02:00
Updated names of held items which modify stats
This commit is contained in:
parent
22a74f765e
commit
6e52baebee
@ -96,7 +96,7 @@ export const DepartmentStoreSaleEncounter: MysteryEncounter = MysteryEncounterBu
|
||||
if (roll === 0) {
|
||||
rewards.push(RewardId.PP_UP);
|
||||
} else {
|
||||
rewards.push(RewardId.BASE_STAT_BOOSTER);
|
||||
rewards.push(RewardId.VITAMIN);
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ export const HeldItemEffect = {
|
||||
EXP_BOOSTER: 5,
|
||||
// Should we actually distinguish different berry effects?
|
||||
BERRY: 6,
|
||||
BASE_STAT_BOOSTER: 7,
|
||||
BASE_STAT_MULTIPLY: 7,
|
||||
INSTANT_REVIVE: 8,
|
||||
STAT_BOOST: 9,
|
||||
CRIT_BOOST: 10,
|
||||
@ -30,10 +30,8 @@ export const HeldItemEffect = {
|
||||
TURN_END_ITEM_STEAL: 23,
|
||||
CONTACT_ITEM_STEAL_CHANCE: 24,
|
||||
EVO_TRACKER: 40,
|
||||
BASE_STAT_TOTAL: 50,
|
||||
BASE_STAT_FLAT: 51,
|
||||
INCREMENTING_STAT: 52,
|
||||
COSMETIC: 99,
|
||||
BASE_STAT_ADD: 50,
|
||||
MACHO_BRACE: 51,
|
||||
} as const;
|
||||
|
||||
export type HeldItemEffect = ObjectValues<typeof HeldItemEffect>;
|
||||
|
@ -54,7 +54,7 @@ export const RewardId = {
|
||||
|
||||
SPECIES_STAT_BOOSTER: 0x2C01,
|
||||
RARE_SPECIES_STAT_BOOSTER: 0x2C02,
|
||||
BASE_STAT_BOOSTER: 0x2C03,
|
||||
VITAMIN: 0x2C03,
|
||||
ATTACK_TYPE_BOOSTER: 0x2C04,
|
||||
BERRY: 0x2C05,
|
||||
|
||||
|
@ -1437,7 +1437,7 @@ export abstract class Pokemon extends Phaser.GameObjects.Container {
|
||||
): number {
|
||||
const statVal = new NumberHolder(this.getStat(stat, false));
|
||||
if (!ignoreHeldItems) {
|
||||
applyHeldItems(HeldItemEffect.STAT_BOOST, { pokemon: this, stat: stat, statValue: statVal });
|
||||
applyHeldItems(HeldItemEffect.STAT_BOOST, { pokemon: this, stat: stat, statHolder: statVal });
|
||||
}
|
||||
|
||||
// The Ruin abilities here are never ignored, but they reveal themselves on summon anyway
|
||||
@ -1547,7 +1547,7 @@ export abstract class Pokemon extends Phaser.GameObjects.Container {
|
||||
const statHolder = new NumberHolder(Math.floor((2 * baseStats[s] + this.ivs[s]) * this.level * 0.01));
|
||||
if (s === Stat.HP) {
|
||||
statHolder.value = statHolder.value + this.level + 10;
|
||||
applyHeldItems(HeldItemEffect.INCREMENTING_STAT, { pokemon: this, stat: s, statHolder: statHolder });
|
||||
applyHeldItems(HeldItemEffect.MACHO_BRACE, { pokemon: this, stat: s, statHolder: statHolder });
|
||||
if (this.hasAbility(AbilityId.WONDER_GUARD, false, true)) {
|
||||
statHolder.value = 1;
|
||||
}
|
||||
@ -1569,7 +1569,7 @@ export abstract class Pokemon extends Phaser.GameObjects.Container {
|
||||
1,
|
||||
);
|
||||
}
|
||||
applyHeldItems(HeldItemEffect.INCREMENTING_STAT, { pokemon: this, stat: s, statHolder: statHolder });
|
||||
applyHeldItems(HeldItemEffect.MACHO_BRACE, { pokemon: this, stat: s, statHolder: statHolder });
|
||||
}
|
||||
|
||||
statHolder.value = Phaser.Math.Clamp(statHolder.value, 1, Number.MAX_SAFE_INTEGER);
|
||||
@ -1581,10 +1581,8 @@ export abstract class Pokemon extends Phaser.GameObjects.Container {
|
||||
calculateBaseStats(): number[] {
|
||||
const baseStats = this.getSpeciesForm(true).baseStats.slice(0);
|
||||
applyChallenges(ChallengeType.FLIP_STAT, this, baseStats);
|
||||
// Shuckle Juice
|
||||
applyHeldItems(HeldItemEffect.BASE_STAT_TOTAL, { pokemon: this, baseStats: baseStats });
|
||||
// Old Gateau
|
||||
applyHeldItems(HeldItemEffect.BASE_STAT_FLAT, { pokemon: this, baseStats: baseStats });
|
||||
// Items that add to the stats
|
||||
applyHeldItems(HeldItemEffect.BASE_STAT_ADD, { pokemon: this, baseStats: baseStats });
|
||||
if (this.isFusion()) {
|
||||
const fusionBaseStats = this.getFusionSpeciesForm(true).baseStats;
|
||||
applyChallenges(ChallengeType.FLIP_STAT, this, fusionBaseStats);
|
||||
@ -1598,7 +1596,7 @@ export abstract class Pokemon extends Phaser.GameObjects.Container {
|
||||
}
|
||||
}
|
||||
// Vitamins
|
||||
applyHeldItems(HeldItemEffect.BASE_STAT_BOOSTER, { pokemon: this, baseStats: baseStats });
|
||||
applyHeldItems(HeldItemEffect.BASE_STAT_MULTIPLY, { pokemon: this, baseStats: baseStats });
|
||||
|
||||
return baseStats;
|
||||
}
|
||||
|
@ -9,9 +9,8 @@ import { type PermanentStat, Stat } from "#enums/stat";
|
||||
import { StatusEffect } from "#enums/status-effect";
|
||||
import { AccuracyBoosterHeldItem } from "#items/accuracy-booster";
|
||||
import { AttackTypeBoosterHeldItem, attackTypeToHeldItem } from "#items/attack-type-booster";
|
||||
import { BaseStatBoosterHeldItem, permanentStatToHeldItem } from "#items/base-stat-booster";
|
||||
import { BaseStatFlatHeldItem } from "#items/base-stat-flat";
|
||||
import { BaseStatTotalHeldItem } from "#items/base-stat-total";
|
||||
import { OldGateauHeldItem, ShuckleJuiceHeldItem } from "#items/base-stat-add";
|
||||
import { BaseStatMultiplyHeldItem, permanentStatToHeldItem } from "#items/base-stat-multiply";
|
||||
import { BatonHeldItem } from "#items/baton";
|
||||
import { BerryHeldItem, berryTypeToHeldItem } from "#items/berry";
|
||||
import { BypassSpeedChanceHeldItem } from "#items/bypass-speed-chance";
|
||||
@ -24,13 +23,13 @@ import { FlinchChanceHeldItem } from "#items/flinch-chance";
|
||||
import { FormChangeHeldItem } from "#items/form-change-item";
|
||||
import { FriendshipBoosterHeldItem } from "#items/friendship-booster";
|
||||
import { HitHealHeldItem } from "#items/hit-heal";
|
||||
import { IncrementingStatHeldItem } from "#items/incrementing-stat";
|
||||
import { InstantReviveHeldItem } from "#items/instant-revive";
|
||||
import { ContactItemStealChanceHeldItem, TurnEndItemStealHeldItem } from "#items/item-steal";
|
||||
import { MachoBraceHeldItem } from "#items/macho-brace";
|
||||
import { MultiHitHeldItem } from "#items/multi-hit";
|
||||
import { NatureWeightBoosterHeldItem } from "#items/nature-weight-booster";
|
||||
import { ResetNegativeStatStageHeldItem } from "#items/reset-negative-stat-stage";
|
||||
import { EvolutionStatBoostHeldItem, SpeciesStatBoostHeldItem } from "#items/stat-booster";
|
||||
import { EvolutionStatBoostHeldItem, SpeciesStatBoostHeldItem } from "#items/stat-boost";
|
||||
import { SurviveChanceHeldItem } from "#items/survive-chance";
|
||||
import { TurnEndHealHeldItem } from "#items/turn-end-heal";
|
||||
import { TurnEndStatusHeldItem } from "#items/turn-end-status";
|
||||
@ -121,25 +120,25 @@ export function initHeldItems() {
|
||||
// vitamins
|
||||
for (const [statKey, heldItemType] of Object.entries(permanentStatToHeldItem)) {
|
||||
const stat = Number(statKey) as PermanentStat;
|
||||
allHeldItems[heldItemType] = new BaseStatBoosterHeldItem(heldItemType, 30, stat)
|
||||
allHeldItems[heldItemType] = new BaseStatMultiplyHeldItem(heldItemType, 30, stat)
|
||||
.unstealable()
|
||||
.untransferable()
|
||||
.unsuppressable();
|
||||
}
|
||||
|
||||
allHeldItems[HeldItemId.SHUCKLE_JUICE_GOOD] = new BaseStatTotalHeldItem(HeldItemId.SHUCKLE_JUICE_GOOD, 1, 10)
|
||||
allHeldItems[HeldItemId.SHUCKLE_JUICE_GOOD] = new ShuckleJuiceHeldItem(HeldItemId.SHUCKLE_JUICE_GOOD, 1, 10)
|
||||
.unstealable()
|
||||
.untransferable()
|
||||
.unsuppressable();
|
||||
allHeldItems[HeldItemId.SHUCKLE_JUICE_BAD] = new BaseStatTotalHeldItem(HeldItemId.SHUCKLE_JUICE_BAD, 1, -15)
|
||||
allHeldItems[HeldItemId.SHUCKLE_JUICE_BAD] = new ShuckleJuiceHeldItem(HeldItemId.SHUCKLE_JUICE_BAD, 1, -15)
|
||||
.unstealable()
|
||||
.untransferable()
|
||||
.unsuppressable();
|
||||
allHeldItems[HeldItemId.OLD_GATEAU] = new BaseStatFlatHeldItem(HeldItemId.OLD_GATEAU, 1)
|
||||
allHeldItems[HeldItemId.OLD_GATEAU] = new OldGateauHeldItem(HeldItemId.OLD_GATEAU, 1)
|
||||
.unstealable()
|
||||
.untransferable()
|
||||
.unsuppressable();
|
||||
allHeldItems[HeldItemId.MACHO_BRACE] = new IncrementingStatHeldItem(HeldItemId.MACHO_BRACE, 50)
|
||||
allHeldItems[HeldItemId.MACHO_BRACE] = new MachoBraceHeldItem(HeldItemId.MACHO_BRACE, 50)
|
||||
.unstealable()
|
||||
.untransferable()
|
||||
.unsuppressable();
|
||||
|
@ -169,7 +169,7 @@ export const allRewards = {
|
||||
[RewardId.SPECIES_STAT_BOOSTER]: new SpeciesStatBoosterRewardGenerator(false),
|
||||
[RewardId.RARE_SPECIES_STAT_BOOSTER]: new SpeciesStatBoosterRewardGenerator(true),
|
||||
|
||||
[RewardId.BASE_STAT_BOOSTER]: new BaseStatBoosterRewardGenerator(),
|
||||
[RewardId.VITAMIN]: new BaseStatBoosterRewardGenerator(),
|
||||
|
||||
[RewardId.ATTACK_TYPE_BOOSTER]: new AttackTypeBoosterRewardGenerator(),
|
||||
|
||||
|
@ -27,21 +27,7 @@ export interface AttackTypeBoostParams {
|
||||
movePower: NumberHolder;
|
||||
}
|
||||
|
||||
export interface BaseStatBoosterParams {
|
||||
/** The pokemon with the item */
|
||||
pokemon: Pokemon;
|
||||
/** The base stats of the {@linkcode pokemon} */
|
||||
baseStats: number[];
|
||||
}
|
||||
|
||||
export interface BaseStatFlatParams {
|
||||
/** The pokemon with the item */
|
||||
pokemon: Pokemon;
|
||||
/** The base stats of the {@linkcode pokemon} */
|
||||
baseStats: number[];
|
||||
}
|
||||
|
||||
export interface BaseStatTotalParams {
|
||||
export interface BaseStatParams {
|
||||
/** The pokemon with the item */
|
||||
pokemon: Pokemon;
|
||||
/** Array of the pokemon's base stat; modified in place after item application */
|
||||
@ -105,16 +91,6 @@ export interface FriendshipBoostParams {
|
||||
|
||||
export type HitHealParams = DefaultHeldItemParams;
|
||||
|
||||
export interface IncrementingStatParams {
|
||||
/** The pokemon with the item */
|
||||
pokemon: Pokemon;
|
||||
/** The stat whose value is being impacted */
|
||||
stat: Stat;
|
||||
/** Holds the stat's value, which may be modified after item application */
|
||||
// TODO: https://github.com/pagefaultgames/pokerogue/pull/5656#discussion_r2135612276
|
||||
statHolder: NumberHolder;
|
||||
}
|
||||
|
||||
export type InstantReviveParams = DefaultHeldItemParams;
|
||||
|
||||
export interface ItemStealParams {
|
||||
@ -155,10 +131,10 @@ export type ResetNegativeStatStageParams = DefaultHeldItemParams;
|
||||
export interface StatBoostParams {
|
||||
/** The pokemon with the item */
|
||||
pokemon: Pokemon;
|
||||
/** The statistic to boost */
|
||||
/** The stat whose value is being impacted */
|
||||
stat: Stat;
|
||||
/** The value to change */
|
||||
statValue: NumberHolder;
|
||||
/** Holds the stat's value, which may be modified after item application */
|
||||
statHolder: NumberHolder;
|
||||
}
|
||||
|
||||
export interface SurviveChanceParams {
|
||||
@ -179,7 +155,7 @@ export type HeldItemEffectParamMap = {
|
||||
[HeldItemEffect.RESET_NEGATIVE_STAT_STAGE]: ResetNegativeStatStageParams;
|
||||
[HeldItemEffect.EXP_BOOSTER]: ExpBoostParams;
|
||||
[HeldItemEffect.BERRY]: BerryParams;
|
||||
[HeldItemEffect.BASE_STAT_BOOSTER]: BaseStatBoosterParams;
|
||||
[HeldItemEffect.BASE_STAT_MULTIPLY]: BaseStatParams;
|
||||
[HeldItemEffect.INSTANT_REVIVE]: InstantReviveParams;
|
||||
[HeldItemEffect.STAT_BOOST]: StatBoostParams;
|
||||
[HeldItemEffect.CRIT_BOOST]: CritBoostParams;
|
||||
@ -197,11 +173,9 @@ export type HeldItemEffectParamMap = {
|
||||
[HeldItemEffect.BATON]: BatonParams;
|
||||
[HeldItemEffect.CONTACT_ITEM_STEAL_CHANCE]: ItemStealParams;
|
||||
[HeldItemEffect.TURN_END_ITEM_STEAL]: ItemStealParams;
|
||||
[HeldItemEffect.BASE_STAT_TOTAL]: BaseStatTotalParams;
|
||||
[HeldItemEffect.BASE_STAT_FLAT]: BaseStatFlatParams;
|
||||
[HeldItemEffect.INCREMENTING_STAT]: IncrementingStatParams;
|
||||
[HeldItemEffect.BASE_STAT_ADD]: BaseStatParams;
|
||||
[HeldItemEffect.MACHO_BRACE]: StatBoostParams;
|
||||
[HeldItemEffect.EVO_TRACKER]: EvoTrackerParams;
|
||||
[HeldItemEffect.COSMETIC]: DefaultHeldItemParams;
|
||||
};
|
||||
/**
|
||||
* Dummy, Typescript-only constant to ensure that all {@linkcode HeldItemEffect}s have an entry in {@linkcode HeldItemEffectParamMap}.
|
||||
|
@ -1,14 +1,55 @@
|
||||
import { HeldItemEffect } from "#enums/held-item-effect";
|
||||
import type { HeldItemId } from "#enums/held-item-id";
|
||||
import { Stat } from "#enums/stat";
|
||||
import type { Pokemon } from "#field/pokemon";
|
||||
import { HeldItem } from "#items/held-item";
|
||||
import type { BaseStatTotalParams } from "#items/held-item-parameter";
|
||||
import type { BaseStatParams } from "#items/held-item-parameter";
|
||||
import i18next from "i18next";
|
||||
|
||||
/**
|
||||
* Currently used by Old Gateau item
|
||||
*/
|
||||
export class OldGateauHeldItem extends HeldItem<[typeof HeldItemEffect.BASE_STAT_ADD]> {
|
||||
public readonly effects = [HeldItemEffect.BASE_STAT_ADD] as const;
|
||||
public isTransferable = false;
|
||||
|
||||
get description(): string {
|
||||
return i18next.t("modifierType:ModifierType.PokemonBaseStatFlatModifierType.description");
|
||||
}
|
||||
|
||||
apply(_effect: typeof HeldItemEffect.BASE_STAT_ADD, { pokemon, baseStats }: BaseStatParams): true {
|
||||
const stats = this.getStats(pokemon);
|
||||
const statModifier = 20;
|
||||
// Modifies the passed in baseStats[] array by a flat value, only if the stat is specified in this.stats
|
||||
baseStats.forEach((v, i) => {
|
||||
if (stats.includes(i)) {
|
||||
const newVal = Math.floor(v + statModifier);
|
||||
baseStats[i] = Math.min(Math.max(newVal, 1), 999999);
|
||||
}
|
||||
});
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the lowest of HP/Spd, lowest of Atk/SpAtk, and lowest of Def/SpDef
|
||||
* @returns Array of 3 {@linkcode Stat}s to boost
|
||||
*/
|
||||
getStats(pokemon: Pokemon): [HpOrSpeed: Stat, AtkOrSpAtk: Stat, DefOrSpDef: Stat] {
|
||||
const baseStats = pokemon.getSpeciesForm().baseStats;
|
||||
return [
|
||||
baseStats[Stat.HP] < baseStats[Stat.SPD] ? Stat.HP : Stat.SPD,
|
||||
baseStats[Stat.ATK] < baseStats[Stat.SPATK] ? Stat.ATK : Stat.SPATK,
|
||||
baseStats[Stat.DEF] < baseStats[Stat.SPDEF] ? Stat.DEF : Stat.SPDEF,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Currently used by Shuckle Juice item
|
||||
*/
|
||||
export class BaseStatTotalHeldItem extends HeldItem<[typeof HeldItemEffect.BASE_STAT_TOTAL]> {
|
||||
public readonly effects = [HeldItemEffect.BASE_STAT_TOTAL] as const;
|
||||
export class ShuckleJuiceHeldItem extends HeldItem<[typeof HeldItemEffect.BASE_STAT_ADD]> {
|
||||
public readonly effects = [HeldItemEffect.BASE_STAT_ADD] as const;
|
||||
public isTransferable = false;
|
||||
public statModifier: number;
|
||||
|
||||
@ -50,7 +91,7 @@ export class BaseStatTotalHeldItem extends HeldItem<[typeof HeldItemEffect.BASE_
|
||||
* @param baseStats the base stats of the {@linkcode Pokemon}
|
||||
* @returns always `true`
|
||||
*/
|
||||
apply(_effect: typeof HeldItemEffect.BASE_STAT_TOTAL, { baseStats }: BaseStatTotalParams): true {
|
||||
apply(_effect: typeof HeldItemEffect.BASE_STAT_ADD, { baseStats }: BaseStatParams): true {
|
||||
// Modifies the passed in baseStats[] array
|
||||
baseStats.forEach((v, i) => {
|
||||
// HP is affected by half as much as other stats
|
@ -1,58 +0,0 @@
|
||||
import { HeldItemEffect } from "#enums/held-item-effect";
|
||||
import { Stat } from "#enums/stat";
|
||||
import type { Pokemon } from "#field/pokemon";
|
||||
import { HeldItem } from "#items/held-item";
|
||||
import type { BaseStatFlatParams } from "#items/held-item-parameter";
|
||||
import i18next from "i18next";
|
||||
|
||||
/**
|
||||
* Currently used by Old Gateau item
|
||||
*/
|
||||
export class BaseStatFlatHeldItem extends HeldItem<[typeof HeldItemEffect.BASE_STAT_FLAT]> {
|
||||
public readonly effects = [HeldItemEffect.BASE_STAT_FLAT] as const;
|
||||
public isTransferable = false;
|
||||
|
||||
get description(): string {
|
||||
return i18next.t("modifierType:ModifierType.PokemonBaseStatFlatModifierType.description");
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the {@linkcode PokemonBaseStatFlatModifier} should be applied to the {@linkcode Pokemon}.
|
||||
* @param pokemon The {@linkcode Pokemon} that holds the item
|
||||
* @param baseStats The base stats of the {@linkcode Pokemon}
|
||||
* @returns `true` if the {@linkcode PokemonBaseStatFlatModifier} should be applied
|
||||
*/
|
||||
// override shouldApply(pokemon?: Pokemon, baseStats?: number[]): boolean {
|
||||
// return super.shouldApply(pokemon, baseStats) && Array.isArray(baseStats);
|
||||
// }
|
||||
|
||||
/**
|
||||
* Applies the {@linkcode PokemonBaseStatFlatModifier}
|
||||
*/
|
||||
apply(_effect: typeof HeldItemEffect.BASE_STAT_FLAT, { pokemon, baseStats }: BaseStatFlatParams): true {
|
||||
const stats = this.getStats(pokemon);
|
||||
const statModifier = 20;
|
||||
// Modifies the passed in baseStats[] array by a flat value, only if the stat is specified in this.stats
|
||||
baseStats.forEach((v, i) => {
|
||||
if (stats.includes(i)) {
|
||||
const newVal = Math.floor(v + statModifier);
|
||||
baseStats[i] = Math.min(Math.max(newVal, 1), 999999);
|
||||
}
|
||||
});
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the lowest of HP/Spd, lowest of Atk/SpAtk, and lowest of Def/SpDef
|
||||
* @returns Array of 3 {@linkcode Stat}s to boost
|
||||
*/
|
||||
getStats(pokemon: Pokemon): [HpOrSpeed: Stat, AtkOrSpAtk: Stat, DefOrSpDef: Stat] {
|
||||
const baseStats = pokemon.getSpeciesForm().baseStats.slice(0);
|
||||
return [
|
||||
baseStats[Stat.HP] < baseStats[Stat.SPD] ? Stat.HP : Stat.SPD,
|
||||
baseStats[Stat.ATK] < baseStats[Stat.SPATK] ? Stat.ATK : Stat.SPATK,
|
||||
baseStats[Stat.DEF] < baseStats[Stat.SPDEF] ? Stat.DEF : Stat.SPDEF,
|
||||
];
|
||||
}
|
||||
}
|
@ -2,7 +2,7 @@ import { HeldItemEffect } from "#enums/held-item-effect";
|
||||
import { HeldItemId } from "#enums/held-item-id";
|
||||
import { getStatKey, type PermanentStat, Stat } from "#enums/stat";
|
||||
import { HeldItem } from "#items/held-item";
|
||||
import type { BaseStatBoosterParams } from "#items/held-item-parameter";
|
||||
import type { BaseStatParams } from "#items/held-item-parameter";
|
||||
import i18next from "i18next";
|
||||
|
||||
type PermanentStatToHeldItemMap = {
|
||||
@ -27,8 +27,8 @@ export const statBoostItems: Record<PermanentStat, string> = {
|
||||
[Stat.SPD]: "carbos",
|
||||
};
|
||||
|
||||
export class BaseStatBoosterHeldItem extends HeldItem<[typeof HeldItemEffect.BASE_STAT_BOOSTER]> {
|
||||
public readonly effects = [HeldItemEffect.BASE_STAT_BOOSTER] as const;
|
||||
export class BaseStatMultiplyHeldItem extends HeldItem<[typeof HeldItemEffect.BASE_STAT_MULTIPLY]> {
|
||||
public readonly effects = [HeldItemEffect.BASE_STAT_MULTIPLY] as const;
|
||||
public stat: PermanentStat;
|
||||
|
||||
constructor(type: HeldItemId, maxStackCount: number, stat: PermanentStat) {
|
||||
@ -63,7 +63,7 @@ export class BaseStatBoosterHeldItem extends HeldItem<[typeof HeldItemEffect.BAS
|
||||
/**
|
||||
* Applies the {@linkcode BaseStatModifier} to the specified {@linkcode Pokemon}.
|
||||
*/
|
||||
apply(_effect: typeof HeldItemEffect.BASE_STAT_BOOSTER, { pokemon, baseStats }: BaseStatBoosterParams): boolean {
|
||||
apply(_effect: typeof HeldItemEffect.BASE_STAT_MULTIPLY, { pokemon, baseStats }: BaseStatParams): boolean {
|
||||
const stackCount = pokemon.heldItemManager.getStack(this.type);
|
||||
baseStats[this.stat] = Math.floor(baseStats[this.stat] * (1 + stackCount * 0.1));
|
||||
return true;
|
@ -1,14 +1,14 @@
|
||||
import { HeldItemEffect } from "#enums/held-item-effect";
|
||||
import { Stat } from "#enums/stat";
|
||||
import { HeldItem } from "#items/held-item";
|
||||
import type { IncrementingStatParams } from "#items/held-item-parameter";
|
||||
import type { StatBoostParams } from "#items/held-item-parameter";
|
||||
import i18next from "i18next";
|
||||
|
||||
/**
|
||||
* Currently used by Macho Brace item
|
||||
*/
|
||||
export class IncrementingStatHeldItem extends HeldItem<[typeof HeldItemEffect.INCREMENTING_STAT]> {
|
||||
public readonly effects = [HeldItemEffect.INCREMENTING_STAT] as const;
|
||||
export class MachoBraceHeldItem extends HeldItem<[typeof HeldItemEffect.MACHO_BRACE]> {
|
||||
public readonly effects = [HeldItemEffect.MACHO_BRACE] as const;
|
||||
public isTransferable = false;
|
||||
|
||||
/**
|
||||
@ -34,10 +34,7 @@ export class IncrementingStatHeldItem extends HeldItem<[typeof HeldItemEffect.IN
|
||||
* Applies the {@linkcode PokemonIncrementingStatModifier}
|
||||
* @returns always `true`
|
||||
*/
|
||||
apply(
|
||||
_effect: typeof HeldItemEffect.INCREMENTING_STAT,
|
||||
{ pokemon, statHolder, stat }: IncrementingStatParams,
|
||||
): boolean {
|
||||
apply(_effect: typeof HeldItemEffect.MACHO_BRACE, { pokemon, statHolder, stat }: StatBoostParams): boolean {
|
||||
const stackCount = pokemon.heldItemManager.getStack(this.type);
|
||||
|
||||
// Modifies the passed in stat number holder by +2 per stack for HP, +1 per stack for other stats
|
@ -44,8 +44,8 @@ export class StatBoostHeldItem extends HeldItem<[typeof HeldItemEffect.STAT_BOOS
|
||||
* @returns `true` if the stat boost applies successfully, false otherwise
|
||||
* @see shouldApply
|
||||
*/
|
||||
apply(_effect: typeof HeldItemEffect.STAT_BOOST, { statValue }: StatBoostParams): boolean {
|
||||
statValue.value *= this.multiplier;
|
||||
apply(_effect: typeof HeldItemEffect.STAT_BOOST, { statHolder }: StatBoostParams): boolean {
|
||||
statHolder.value *= this.multiplier;
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -88,7 +88,7 @@ export class EvolutionStatBoostHeldItem extends StatBoostHeldItem {
|
||||
|
||||
if (pokemon.isFusion() && pokemon.getFusionSpeciesForm(true).speciesId in pokemonEvolutions !== isUnevolved) {
|
||||
// Half boost applied if pokemon is fused and either part of fusion is fully evolved
|
||||
params.statValue.value *= 1 + (this.multiplier - 1) / 2;
|
||||
params.statHolder.value *= 1 + (this.multiplier - 1) / 2;
|
||||
return true;
|
||||
}
|
||||
if (isUnevolved && !pokemon.isMax()) {
|
@ -257,7 +257,7 @@ function initGreatRewardPool() {
|
||||
},
|
||||
maxWeight: 4,
|
||||
},
|
||||
{ id: RewardId.BASE_STAT_BOOSTER, weight: 3 },
|
||||
{ id: RewardId.VITAMIN, weight: 3 },
|
||||
{
|
||||
id: RewardId.TERA_SHARD,
|
||||
weight: (party: Pokemon[]) =>
|
||||
|
@ -53,7 +53,7 @@ export const rewardRarities = {
|
||||
|
||||
[RewardId.SPECIES_STAT_BOOSTER]: RarityTier.GREAT,
|
||||
[RewardId.RARE_SPECIES_STAT_BOOSTER]: RarityTier.ULTRA,
|
||||
[RewardId.BASE_STAT_BOOSTER]: RarityTier.GREAT,
|
||||
[RewardId.VITAMIN]: RarityTier.GREAT,
|
||||
[RewardId.ATTACK_TYPE_BOOSTER]: RarityTier.ULTRA,
|
||||
[RewardId.BERRY]: RarityTier.COMMON,
|
||||
|
||||
|
@ -140,7 +140,7 @@ describe("Department Store Sale - Mystery Encounter", () => {
|
||||
expect(rewardSelectHandler.options.length).toEqual(3);
|
||||
for (const option of rewardSelectHandler.options) {
|
||||
expect(
|
||||
option.rewardOption.type.id === RewardId.PP_UP || option.rewardOption.type.id === RewardId.BASE_STAT_BOOSTER,
|
||||
option.rewardOption.type.id === RewardId.PP_UP || option.rewardOption.type.id === RewardId.VITAMIN,
|
||||
).toBeTruthy();
|
||||
}
|
||||
});
|
||||
|
@ -148,7 +148,7 @@ describe("The Strong Stuff - Mystery Encounter", () => {
|
||||
|
||||
const bstsAfter = scene.getPlayerParty().map(p => {
|
||||
const baseStats = p.getSpeciesForm().baseStats.slice(0);
|
||||
applyHeldItems(HeldItemEffect.BASE_STAT_TOTAL, { pokemon: p, baseStats: baseStats });
|
||||
applyHeldItems(HeldItemEffect.BASE_STAT_ADD, { pokemon: p, baseStats: baseStats });
|
||||
return baseStats.reduce((a, b) => a + b);
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user