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

# Class MovePhase

#### Hierarchy (View Summary)

- BattlePhase
  - MovePhase

- Defined in src/phases/move-phase.ts:53

##### Index

### Constructors

constructor

### Properties

_move
_pokemon
_targets
cancelled
failed
followUp
forcedLast
ignorePp
reflected

### Accessors

move
pokemon
targets

### Methods

cancel
canMove
chargeMove
end
fail
getActiveTargetPokemon
getPpIncreaseFromPressure
handlePreMoveFailures
hideEnemyTrainer
isForcedLast
lapsePreMoveAndMoveTags
resolveCounterAttackTarget
resolveFinalPreMoveCancellationChecks
resolvePreMoveStatusEffects
resolveRedirectTarget
showEnemyTrainer
showFailedText
showMoveText
start
useMove

## Constructors

### constructor

- new MovePhase(
  pokemon: default ,
  targets: BattlerIndex [],
  move: PokemonMove ,
  followUp?: boolean,
  ignorePp?: boolean,
  reflected?: boolean,
  forcedLast?: boolean,
  ): MovePhase

  #### Parameters

  - pokemon: default
  - targets: BattlerIndex []
  - move: PokemonMove
  - followUp: boolean = false

    Indicates that the move being used is a "follow-up" - for example, a move being used by Metronome or Dancer. Follow-ups bypass a few failure conditions, including flinches, sleep/paralysis/freeze and volatile status checks, etc.

  - ignorePp: boolean = false
  - reflected: boolean = false

    Indicates that the move was reflected by Magic Coat or Magic Bounce. Reflected moves cannot be reflected again and will not trigger Dancer.

  - forcedLast: boolean = false

  #### Returns MovePhase

  Overrides BattlePhase.constructor

  - Defined in src/phases/move-phase.ts:95

## Properties

### `Protected`_move

_move: PokemonMove

- Defined in src/phases/move-phase.ts:55

### `Protected`_pokemon

_pokemon: default

- Defined in src/phases/move-phase.ts:54

### `Protected`_targets

_targets: BattlerIndex []

- Defined in src/phases/move-phase.ts:56

### `Protected` cancelled

cancelled: boolean = false

- Defined in src/phases/move-phase.ts:61

### `Protected` failed

failed: boolean = false

- Defined in src/phases/move-phase.ts:60

### `Protected` followUp

followUp: boolean

- Defined in src/phases/move-phase.ts:57

### `Protected` forcedLast

forcedLast: boolean

- Defined in src/phases/move-phase.ts:59

### `Protected` ignorePp

ignorePp: boolean

- Defined in src/phases/move-phase.ts:58

### `Protected` reflected

reflected: boolean = false

- Defined in src/phases/move-phase.ts:62

## Accessors

### move

- get move(): PokemonMove

  #### Returns PokemonMove

  - Defined in src/phases/move-phase.ts:72
- set move(move: PokemonMove ): void

  #### Parameters

  - move: PokemonMove

  #### Returns void

  - Defined in src/phases/move-phase.ts:76

### pokemon

- get pokemon(): default

  #### Returns default

  - Defined in src/phases/move-phase.ts:64
- set pokemon(pokemon: default ): void

  #### Parameters

  - pokemon: default

  #### Returns void

  - Defined in src/phases/move-phase.ts:68

### targets

- get targets(): BattlerIndex []

  #### Returns BattlerIndex []

  - Defined in src/phases/move-phase.ts:80
- set targets(targets: BattlerIndex []): void

  #### Parameters

  - targets: BattlerIndex []

  #### Returns void

  - Defined in src/phases/move-phase.ts:84

## Methods

### cancel

- cancel(): void

  Signifies the current move should cancel and retain PP

  #### Returns void

  - Defined in src/phases/move-phase.ts:134

### canMove

- canMove(ignoreDisableTags?: boolean): boolean

  Checks if the pokemon is active, if the move is usable, and that the move is targetting something.

  #### Parameters

  - ignoreDisableTags: boolean = false

    `true` to not check if the move is disabled

  #### Returns boolean

  `true` if all the checks pass

  - Defined in src/phases/move-phase.ts:120

### `Protected` chargeMove

- chargeMove(): void

  Queues a `MoveChargePhase` for this phase's invoked move.

  #### Returns void

  - Defined in src/phases/move-phase.ts:440

### end

- end(): void

  Queues a `MoveEndPhase` if the move wasn't a `followUp` and `()` returns `true`, then ends the phase.

  #### Returns void

  Overrides BattlePhase.end

  - Defined in src/phases/move-phase.ts:471

### fail

