From d22f7b1d4aa82a4787ee0fb326f46a17e538fa78 Mon Sep 17 00:00:00 2001 From: Wlowscha <54003515+Wlowscha@users.noreply.github.com> Date: Mon, 9 Jun 2025 18:37:12 +0200 Subject: [PATCH] Fixed types in shuckle juice and old gateau --- src/items/held-items/base-stat-flat.ts | 10 +++++----- src/items/held-items/base-stat-total.ts | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/items/held-items/base-stat-flat.ts b/src/items/held-items/base-stat-flat.ts index 6111263d3ef..5144b392ad0 100644 --- a/src/items/held-items/base-stat-flat.ts +++ b/src/items/held-items/base-stat-flat.ts @@ -13,6 +13,7 @@ export interface BASE_STAT_FLAT_PARAMS { export interface BASE_STAT_FLAT_DATA { statModifier: number; + stats: Stat[]; } /** @@ -20,12 +21,10 @@ export interface BASE_STAT_FLAT_DATA { */ export class BaseStatFlatHeldItem extends HeldItem { public effects: ITEM_EFFECT[] = [ITEM_EFFECT.BASE_STAT_FLAT]; - private stats: Stat[]; public isTransferable = false; - constructor(type: HeldItemId, maxStackCount = 1, stats: Stat[]) { + constructor(type: HeldItemId, maxStackCount = 1) { super(type, maxStackCount); - this.stats = stats; } get description(): string { @@ -53,15 +52,16 @@ export class BaseStatFlatHeldItem extends HeldItem { */ apply(params: BASE_STAT_FLAT_PARAMS): boolean { const pokemon = params.pokemon; - const itemData = pokemon.heldItemManager.heldItems[this.type].data; + const itemData = pokemon.heldItemManager.heldItems[this.type]?.data as BASE_STAT_FLAT_DATA; if (!itemData) { return false; } const statModifier = itemData.statModifier; + const stats = itemData.stats; const baseStats = params.baseStats; // Modifies the passed in baseStats[] array by a flat value, only if the stat is specified in this.stats baseStats.forEach((v, i) => { - if (this.stats.includes(i)) { + if (stats.includes(i)) { const newVal = Math.floor(v + statModifier); baseStats[i] = Math.min(Math.max(newVal, 1), 999999); } diff --git a/src/items/held-items/base-stat-total.ts b/src/items/held-items/base-stat-total.ts index 3b85a002e65..59bc10e3cc3 100644 --- a/src/items/held-items/base-stat-total.ts +++ b/src/items/held-items/base-stat-total.ts @@ -63,7 +63,7 @@ export class BaseStatTotalHeldItem extends HeldItem { */ apply(params: BASE_STAT_TOTAL_PARAMS): boolean { const pokemon = params.pokemon; - const itemData = pokemon.heldItemManager.heldItems[this.type].data; + const itemData = pokemon.heldItemManager.heldItems[this.type]?.data as BASE_STAT_TOTAL_DATA; if (!itemData) { return false; }