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

# Class PostDamageForceSwitchAbAttr

Ability attribute for forcing a Pokémon to switch out after its health drops below half. This attribute checks various conditions related to the damage received, the moves used by the Pokémon and its opponents, and determines whether a forced switch-out should occur.

Used by Wimp Out and Emergency Exit

#### See

`applyPostDamage`

#### Hierarchy (View Summary)

- PostDamageAbAttr
  - PostDamageForceSwitchAbAttr

- Defined in src/data/ability.ts:5570

##### Index

### Constructors

constructor

### Properties

showAbility

### Methods

addCondition
apply
applyPostDamage
canApply
canApplyPostDamage
getCondition
getTriggerMessage

## Constructors

### constructor

- new PostDamageForceSwitchAbAttr(hpRatio?: number): PostDamageForceSwitchAbAttr

  #### Parameters

  - hpRatio: number = 0.5

  #### Returns PostDamageForceSwitchAbAttr

  Overrides PostDamageAbAttr.constructor

  - Defined in src/data/ability.ts:5574

## Properties

### showAbility

showAbility: boolean

Inherited from PostDamageAbAttr.showAbility

- Defined in src/data/ability.ts:184

## Methods

### addCondition

- addCondition(condition: AbAttrCondition): AbAttr

  #### Parameters

  - condition: AbAttrCondition

  #### Returns AbAttr

  Inherited from PostDamageAbAttr.addCondition

  - Defined in src/data/ability.ts:209

### apply

- apply(
  pokemon: default ,
  passive: boolean,
  simulated: boolean,
  cancelled: null | BooleanHolder ,
  args: any[],
  ): void

  Applies ability effects without checking conditions

  #### Parameters

  - pokemon: default

    The pokemon to apply this ability to

  - passive: boolean

    Whether or not the ability is a passive

  - simulated: boolean

    Whether the call is simulated

  - cancelled: null | BooleanHolder
  - args: any[]

    Extra args passed to the function. Handled by child classes.

  #### Returns void

  #### See

  `canApply`

  Inherited from PostDamageAbAttr.apply

  - Defined in src/data/ability.ts:199

### applyPostDamage

- applyPostDamage(
  pokemon: default ,
  damage: number,
  passive: boolean,
  simulated: boolean,
  args: any[],
  source?: default ,
  ): void

  Applies the switch-out logic after the Pokémon takes damage. Checks various conditions based on the moves used by the Pokémon, the opponents' moves, and the Pokémon's health after damage to determine whether the switch-out should occur.

  #### Parameters

  - pokemon: default

    The Pokémon that took damage.

  - damage: number

    N/A

  - passive: boolean

    N/A

  - simulated: boolean

    Whether the ability is being simulated.

  - args: any[]

    N/A

  - `Optional` source: default

    N/A

  #### Returns void

  Overrides PostDamageAbAttr.applyPostDamage

  - Defined in src/data/ability.ts:5645

### canApply

- canApply(
  pokemon: default ,
  passive: boolean,
  simulated: boolean,
  args: any[],
  ): boolean

  Returns a boolean describing whether the ability can be applied under current conditions

  #### Parameters

  - pokemon: default

    The pokemon to apply this ability to

  - passive: boolean

    Whether or not the ability is a passive

  - simulated: boolean

    Whether the call is simulated

  - args: any[]

    Extra args passed to the function. Handled by child classes.

  #### Returns boolean

  `true` if the ability can be applied, `false` otherwise

  #### See

  `apply`

  Inherited from PostDamageAbAttr.canApply

  - Defined in src/data/ability.ts:223

### canApplyPostDamage

- canApplyPostDamage(
  pokemon: default ,
  damage: number,
  passive: boolean,
  simulated: boolean,
  args: any[],
  source?: default ,
  ): boolean

  #### Parameters

  - pokemon: default
  - damage: number
  - passive: boolean
  - simulated: boolean
  - args: any[]
  - `Optional` source: default

  #### Returns boolean

  Overrides PostDamageAbAttr.canApplyPostDamage

  - Defined in src/data/ability.ts:5579

### getCondition

- getCondition(): null | AbAttrCondition

  #### Returns null | AbAttrCondition

  Inherited from PostDamageAbAttr.getCondition

  - Defined in src/data/ability.ts:205

### getTriggerMessage

- getTriggerMessage(
  _pokemon: default ,
  _abilityName: string,
  ..._args: any[],
  ): null | string

  #### Parameters

  - _pokemon: default
  - _abilityName: string
  - ..._args: any[]

  #### Returns null | string

  Inherited from PostDamageAbAttr.getTriggerMessage

  - Defined in src/data/ability.ts:201