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

# Class ConditionalProtectTag

Class to implement conditional team protection applies protection based on the attributes of incoming moves

#### Hierarchy (View Summary)

- ArenaTag
  - ConditionalProtectTag

- Defined in src/data/arena-tag.ts:300

##### Index

### Constructors

constructor

### Properties

ignoresBypass
protectConditionFunc
side
sourceId?
sourceMove?
tagType
turnCount

### Methods

apply
getAffectedPokemon
getMoveName
getSourcePokemon
lapse
loadTag
onAdd
onOverlap
onRemove

## Constructors

### constructor

- new ConditionalProtectTag(
  tagType: ArenaTagType ,
  sourceMove: Moves ,
  sourceId: number,
  side: ArenaTagSide ,
  condition: ProtectConditionFunc,
  ignoresBypass?: boolean,
  ): ConditionalProtectTag

  #### Parameters

  - tagType: ArenaTagType
  - sourceMove: Moves
  - sourceId: number
  - side: ArenaTagSide
  - condition: ProtectConditionFunc
  - ignoresBypass: boolean = false

  #### Returns ConditionalProtectTag

  Overrides ArenaTag.constructor

  - Defined in src/data/arena-tag.ts:306

## Properties

### `Protected` ignoresBypass

ignoresBypass: boolean

Does this apply to all moves, including those that ignore other forms of protection?

- Defined in src/data/arena-tag.ts:304

### `Protected` protectConditionFunc

protectConditionFunc: ProtectConditionFunc

The condition function to determine which moves are negated

- Defined in src/data/arena-tag.ts:302

### side

side: ArenaTagSide = ArenaTagSide.BOTH

Inherited from ArenaTag.side

- Defined in src/data/arena-tag.ts:46

### `Optional` sourceId

sourceId?: number

Inherited from ArenaTag.sourceId

- Defined in src/data/arena-tag.ts:45

### `Optional` sourceMove

sourceMove?: Moves

Inherited from ArenaTag.sourceMove

- Defined in src/data/arena-tag.ts:44

### tagType

tagType: ArenaTagType

Inherited from ArenaTag.tagType

- Defined in src/data/arena-tag.ts:42

### turnCount

turnCount: number

Inherited from ArenaTag.turnCount

- Defined in src/data/arena-tag.ts:43

## Methods

### apply

- apply(
  arena: Arena ,
  simulated: boolean,
  isProtected: BooleanHolder ,
  attacker: default ,
  defender: default ,
  moveId: Moves ,
  ignoresProtectBypass: BooleanHolder ,
  ): boolean

  Checks incoming moves against the condition function and protects the target if conditions are met

  #### Parameters

  - arena: Arena

    the `Arena` containing this tag

  - simulated: boolean

    `true` if the tag is applied quietly; `false` otherwise.

  - isProtected: BooleanHolder

    a `BooleanHolder` used to flag if the move is protected against

  - attacker: default

    the attacking `Pokemon`

  - defender: default

    the defending `Pokemon`

  - moveId: Moves

    the `identifier` for the move being used

  - ignoresProtectBypass: BooleanHolder

    a `BooleanHolder` used to flag if a protection effect supercedes effects that ignore protection

  #### Returns boolean

  `true` if this tag protected against the attack; `false` otherwise

  Overrides ArenaTag.apply

  - Defined in src/data/arena-tag.ts:344

### getAffectedPokemon

- getAffectedPokemon(): default []

  Helper function that retrieves the Pokemon affected

  #### Returns default []

  list of PlayerPokemon or EnemyPokemon on the field

  Inherited from ArenaTag.getAffectedPokemon

  - Defined in src/data/arena-tag.ts:100

### getMoveName

- getMoveName(): null | string

  #### Returns null | string

  Inherited from ArenaTag.getMoveName

  - Defined in src/data/arena-tag.ts:72

### getSourcePokemon

- getSourcePokemon(): null | default

  Helper function that retrieves the source Pokemon

  #### Returns null | default

  The source `Pokemon` or `null` if none is found

  Inherited from ArenaTag.getSourcePokemon

  - Defined in src/data/arena-tag.ts:92

### lapse

- lapse(_arena: Arena ): boolean

  #### Parameters

  - _arena: Arena

  #### Returns boolean

  Inherited from ArenaTag.lapse

  - Defined in src/data/arena-tag.ts:68

### loadTag

- loadTag(source: any): void

  When given a arena tag or json representing one, load the data for it. This is meant to be inherited from by any arena tag with custom attributes

  #### Parameters

  - source: any

    An arena tag

  #### Returns void

  Inherited from ArenaTag.loadTag

  - Defined in src/data/arena-tag.ts:81

### onAdd

- onAdd(_arena: Arena ): void

  #### Parameters

  - _arena: Arena

  #### Returns void

  Overrides ArenaTag.onAdd

  - Defined in src/data/arena-tag.ts:320

### onOverlap

- onOverlap(_arena: Arena , _source: null | default ): void

  #### Parameters

  - _arena: Arena
  - _source: null | default

  #### Returns void

  Inherited from ArenaTag.onOverlap

  - Defined in src/data/arena-tag.ts:66

### onRemove

- onRemove(_arena: Arena ): void

  #### Parameters

  - _arena: Arena

  #### Returns void

  Overrides ArenaTag.onRemove

  - Defined in src/data/arena-tag.ts:330