From 90bc14c6673a18729a3fc209ad0ece5bb881eba8 Mon Sep 17 00:00:00 2001 From: Wlowscha <54003515+Wlowscha@users.noreply.github.com> Date: Fri, 20 Jun 2025 08:51:21 +0200 Subject: [PATCH] Fixed berries, removed some debug messages --- src/items/held-items/berry.ts | 4 ++++ src/phases/berry-phase.ts | 3 +-- src/phases/select-modifier-phase.ts | 1 - src/ui/modifier-select-ui-handler.ts | 18 ------------------ 4 files changed, 5 insertions(+), 21 deletions(-) diff --git a/src/items/held-items/berry.ts b/src/items/held-items/berry.ts index d9d1f17ddfc..2d6bca55f03 100644 --- a/src/items/held-items/berry.ts +++ b/src/items/held-items/berry.ts @@ -72,6 +72,10 @@ export class BerryHeldItem extends ConsumableHeldItem { apply(params: BERRY_PARAMS): boolean { const pokemon = params.pokemon; + if (!this.shouldApply(pokemon)) { + return false; + } + const preserve = new BooleanHolder(false); globalScene.applyModifiers(PreserveBerryModifier, pokemon.isPlayer(), pokemon, preserve); const consumed = !preserve.value; diff --git a/src/phases/berry-phase.ts b/src/phases/berry-phase.ts index a4d63cf769e..0441f39bec0 100644 --- a/src/phases/berry-phase.ts +++ b/src/phases/berry-phase.ts @@ -33,8 +33,7 @@ export class BerryPhase extends FieldPhase { */ eatBerries(pokemon: Pokemon): void { const hasUsableBerry = pokemon.getHeldItems().some(m => { - //TODO: This is bugged, must fix the .shouldApply() function - isItemInCategory(m, HeldItemCategoryId.BERRY) && allHeldItems[m].shouldApply(pokemon); + return isItemInCategory(m, HeldItemCategoryId.BERRY) && allHeldItems[m].shouldApply(pokemon); }); if (!hasUsableBerry) { diff --git a/src/phases/select-modifier-phase.ts b/src/phases/select-modifier-phase.ts index e6aa1d4d1fb..039ea31c45f 100644 --- a/src/phases/select-modifier-phase.ts +++ b/src/phases/select-modifier-phase.ts @@ -475,7 +475,6 @@ export class SelectModifierPhase extends BattlePhase { } getModifierTypeOptions(modifierCount: number): ModifierTypeOption[] { - console.log("HERE WE ARE", modifierCount, this.customModifierSettings); return getPlayerModifierTypeOptions( modifierCount, globalScene.getPlayerParty(), diff --git a/src/ui/modifier-select-ui-handler.ts b/src/ui/modifier-select-ui-handler.ts index 32a5fca713e..9db15e8fb84 100644 --- a/src/ui/modifier-select-ui-handler.ts +++ b/src/ui/modifier-select-ui-handler.ts @@ -219,7 +219,6 @@ export default class ModifierSelectUiHandler extends AwaitableUiHandler { : []; const optionsYOffset = shopTypeOptions.length > SHOP_OPTIONS_ROW_LIMIT ? -SINGLE_SHOP_ROW_YOFFSET : -DOUBLE_SHOP_ROW_YOFFSET; - console.log("ui_shop_options", shopTypeOptions); for (let m = 0; m < typeOptions.length; m++) { const sliceWidth = globalScene.game.canvas.width / 6 / (typeOptions.length + 2); @@ -233,7 +232,6 @@ export default class ModifierSelectUiHandler extends AwaitableUiHandler { this.modifierContainer.add(option); this.options.push(option); } - console.log("ui_options", this.options); // Set "Continue" button height based on number of rows in healing items shop const continueButton = this.continueButtonContainer.getAt(0); @@ -296,20 +294,14 @@ export default class ModifierSelectUiHandler extends AwaitableUiHandler { }, }); - console.log("maxUpgradeCount", maxUpgradeCount); - globalScene.time.delayedCall(1000 + maxUpgradeCount * 2000, () => { - console.log("delayed1", partyHasHeldItem); for (const shopOption of this.shopOptionsRows.flat()) { - console.log("uishop", shopOption); shopOption.show(0, 0); } }); globalScene.time.delayedCall(4000 + maxUpgradeCount * 2000, () => { - console.log("delayed2", partyHasHeldItem); if (partyHasHeldItem) { - console.log("uihelditem", partyHasHeldItem); this.transferButtonContainer.setAlpha(0); this.transferButtonContainer.setVisible(true); globalScene.tweens.add({ @@ -364,8 +356,6 @@ export default class ModifierSelectUiHandler extends AwaitableUiHandler { }); }); - console.log("ui_end"); - return true; } @@ -779,7 +769,6 @@ class ModifierOption extends Phaser.GameObjects.Container { this.add(this.itemContainer); const getItem = () => { - console.log("SHOWING ICON", this.modifierTypeOption.type?.name, this.modifierTypeOption.type?.getIcon()); const item = globalScene.add.sprite(0, 0, "items", this.modifierTypeOption.type?.getIcon()); return item; }; @@ -815,7 +804,6 @@ class ModifierOption extends Phaser.GameObjects.Container { } show(remainingDuration: number, upgradeCountOffset: number) { - console.log("mo1"); if (!this.modifierTypeOption.cost) { globalScene.tweens.add({ targets: this.pb, @@ -823,7 +811,6 @@ class ModifierOption extends Phaser.GameObjects.Container { duration: 1250, ease: "Bounce.Out", }); - console.log("mo2"); let lastValue = 1; let bounceCount = 0; @@ -850,7 +837,6 @@ class ModifierOption extends Phaser.GameObjects.Container { lastValue = value; }, }); - console.log("mo3"); for (let u = 0; u < this.modifierTypeOption.upgradeCount; u++) { const upgradeIndex = u; @@ -888,14 +874,12 @@ class ModifierOption extends Phaser.GameObjects.Container { }, ); } - console.log("mo4"); } globalScene.time.delayedCall(remainingDuration + 2000, () => { if (!globalScene) { return; } - console.log("mo5"); if (!this.modifierTypeOption.cost) { this.pb.setTexture("pb", `${this.getPbAtlasKey(0)}_open`); @@ -910,7 +894,6 @@ class ModifierOption extends Phaser.GameObjects.Container { onComplete: () => this.pb.destroy(), }); } - console.log("mo6"); globalScene.tweens.add({ targets: this.itemContainer, @@ -945,7 +928,6 @@ class ModifierOption extends Phaser.GameObjects.Container { }); } }); - console.log("mo_end"); } getPbAtlasKey(tierOffset = 0) {