Apply suggestions from code review

- Adding suggestions and fixing the globalscene.lastPokeballType

Co-authored-by: Fabi <192151969+fabske0@users.noreply.github.com>
This commit is contained in:
Brian 2025-09-11 08:45:13 +08:00 committed by GitHub
parent ff6ce9c1a0
commit 4d3c9e799a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 4 deletions

View File

@ -56,7 +56,7 @@ export class AttemptCapturePhase extends PokemonPhase {
} }
globalScene.pokeballCounts[this.pokeballType]--; globalScene.pokeballCounts[this.pokeballType]--;
globalScene.lastUsedPokeball = this.pokeballType; globalScene.lastPokeballType = this.pokeballType;
this.originalY = pokemon.y; this.originalY = pokemon.y;

View File

@ -13,7 +13,7 @@ import { PartyUiHandler, PartyUiMode } from "#ui/handlers/party-ui-handler";
import { UiHandler } from "#ui/handlers/ui-handler"; import { UiHandler } from "#ui/handlers/ui-handler";
import { addTextObject } from "#ui/text"; import { addTextObject } from "#ui/text";
import i18next from "i18next"; import i18next from "i18next";
import { BattleType } from "../../enums/battle-type"; import { BattleType } from "#enums/battle-type";
export class CommandUiHandler extends UiHandler { export class CommandUiHandler extends UiHandler {
private commandsContainer: Phaser.GameObjects.Container; private commandsContainer: Phaser.GameObjects.Container;
@ -188,7 +188,7 @@ export class CommandUiHandler extends UiHandler {
this.toggleTeraButton(); this.toggleTeraButton();
} }
break; break;
case Button.CYCLE_SHINY: case Button.CYCLE_SHINY: // Used to throw the last pokeball
const commandPhase = globalScene.phaseManager.getCurrentPhase() as CommandPhase; const commandPhase = globalScene.phaseManager.getCurrentPhase() as CommandPhase;
if (globalScene.pokeballCounts[globalScene.lastPokeballType]) { if (globalScene.pokeballCounts[globalScene.lastPokeballType]) {
if (commandPhase.handleCommand(Command.BALL, globalScene.lastPokeballType)) { if (commandPhase.handleCommand(Command.BALL, globalScene.lastPokeballType)) {
@ -200,7 +200,7 @@ export class CommandUiHandler extends UiHandler {
ui.playError(); ui.playError();
} }
break; break;
case Button.CYCLE_ABILITY: case Button.CYCLE_ABILITY: // Used to restart the battle
if (globalScene.enableRetries){ if (globalScene.enableRetries){
globalScene.ui.setMode(UiMode.MESSAGE) globalScene.ui.setMode(UiMode.MESSAGE)
globalScene.ui.showText(i18next.t("battle:retryBattle"), null, () => { globalScene.ui.showText(i18next.t("battle:retryBattle"), null, () => {