mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-09-23 06:53:27 +02:00
- Adding throw ball and reset battle command.
- Adding throw ball and reset battle command.
This commit is contained in:
parent
405dc89399
commit
7f02a04f0b
@ -271,6 +271,7 @@ export class BattleScene extends SceneBase {
|
||||
public lastEnemyTrainer: Trainer | null;
|
||||
public currentBattle: Battle;
|
||||
public pokeballCounts: PokeballCounts;
|
||||
public lastPokeballType: PokeballType = PokeballType.POKEBALL;
|
||||
public money: number;
|
||||
public pokemonInfoContainer: PokemonInfoContainer;
|
||||
private party: PlayerPokemon[];
|
||||
|
@ -56,6 +56,7 @@ export class AttemptCapturePhase extends PokemonPhase {
|
||||
}
|
||||
|
||||
globalScene.pokeballCounts[this.pokeballType]--;
|
||||
globalScene.lastUsedPokeball = this.pokeballType;
|
||||
|
||||
this.originalY = pokemon.y;
|
||||
|
||||
|
@ -13,6 +13,7 @@ import { SettingsDisplayUiHandler } from "#ui/settings-display-ui-handler";
|
||||
import { SettingsGamepadUiHandler } from "#ui/settings-gamepad-ui-handler";
|
||||
import { SettingsKeyboardUiHandler } from "#ui/settings-keyboard-ui-handler";
|
||||
import { SettingsUiHandler } from "#ui/settings-ui-handler";
|
||||
import { CommandUiHandler } from "#ui/handlers/command-ui-handler";
|
||||
import Phaser from "phaser";
|
||||
|
||||
type ActionKeys = Record<Button, () => void>;
|
||||
@ -213,6 +214,7 @@ export class UiInputs {
|
||||
SettingsAudioUiHandler,
|
||||
SettingsGamepadUiHandler,
|
||||
SettingsKeyboardUiHandler,
|
||||
CommandUiHandler
|
||||
];
|
||||
const uiHandler = globalScene.ui?.getHandler();
|
||||
if (whitelist.some(handler => uiHandler instanceof handler)) {
|
||||
|
@ -13,6 +13,7 @@ import { PartyUiHandler, PartyUiMode } from "#ui/handlers/party-ui-handler";
|
||||
import { UiHandler } from "#ui/handlers/ui-handler";
|
||||
import { addTextObject } from "#ui/text";
|
||||
import i18next from "i18next";
|
||||
import { BattleType } from "../../enums/battle-type";
|
||||
|
||||
export class CommandUiHandler extends UiHandler {
|
||||
private commandsContainer: Phaser.GameObjects.Container;
|
||||
@ -187,6 +188,58 @@ export class CommandUiHandler extends UiHandler {
|
||||
this.toggleTeraButton();
|
||||
}
|
||||
break;
|
||||
case Button.CYCLE_SHINY:
|
||||
const commandPhase = globalScene.phaseManager.getCurrentPhase() as CommandPhase;
|
||||
if (globalScene.pokeballCounts[globalScene.lastPokeballType]) {
|
||||
if (commandPhase.handleCommand(Command.BALL, globalScene.lastPokeballType)) {
|
||||
globalScene.ui.setMode(UiMode.COMMAND, commandPhase.getFieldIndex());
|
||||
globalScene.ui.setMode(UiMode.MESSAGE);
|
||||
success = true;
|
||||
}
|
||||
} else {
|
||||
ui.playError();
|
||||
}
|
||||
break;
|
||||
case Button.CYCLE_ABILITY:
|
||||
globalScene.ui.setMode(UiMode.MESSAGE)
|
||||
globalScene.ui.showText(i18next.t("battle:retryBattle"), null, () => {
|
||||
globalScene.ui.setMode(
|
||||
UiMode.CONFIRM,
|
||||
() => {
|
||||
globalScene.ui.fadeOut(1250).then(() => {
|
||||
globalScene.reset();
|
||||
globalScene.phaseManager.clearPhaseQueue();
|
||||
globalScene.gameData.loadSession(globalScene.sessionSlotId).then(() => {
|
||||
globalScene.phaseManager.pushNew("EncounterPhase", true);
|
||||
|
||||
const availablePartyMembers = globalScene.getPokemonAllowedInBattle().length;
|
||||
|
||||
globalScene.phaseManager.pushNew("SummonPhase", 0);
|
||||
if (globalScene.currentBattle.double && availablePartyMembers > 1) {
|
||||
globalScene.phaseManager.pushNew("SummonPhase", 1);
|
||||
}
|
||||
if (
|
||||
globalScene.currentBattle.waveIndex > 1 &&
|
||||
globalScene.currentBattle.battleType !== BattleType.TRAINER
|
||||
) {
|
||||
globalScene.phaseManager.pushNew("CheckSwitchPhase", 0, globalScene.currentBattle.double);
|
||||
if (globalScene.currentBattle.double && availablePartyMembers > 1) {
|
||||
globalScene.phaseManager.pushNew("CheckSwitchPhase", 1, globalScene.currentBattle.double);
|
||||
}
|
||||
}
|
||||
globalScene.ui.fadeIn(1250);
|
||||
globalScene.phaseManager.shiftPhase();
|
||||
});
|
||||
});
|
||||
},
|
||||
() => { globalScene.ui.setMode(UiMode.COMMAND)},
|
||||
false,
|
||||
0,
|
||||
0,
|
||||
1000,
|
||||
);
|
||||
});
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user