# SwitchPhase | pokemon-rogue-battle
Documentation for pokemon-rogue-battle

# Class SwitchPhase

Opens the party selector UI and transitions into a `SwitchSummonPhase` for the player (if a switch would be valid for the current battle state).

#### Hierarchy (View Summary)

- BattlePhase
  - SwitchPhase

- Defined in src/phases/switch-phase.ts:13

##### Index

### Constructors

constructor

### Properties

fieldIndex

### Methods

end
hideEnemyTrainer
showEnemyTrainer
start

## Constructors

### constructor

- new SwitchPhase(
  switchType: SwitchType ,
  fieldIndex: number,
  isModal: boolean,
  doReturn: boolean,
  ): SwitchPhase

  Creates a new SwitchPhase

  #### Parameters

  - switchType: SwitchType

    `SwitchType` The type of switch logic this phase implements

  - fieldIndex: number

    Field index to switch out

  - isModal: boolean

    Indicates if the switch should be forced (true) or is optional (false).

  - doReturn: boolean

    Indicates if the party member on the field should be recalled to ball or has already left the field. Passed to `SwitchSummonPhase`.

  #### Returns SwitchPhase

  Overrides BattlePhase.constructor

  - Defined in src/phases/switch-phase.ts:28

## Properties

### `Protected` `Readonly` fieldIndex

fieldIndex: number

- Defined in src/phases/switch-phase.ts:14

## Methods

### end

- end(): void

  #### Returns void

  Inherited from BattlePhase.end

  - Defined in src/phase.ts:6

### hideEnemyTrainer

- hideEnemyTrainer(): void

  #### Returns void

  Inherited from BattlePhase.hideEnemyTrainer

  - Defined in src/phases/battle-phase.ts:37

### showEnemyTrainer

- showEnemyTrainer(trainerSlot?: TrainerSlot ): void

  #### Parameters

  - trainerSlot: TrainerSlot = TrainerSlot.NONE

  #### Returns void

  Inherited from BattlePhase.showEnemyTrainer

  - Defined in src/phases/battle-phase.ts:10

### start

- start(): void

  #### Returns void

  Overrides BattlePhase.start

  - Defined in src/phases/switch-phase.ts:37