[Refactor] Move enum BattleStyle into separated file (#1906)

* Move enum BattleStyle into separated file

* Move enum BattleStyle into separated file

* Move enum BattleStyle into separated file

* Update battle-style.ts

* Replace shift into switch
This commit is contained in:
hayuna 2024-06-13 16:10:31 +02:00 committed by GitHub
parent a85a2a9b8b
commit c929bbd23a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 14 additions and 3 deletions

View File

@ -63,6 +63,7 @@ import { Abilities } from "./data/enums/abilities";
import ArenaFlyout from "./ui/arena-flyout";
import { EaseType } from "./ui/enums/ease-type";
import { ExpNotification } from "./enums/exp-notification";
import { BattleStyle } from "./enums/battle-style";
export const bypassLogin = import.meta.env.VITE_BYPASS_LOGIN === "1";
@ -156,10 +157,10 @@ export default class BattleScene extends SceneBase {
public enableVibration: boolean = false;
/**
* Determines the selected battle style.
* - 0 = 'Shift'
* - 0 = 'Switch'
* - 1 = 'Set' - The option to switch the active pokemon at the start of a battle will not display.
*/
public battleStyle: integer = 0;
public battleStyle: integer = BattleStyle.SWITCH;
/**
* Defines whether or not to show type effectiveness hints

View File

@ -0,0 +1,9 @@
/**
* Determines the selected battle style.
* - 'Switch' - The option to switch the active pokemon at the start of a battle will be displayed.
* - 'Set' - The option to switch the active pokemon at the start of a battle will not display.
*/
export enum BattleStyle {
SWITCH,
SET
}

View File

@ -64,6 +64,7 @@ import { TextStyle, addTextObject } from "./ui/text";
import { Type } from "./data/type";
import { BerryUsedEvent, EncounterPhaseEvent, MoveUsedEvent, TurnEndEvent, TurnInitEvent } from "./events/battle-scene";
import { ExpNotification } from "./enums/exp-notification";
import { BattleStyle } from "./enums/battle-style";
export class LoginPhase extends Phase {
@ -1747,7 +1748,7 @@ export class CheckSwitchPhase extends BattlePhase {
const pokemon = this.scene.getPlayerField()[this.fieldIndex];
if (this.scene.battleStyle === 1) {
if (this.scene.battleStyle === BattleStyle.SET) {
super.end();
return;
}