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

# Class LapsingPersistentModifier`Abstract`

Modifier used for party-wide or passive items that start an initial battleCount equal to maxBattles that, for every battle, decrements. Typically, when battleCount reaches 0, the modifier will be removed. If a modifier of the same type is to be added, it will reset battleCount back to maxBattles of the existing modifier instead of adding that modifier directly.

#### See

`add`

#### Hierarchy (View Summary)

- PersistentModifier
  - LapsingPersistentModifier
    - DoubleBattleChanceBoosterModifier
    - TempStatStageBoosterModifier
    - TempCritBoosterModifier
    - TempExtraModifierModifier

- Defined in src/modifier/modifier.ts:344

##### Index

### Constructors

constructor

### Properties

stackCount
type
virtualStackCount

### Methods

add
apply
clone
getArgs
getBattleCount
getIcon
getIconStackText
getMaxBattles
getMaxStackCount
getStackCount
incrementStack
isIconVisible
lapse
match
resetBattleCount
setNewBattleCount
shouldApply

## Constructors

### constructor

- new LapsingPersistentModifier(
  type: ModifierType ,
  maxBattles: number,
  battleCount?: number,
  stackCount?: number,
  ): LapsingPersistentModifier

  #### Parameters

  - type: ModifierType
  - maxBattles: number
  - `Optional` battleCount: number
  - `Optional` stackCount: number

  #### Returns LapsingPersistentModifier

  Overrides PersistentModifier.constructor

  - Defined in src/modifier/modifier.ts:350

## Properties

### stackCount

stackCount: number

Inherited from PersistentModifier.stackCount

- Defined in src/modifier/modifier.ts:186

### type

type: ModifierType

Inherited from PersistentModifier.type

- Defined in src/modifier/modifier.ts:159

### virtualStackCount

virtualStackCount: number

Inherited from PersistentModifier.virtualStackCount

- Defined in src/modifier/modifier.ts:187

## Methods

### add

- add(modifiers: PersistentModifier [], _virtual: boolean): boolean

  Goes through existing modifiers for any that match the selected modifier, which will then either add it to the existing modifiers if none were found or, if one was found, it will refresh battleCount.

  #### Parameters

  - modifiers: PersistentModifier []

    `PersistentModifier` array of the player's modifiers

  - _virtual: boolean

    N/A

  #### Returns boolean

  `true` if the modifier was successfully added or applied, false otherwise

  Overrides PersistentModifier.add

  - Defined in src/modifier/modifier.ts:366

### `Abstract` apply

- apply(...args: unknown[]): boolean

  Handles applying of `Modifier`

  #### Parameters

  - ...args: unknown[]

    collection of all passed parameters

  #### Returns boolean

  Inherited from PersistentModifier.apply

  - Defined in src/modifier/modifier.ts:182

### `Abstract` clone

- clone(): PersistentModifier

  #### Returns PersistentModifier

  Inherited from PersistentModifier.clone

  - Defined in src/modifier/modifier.ts:210

### getArgs

- getArgs(): any[]

  #### Returns any[]

  Overrides PersistentModifier.getArgs

  - Defined in src/modifier/modifier.ts:440

### getBattleCount

- getBattleCount(): number

  #### Returns number

  - Defined in src/modifier/modifier.ts:420

### getIcon

- getIcon(): Container

  #### Returns Container

  Overrides PersistentModifier.getIcon

  - Defined in src/modifier/modifier.ts:394

### getIconStackText

- getIconStackText(_virtual?: boolean): null | BitmapText

  #### Parameters

  - `Optional`_virtual: boolean

  #### Returns null | BitmapText

  Overrides PersistentModifier.getIconStackText

  - Defined in src/modifier/modifier.ts:416

### getMaxBattles

- getMaxBattles(): number

  #### Returns number

  - Defined in src/modifier/modifier.ts:436

### getMaxStackCount

- getMaxStackCount(_forThreshold?: boolean): number

  #### Parameters

  - `Optional`_forThreshold: boolean

  #### Returns number

  Overrides PersistentModifier.getMaxStackCount

  - Defined in src/modifier/modifier.ts:444

### getStackCount

- getStackCount(): number

  #### Returns number

  Inherited from PersistentModifier.getStackCount

  - Defined in src/modifier/modifier.ts:229

### incrementStack

- incrementStack(amount: number, virtual: boolean): boolean

  #### Parameters

  - amount: number
  - virtual: boolean

  #### Returns boolean

  Inherited from PersistentModifier.incrementStack

  - Defined in src/modifier/modifier.ts:216

### isIconVisible

- isIconVisible(): boolean

  #### Returns boolean

  Inherited from PersistentModifier.isIconVisible

  - Defined in src/modifier/modifier.ts:235

### lapse

- lapse(..._args: unknown[]): boolean

  Lapses the battleCount by 1.

  #### Parameters

  - ..._args: unknown[]

    passed arguments (not in use here)

  #### Returns boolean

  `true` if the battleCount is greater than 0

  - Defined in src/modifier/modifier.ts:389

### match

- match(_modifier: Modifier ): boolean

  #### Parameters

  - _modifier: Modifier

  #### Returns boolean

  Inherited from PersistentModifier.match

  - Defined in src/modifier/modifier.ts:165

### resetBattleCount

- resetBattleCount(): void

  #### Returns void

  - Defined in src/modifier/modifier.ts:424

### setNewBattleCount

- setNewBattleCount(count: number): void

  Updates an existing modifier with a new `maxBattles` and `battleCount`.

  #### Parameters

  - count: number

  #### Returns void

  - Defined in src/modifier/modifier.ts:431

### shouldApply

- shouldApply(..._args: unknown[]): boolean

  Checks if `Modifier` should be applied

  #### Parameters

  - ..._args: unknown[]

    parameters passed to `Modifier.apply`

  #### Returns boolean

  always `true` by default

  Inherited from PersistentModifier.shouldApply

  - Defined in src/modifier/modifier.ts:174