From 942bcacb56a5e3d6364c408a124e09a16a6a4c23 Mon Sep 17 00:00:00 2001 From: Wlowscha <54003515+Wlowscha@users.noreply.github.com> Date: Fri, 28 Feb 2025 22:22:22 +0100 Subject: [PATCH] =?UTF-8?q?[Bug][Hotfix]=20Restrict=20Use=20Candies=20opti?= =?UTF-8?q?on=20in=20the=20Pok=C3=A9dex=20during=20Shop=20(#5446)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package-lock.json | 4 ++-- package.json | 2 +- src/ui/pokedex-page-ui-handler.ts | 11 +++++++++-- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index c6dfdd7be04..d31469f4a45 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "pokemon-rogue-battle", - "version": "1.7.4", + "version": "1.7.5", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "pokemon-rogue-battle", - "version": "1.7.4", + "version": "1.7.5", "hasInstallScript": true, "dependencies": { "@material/material-color-utilities": "^0.2.7", diff --git a/package.json b/package.json index 19f64b56157..1953b886c80 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "pokemon-rogue-battle", "private": true, - "version": "1.7.4", + "version": "1.7.5", "type": "module", "scripts": { "start": "vite", diff --git a/src/ui/pokedex-page-ui-handler.ts b/src/ui/pokedex-page-ui-handler.ts index 99b25c3c383..49bb52dddbb 100644 --- a/src/ui/pokedex-page-ui-handler.ts +++ b/src/ui/pokedex-page-ui-handler.ts @@ -250,6 +250,8 @@ export default class PokedexPageUiHandler extends MessageUiHandler { private availableVariants: number; private unlockedVariants: boolean[]; + private canUseCandies: boolean; + constructor() { super(Mode.POKEDEX_PAGE); } @@ -556,6 +558,9 @@ export default class PokedexPageUiHandler extends MessageUiHandler { show(args: any[]): boolean { + // Allow the use of candies if we are in one of the whitelisted phases + this.canUseCandies = [ "TitlePhase", "SelectStarterPhase", "CommandPhase" ].includes(globalScene.getCurrentPhase()?.constructor.name ?? ""); + if (args.length >= 1 && args[0] === "refresh") { return false; } else { @@ -1626,7 +1631,7 @@ export default class PokedexPageUiHandler extends MessageUiHandler { } break; case Button.STATS: - if (!isCaught || !isFormCaught) { + if (!isCaught || !isFormCaught || !this.canUseCandies) { error = true; } else { const ui = this.getUi(); @@ -1888,7 +1893,9 @@ export default class PokedexPageUiHandler extends MessageUiHandler { if (this.isCaught()) { if (isFormCaught) { - this.updateButtonIcon(SettingKeyboard.Button_Stats, gamepadType, this.candyUpgradeIconElement, this.candyUpgradeLabel); + if (this.canUseCandies) { + this.updateButtonIcon(SettingKeyboard.Button_Stats, gamepadType, this.candyUpgradeIconElement, this.candyUpgradeLabel); + } if (this.canCycleShiny) { this.updateButtonIcon(SettingKeyboard.Button_Cycle_Shiny, gamepadType, this.shinyIconElement, this.shinyLabel); }