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

# Class LearnMovePhase

#### Hierarchy (View Summary)

- PlayerPartyMemberPokemonPhase
  - LearnMovePhase

- Defined in src/phases/learn-move-phase.ts:26

##### Index

### Constructors

constructor

### Properties

fieldIndex
partyMemberIndex
player

### Methods

end
executeForAll
forgetMoveProcess
getParty
getPlayerPokemon
getPokemon
hideEnemyTrainer
learnMove
rejectMoveAndEnd
replaceMoveCheck
showEnemyTrainer
start

## Constructors

### constructor

- new LearnMovePhase(
  partyMemberIndex: number,
  moveId: Moves ,
  learnMoveType?: LearnMoveType ,
  cost?: number,
  ): LearnMovePhase

  #### Parameters

  - partyMemberIndex: number
  - moveId: Moves
  - learnMoveType: LearnMoveType = LearnMoveType.LEARN_MOVE
  - cost: number = -1

  #### Returns LearnMovePhase

  Overrides PlayerPartyMemberPokemonPhase.constructor

  - Defined in src/phases/learn-move-phase.ts:32

## Properties

### `Protected` fieldIndex

fieldIndex: number

Inherited from PlayerPartyMemberPokemonPhase.fieldIndex

- Defined in src/phases/party-member-pokemon-phase.ts:7

### `Protected` partyMemberIndex

partyMemberIndex: number

Inherited from PlayerPartyMemberPokemonPhase.partyMemberIndex

- Defined in src/phases/party-member-pokemon-phase.ts:6

### `Protected` player

player: boolean

Inherited from PlayerPartyMemberPokemonPhase.player

- Defined in src/phases/party-member-pokemon-phase.ts:8

## Methods

### end

- end(): void

  #### Returns void

  Inherited from PlayerPartyMemberPokemonPhase.end

  - Defined in src/phase.ts:6

### executeForAll

- executeForAll(func: PokemonFunc): void

  #### Parameters

  - func: PokemonFunc

  #### Returns void

  Inherited from PlayerPartyMemberPokemonPhase.executeForAll

  - Defined in src/phases/field-phase.ts:8

### forgetMoveProcess

- forgetMoveProcess(move: default , pokemon: default ): Promise<void>

  This facilitates the process in which an old move is chosen to be forgotten.

  > Which move should be forgotten?

  The game then goes `Mode.SUMMARY` to select a move to be forgotten. If a player does not select a move or chooses the new move (`moveIndex === 4`), the game goes to `this.rejectMoveAndEnd()`. If an old move is selected, the function then passes the `moveIndex` to `this.learnMove()`

  #### Parameters

  - move: default

    The Move to be learned

  - pokemon: default

  #### Returns Promise<void>

  - Defined in src/phases/learn-move-phase.ts:114

### getParty

- getParty(): default []

  #### Returns default []

  Inherited from PlayerPartyMemberPokemonPhase.getParty

  - Defined in src/phases/party-member-pokemon-phase.ts:18

### getPlayerPokemon

- getPlayerPokemon(): PlayerPokemon

  #### Returns PlayerPokemon

  Inherited from PlayerPartyMemberPokemonPhase.getPlayerPokemon

  - Defined in src/phases/player-party-member-pokemon-phase.ts:9

### getPokemon

- getPokemon(): default

  #### Returns default

  Inherited from PlayerPartyMemberPokemonPhase.getPokemon

  - Defined in src/phases/party-member-pokemon-phase.ts:22

### hideEnemyTrainer

- hideEnemyTrainer(): void

  #### Returns void

  Inherited from PlayerPartyMemberPokemonPhase.hideEnemyTrainer

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

### learnMove

- learnMove(
  index: number,
  move: default ,
  pokemon: default ,
  textMessage?: string,
  ): Promise<void>

  This teaches the Pokemon the new move and ends the phase. When a Pokemon forgets a move and learns a new one, its 'Learn Move' message is significantly longer.

  Pokemon with a `moveset.length < 4`

  > [Pokemon] learned [MoveName]

  Pokemon with a `moveset.length > 4`

  > 1... 2... and 3... and Poof! [Pokemon] forgot how to use [MoveName] And... [Pokemon] learned [MoveName]!

  #### Parameters

  - index: number
  - move: default

    The Move to be learned

  - pokemon: default
  - `Optional` textMessage: string

  #### Returns Promise<void>

  - Defined in src/phases/learn-move-phase.ts:192

### rejectMoveAndEnd

- rejectMoveAndEnd(move: default , pokemon: default ): Promise<void>

  This asks the player if they wish to end the current move learning process.

  > Stop trying to teach [MoveName]? --> `Mode.CONFIRM` --> Yes: > [Pokemon] did not learn the move [MoveName], No: `this.replaceMoveCheck()`

  If the player wishes to not teach the Pokemon the move, it displays a message and ends the phase. If the player reconsiders, it repeats the process for a Pokemon with a full moveset once again.

  #### Parameters

  - move: default

    The Move to be learned

  - pokemon: default

  #### Returns Promise<void>

  - Defined in src/phases/learn-move-phase.ts:149

### replaceMoveCheck

- replaceMoveCheck(move: default , pokemon: default ): Promise<void>

  This displays a chain of messages (listed below) and asks if the user wishes to forget a move.

  > [Pokemon] wants to learn the move [MoveName] However, [Pokemon] already knows four moves. Should a move be forgotten and replaced with [MoveName]? --> `Mode.CONFIRM` -> Yes: Go to `this.forgetMoveProcess()`, No: Go to `this.rejectMoveAndEnd()`

  #### Parameters

  - move: default

    The Move to be learned

  - pokemon: default

  #### Returns Promise<void>

  - Defined in src/phases/learn-move-phase.ts:78

### showEnemyTrainer

- showEnemyTrainer(trainerSlot?: TrainerSlot ): void

  #### Parameters

  - trainerSlot: TrainerSlot = TrainerSlot.NONE

  #### Returns void

  Inherited from PlayerPartyMemberPokemonPhase.showEnemyTrainer

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

### start

- start(): void

  #### Returns void

  Overrides PlayerPartyMemberPokemonPhase.start

  - Defined in src/phases/learn-move-phase.ts:44