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

# Class default

Class to manage the game state and transitions between phases.

- Defined in src/test/utils/gameManager.ts:40

#####
Index

### Constructors

constructor

### Properties

gameWrapper
inputsHandler
phaseInterceptor
scene
textInterceptor

### Methods

doAttack
doKillOpponents
doSelectModifier
doSelectTarget
doSwitchPokemon
endPhase
exportSaveToTest
forceOpponentToSwitch
importData
isCurrentMode
isCurrentPhase
isVictory
killPokemon
onNextPrompt
runToSummon
runToTitle
setMode
startBattle
toNextTurn
toNextWave
waitMode

## Constructors

### constructor

- new default(phaserGame, bypassLogin?): default

- Creates an instance of GameManager.

  #### Parameters

  - phaserGame: Game

    The Phaser game instance.

  - bypassLogin: boolean = true

    Whether to bypass the login phase.

  #### Returns default

  - Defined in src/test/utils/gameManager.ts:52

## Properties

### gameWrapper

gameWrapper: default

- Defined in src/test/utils/gameManager.ts:41

### inputsHandler

inputsHandler: default

- Defined in src/test/utils/gameManager.ts:45

### phaseInterceptor

phaseInterceptor: default

- Defined in src/test/utils/gameManager.ts:43

### scene

scene: default

- Defined in src/test/utils/gameManager.ts:42

### textInterceptor

textInterceptor: default

- Defined in src/test/utils/gameManager.ts:44

## Methods

### doAttack

- doAttack(movePosition): void

- Emulate a player attack

  #### Parameters

  - movePosition: number

    the index of the move in the pokemon's moveset array

  #### Returns void

  - Defined in src/test/utils/gameManager.ts:166

### doKillOpponents

- doKillOpponents(): Promise<void>

- Faint all opponents currently on the field

  #### Returns Promise<void>

  - Defined in src/test/utils/gameManager.ts:189

### doSelectModifier

- doSelectModifier(): void

- Emulate selecting a modifier (item)

  #### Returns void

  - Defined in src/test/utils/gameManager.ts:197

### doSelectTarget

- doSelectTarget(targetIndex): void

- Emulate a player's target selection after an attack is chosen, usually called after `doAttack` in a double battle.

  #### Parameters

  - targetIndex: BattlerIndex

    the index of the attack target

  #### Returns void

  - Defined in src/test/utils/gameManager.ts:180

### doSwitchPokemon

- doSwitchPokemon(pokemonIndex): void

- Switch pokemon and transition to the enemy command phase

  #### Parameters

  - pokemonIndex: number

    the index of the pokemon in your party to switch to

  #### Returns void

  - Defined in src/test/utils/gameManager.ts:310

### endPhase

- endPhase(): void

- Ends the current phase.

  #### Returns void

  - Defined in src/test/utils/gameManager.ts:86

### exportSaveToTest

- exportSaveToTest(): Promise<string>

- Exports the save data to import it in a test game.

  #### Returns Promise<string>

  A promise that resolves with the exported save data.

  - Defined in src/test/utils/gameManager.ts:265

### forceOpponentToSwitch

- forceOpponentToSwitch(): void

- #### Returns void

  - Defined in src/test/utils/gameManager.ts:209

### importData

- importData(path): Promise<[boolean, number]>

- Imports game data from a file.

  #### Parameters

  - path: any

    The path to the data file.

  #### Returns Promise<[boolean, number]>

  A promise that resolves with a tuple containing a boolean indicating success and an integer status code.

  - Defined in src/test/utils/gameManager.ts:281

### isCurrentMode

- isCurrentMode(mode): boolean

- Checks if the current mode matches the target mode.

  #### Parameters

  - mode: Mode

    The target mode.

  #### Returns boolean

  True if the current mode matches the target mode, otherwise false.

  - Defined in src/test/utils/gameManager.ts:257

### isCurrentPhase

- isCurrentPhase(phaseTarget): boolean

- Checks if the current phase matches the target phase.

  #### Parameters

  - phaseTarget: any

    The target phase.

  #### Returns boolean

  True if the current phase matches the target phase, otherwise false.

  - Defined in src/test/utils/gameManager.ts:247

### isVictory

- isVictory(): boolean

- Checks if the player has won the battle.

  #### Returns boolean

  True if the player has won, otherwise false.

  - Defined in src/test/utils/gameManager.ts:238

### killPokemon

- killPokemon(pokemon): Promise<void>

- #### Parameters

  - pokemon: PlayerPokemon | EnemyPokemon

  #### Returns Promise<void>

  - Defined in src/test/utils/gameManager.ts:295

### onNextPrompt

- onNextPrompt(phaseTarget, mode, callback, expireFn?, awaitingActionInput?): void

- Adds an action to be executed on the next prompt.

  #### Parameters

  - phaseTarget: string

    The target phase.

  - mode: Mode

    The mode to wait for.

  - callback: (() => void)

    The callback to execute.

    - - (): void

      - #### Returns void

  - `Optional` expireFn: (() => void)

    Optional function to determine if the prompt has expired.

    - - (): void

      - #### Returns void

  - awaitingActionInput: boolean = false

  #### Returns void

  - Defined in src/test/utils/gameManager.ts:97

### runToSummon

- runToSummon(species?): Promise<void>

- Runs the game to the summon phase.

  #### Parameters

  - `Optional` species: Species []

    Optional array of species to summon.

  #### Returns Promise<void>

  A promise that resolves when the summon phase is reached.

  - Defined in src/test/utils/gameManager.ts:126

### runToTitle

- runToTitle(): Promise<void>

- Runs the game to the title phase.

  #### Returns Promise<void>

  A promise that resolves when the title phase is reached.

  - Defined in src/test/utils/gameManager.ts:105

### setMode

- setMode(mode): void

- Sets the game mode.

  #### Parameters

  - mode: Mode

    The mode to set.

  #### Returns void

  - Defined in src/test/utils/gameManager.ts:67

### startBattle

- startBattle(species?): Promise<void>

- Transitions to the start of a battle.

  #### Parameters

  - `Optional` species: Species []

    Optional array of species to start the battle with.

  #### Returns Promise<void>

  A promise that resolves when the battle is started.

  - Defined in src/test/utils/gameManager.ts:145

### toNextTurn

- toNextTurn(): Promise<void>

- Transition to the next upcoming `CommandPhase`

  #### Returns Promise<void>

  - Defined in src/test/utils/gameManager.ts:218

### toNextWave

- toNextWave(): Promise<void>

- Emulate selecting a modifier (item) and transition to the next upcoming `CommandPhase`

  #### Returns Promise<void>

  - Defined in src/test/utils/gameManager.ts:223

### waitMode

- waitMode(mode): Promise<void>

- Waits until the specified mode is set.

  #### Parameters

  - mode: Mode

    The mode to wait for.

  #### Returns Promise<void>

  A promise that resolves when the mode is set.

  - Defined in src/test/utils/gameManager.ts:76