- fail(): void

  Signifies the current move should fail but still use PP

  #### Returns void

  - Defined in src/phases/move-phase.ts:129

### getActiveTargetPokemon

- getActiveTargetPokemon(): default []

  #### Returns default []

  - Defined in src/phases/move-phase.ts:211

### getPpIncreaseFromPressure

- getPpIncreaseFromPressure(targets: default []): number

  Applies PP increasing abilities (currently only Pressure) if they exist on the target pokemon. Note that targets must include only active pokemon.

  TODO: This hardcodes the PP increase at 1 per opponent, rather than deferring to the ability.

  #### Parameters

  - targets: default []

  #### Returns number

  - Defined in src/phases/move-phase.ts:485

### `Protected` handlePreMoveFailures

- handlePreMoveFailures(): void

  Handles the case where the move was cancelled or failed:

  - Uses PP if the move failed (not cancelled) and should use PP (failed moves are not affected by Pressure)
  - Records a cancelled OR failed move in move history, so abilities like Truant don't trigger on the next turn and soft-lock.
  - Lapses `MOVE_EFFECT` tags:

    - Semi-invulnerable battler tags (Fly/Dive/etc.) are intended to lapse on move effects, but also need to lapse on move failure/cancellation.

      TODO: ...this seems weird.

  - Lapses `AFTER_MOVE` tags:
    - This handles the effects of Substitute
  - Removes the second turn of charge moves

  #### Returns void

  - Defined in src/phases/move-phase.ts:600

### hideEnemyTrainer

- hideEnemyTrainer(): void

  #### Returns void

  Inherited from BattlePhase.hideEnemyTrainer

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

### isForcedLast

- isForcedLast(): boolean

  Shows whether the current move has been forced to the end of the turn Needed for speed order, see `Moves.QUASH`

  #### Returns boolean

  - Defined in src/phases/move-phase.ts:142

### `Protected` lapsePreMoveAndMoveTags

- lapsePreMoveAndMoveTags(): void

  Lapse `PRE_MOVE` tags that trigger before a move is used, regardless of whether or not it failed. Also lapse `MOVE` tags if the move should be successful.

  #### Returns void

  - Defined in src/phases/move-phase.ts:285

### `Protected` resolveCounterAttackTarget

- resolveCounterAttackTarget(): void

  Counter-attacking moves pass in `[` `BattlerIndex.ATTACKER` `]` into the constructor's `targets` param. This function modifies `this.targets` to reflect the actual battler index of the user's last attacker.

  If there is no last attacker, or they are no longer on the field, a message is displayed and the move is marked for failure.

  #### Returns void

  - Defined in src/phases/move-phase.ts:563

### `Protected` resolveFinalPreMoveCancellationChecks

- resolveFinalPreMoveCancellationChecks(): void

  Check for cancellation edge cases - no targets remaining, or `Moves.NONE` is in the queue

  #### Returns void

  - Defined in src/phases/move-phase.ts:200

### `Protected` resolvePreMoveStatusEffects

- resolvePreMoveStatusEffects(): void

  Handles Sleep/Paralysis/Freeze rolls and side effects.

  #### Returns void

  - Defined in src/phases/move-phase.ts:218

### `Protected` resolveRedirectTarget

- resolveRedirectTarget(): void

  Modifies `this.targets` in place, based upon:

  - Move redirection abilities, effects, etc.
  - Counterattacks, which pass a special value into the `targets` constructor param (`[` `BattlerIndex.ATTACKER` `]`).

  #### Returns void

  - Defined in src/phases/move-phase.ts:497

### showEnemyTrainer

- showEnemyTrainer(trainerSlot?: TrainerSlot ): void

  #### Parameters

  - trainerSlot: TrainerSlot = TrainerSlot.NONE

  #### Returns void

  Inherited from BattlePhase.showEnemyTrainer

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

### showFailedText

- showFailedText(failedText?: string): void

  #### Parameters

  - failedText: string = ...

  #### Returns void

  - Defined in src/phases/move-phase.ts:652

### showMoveText

- showMoveText(): void

  Displays the move's usage text to the player, unless it's a charge turn (ie: Solar Beam), the pokemon is on a recharge turn (ie: Hyper Beam), or a 2-turn move was interrupted (ie: Fly).

  #### Returns void

  - Defined in src/phases/move-phase.ts:633

### start

- start(): void

  #### Returns void

  Overrides BattlePhase.start

  - Defined in src/phases/move-phase.ts:146

### `Protected` useMove

- useMove(): void

  #### Returns void

  - Defined in src/phases/move-phase.ts:294