Skip to content

Commit

Permalink
[Bug][Hotfix] Restrict Use Candies option in the Pokédex during Shop (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
Wlowscha authored Feb 28, 2025
1 parent 1342944 commit 942bcac
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "pokemon-rogue-battle",
"private": true,
"version": "1.7.4",
"version": "1.7.5",
"type": "module",
"scripts": {
"start": "vite",
Expand Down
11 changes: 9 additions & 2 deletions src/ui/pokedex-page-ui-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,8 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
private availableVariants: number;
private unlockedVariants: boolean[];

private canUseCandies: boolean;

constructor() {
super(Mode.POKEDEX_PAGE);
}
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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);
}
Expand Down

0 comments on commit 942bcac

Please sign in to comment.