{ "version": 3, "sources": ["../../sim/dex-conditions.ts"], "sourcesContent": ["import { Utils } from '../lib/utils';\nimport { assignMissingFields, BasicEffect, toID } from './dex-data';\nimport type { SecondaryEffect, MoveEventMethods } from './dex-moves';\n\n/**\n * Event method prefixes:\n * Ally: triggers for each ally (including the effect holder itself) that is a target of the event, i.e. Pastel Veil\n * Foe: triggers for each foe that is a target of the event, i.e. Unnerve\n * Source: triggers for the source of the event; events must have a source parameter to trigger these handlers\n * Any: triggers for each target of the event regardless of the holder's relation to it\n */\n\nexport interface EventMethods {\n\tonDamagingHit?: (this: Battle, damage: number, target: Pokemon, source: Pokemon, move: ActiveMove) => void;\n\tonEmergencyExit?: (this: Battle, pokemon: Pokemon) => void;\n\tonAfterEachBoost?: (this: Battle, boost: SparseBoostsTable, target: Pokemon, source: Pokemon, effect: Effect) => void;\n\tonAfterHit?: MoveEventMethods['onAfterHit'];\n\tonAfterMega?: (this: Battle, pokemon: Pokemon) => void;\n\tonAfterSetStatus?: (this: Battle, status: Condition, target: Pokemon, source: Pokemon, effect: Effect) => void;\n\tonAfterSubDamage?: MoveEventMethods['onAfterSubDamage'];\n\tonAfterSwitchInSelf?: (this: Battle, pokemon: Pokemon) => void;\n\tonAfterTerastallization?: (this: Battle, pokemon: Pokemon) => void;\n\tonAfterUseItem?: (this: Battle, item: Item, pokemon: Pokemon) => void;\n\tonAfterTakeItem?: (this: Battle, item: Item, pokemon: Pokemon) => void;\n\tonAfterBoost?: (this: Battle, boost: SparseBoostsTable, target: Pokemon, source: Pokemon, effect: Effect) => void;\n\tonAfterFaint?: (this: Battle, length: number, target: Pokemon, source: Pokemon, effect: Effect) => void;\n\tonAfterMoveSecondarySelf?: MoveEventMethods['onAfterMoveSecondarySelf'];\n\tonAfterMoveSecondary?: MoveEventMethods['onAfterMoveSecondary'];\n\tonAfterMove?: MoveEventMethods['onAfterMove'];\n\tonAfterMoveSelf?: CommonHandlers['VoidSourceMove'];\n\tonAttract?: (this: Battle, target: Pokemon, source: Pokemon) => void;\n\tonAccuracy?: (\n\t\tthis: Battle, accuracy: number, target: Pokemon, source: Pokemon, move: ActiveMove\n\t) => number | boolean | null | void;\n\tonBasePower?: CommonHandlers['ModifierSourceMove'];\n\tonBeforeFaint?: (this: Battle, pokemon: Pokemon, effect: Effect) => void;\n\tonBeforeMove?: CommonHandlers['VoidSourceMove'];\n\tonBeforeSwitchIn?: (this: Battle, pokemon: Pokemon) => void;\n\tonBeforeSwitchOut?: (this: Battle, pokemon: Pokemon) => void;\n\tonBeforeTurn?: (this: Battle, pokemon: Pokemon) => void;\n\tonChangeBoost?: (this: Battle, boost: SparseBoostsTable, target: Pokemon, source: Pokemon, effect: Effect) => void;\n\tonTryBoost?: (this: Battle, boost: SparseBoostsTable, target: Pokemon, source: Pokemon, effect: Effect) => void;\n\tonChargeMove?: CommonHandlers['VoidSourceMove'];\n\tonCriticalHit?: ((this: Battle, pokemon: Pokemon, source: null, move: ActiveMove) => boolean | void) | boolean;\n\tonDamage?: (\n\t\tthis: Battle, damage: number, target: Pokemon, source: Pokemon, effect: Effect\n\t) => number | boolean | null | void;\n\tonDeductPP?: (this: Battle, target: Pokemon, source: Pokemon) => number | void;\n\tonDisableMove?: (this: Battle, pokemon: Pokemon) => void;\n\tonDragOut?: (this: Battle, pokemon: Pokemon, source?: Pokemon, move?: ActiveMove) => void;\n\tonEatItem?: (this: Battle, item: Item, pokemon: Pokemon) => void;\n\tonEffectiveness?: MoveEventMethods['onEffectiveness'];\n\tonEntryHazard?: (this: Battle, pokemon: Pokemon) => void;\n\tonFaint?: CommonHandlers['VoidEffect'];\n\tonFlinch?: ((this: Battle, pokemon: Pokemon) => boolean | void) | boolean;\n\tonFractionalPriority?: CommonHandlers['ModifierSourceMove'] | -0.1;\n\tonHit?: MoveEventMethods['onHit'];\n\tonImmunity?: (this: Battle, type: string, pokemon: Pokemon) => void;\n\tonLockMove?: string | ((this: Battle, pokemon: Pokemon) => void | string);\n\tonMaybeTrapPokemon?: (this: Battle, pokemon: Pokemon) => void;\n\tonModifyAccuracy?: CommonHandlers['ModifierMove'];\n\tonModifyAtk?: CommonHandlers['ModifierSourceMove'];\n\tonModifyBoost?: (this: Battle, boosts: SparseBoostsTable, pokemon: Pokemon) => SparseBoostsTable | void;\n\tonModifyCritRatio?: CommonHandlers['ModifierSourceMove'];\n\tonModifyDamage?: CommonHandlers['ModifierSourceMove'];\n\tonModifyDef?: CommonHandlers['ModifierMove'];\n\tonModifyMove?: MoveEventMethods['onModifyMove'];\n\tonModifyPriority?: CommonHandlers['ModifierSourceMove'];\n\tonModifySecondaries?: (\n\t\tthis: Battle, secondaries: SecondaryEffect[], target: Pokemon, source: Pokemon, move: ActiveMove\n\t) => void;\n\tonModifyType?: MoveEventMethods['onModifyType'];\n\tonModifyTarget?: MoveEventMethods['onModifyTarget'];\n\tonModifySpA?: CommonHandlers['ModifierSourceMove'];\n\tonModifySpD?: CommonHandlers['ModifierMove'];\n\tonModifySpe?: (this: Battle, spe: number, pokemon: Pokemon) => number | void;\n\tonModifySTAB?: CommonHandlers['ModifierSourceMove'];\n\tonModifyWeight?: (this: Battle, weighthg: number, pokemon: Pokemon) => number | void;\n\tonMoveAborted?: CommonHandlers['VoidMove'];\n\tonNegateImmunity?: ((this: Battle, pokemon: Pokemon, type: string) => boolean | void) | boolean;\n\tonOverrideAction?: (this: Battle, pokemon: Pokemon, target: Pokemon, move: ActiveMove) => string | void;\n\tonPrepareHit?: CommonHandlers['ResultSourceMove'];\n\tonRedirectTarget?: (\n\t\tthis: Battle, target: Pokemon, source: Pokemon, source2: Effect, move: ActiveMove\n\t) => Pokemon | void;\n\tonResidual?: (this: Battle, target: Pokemon, source: Pokemon, effect: Effect) => void;\n\tonSetAbility?: (\n\t\tthis: Battle, ability: string, target: Pokemon, source: Pokemon, effect: Effect\n\t) => null | void;\n\tonSetStatus?: (\n\t\tthis: Battle, status: Condition, target: Pokemon, source: Pokemon, effect: Effect\n\t) => boolean | null | void;\n\tonSetWeather?: (this: Battle, target: Pokemon, source: Pokemon, weather: Condition) => boolean | void;\n\tonStallMove?: (this: Battle, pokemon: Pokemon) => boolean | void;\n\tonSwitchIn?: (this: Battle, pokemon: Pokemon) => void;\n\tonSwitchOut?: (this: Battle, pokemon: Pokemon) => void;\n\tonSwap?: (this: Battle, target: Pokemon, source: Pokemon) => void;\n\tonTakeItem?: (\n\t\t(this: Battle, item: Item, pokemon: Pokemon, source: Pokemon, move?: ActiveMove) => boolean | void\n\t) | boolean;\n\tonWeatherChange?: (this: Battle, target: Pokemon, source: Pokemon, sourceEffect: Effect) => void;\n\tonTerrainChange?: (this: Battle, target: Pokemon, source: Pokemon, sourceEffect: Effect) => void;\n\tonTrapPokemon?: (this: Battle, pokemon: Pokemon) => void;\n\tonTryAddVolatile?: (\n\t\tthis: Battle, status: Condition, target: Pokemon, source: Pokemon, sourceEffect: Effect\n\t) => boolean | null | void;\n\tonTryEatItem?: boolean | ((this: Battle, item: Item, pokemon: Pokemon) => boolean | void);\n\tonTryHeal?: (\n\t\t((this: Battle, relayVar: number, target: Pokemon, source: Pokemon, effect: Effect) => number | boolean | void)\n\t);\n\tonTryHit?: MoveEventMethods['onTryHit'];\n\tonTryHitField?: MoveEventMethods['onTryHitField'];\n\tonTryHitSide?: CommonHandlers['ResultMove'];\n\tonInvulnerability?: CommonHandlers['ExtResultMove'];\n\tonTryMove?: MoveEventMethods['onTryMove'];\n\tonTryPrimaryHit?: (this: Battle, target: Pokemon, source: Pokemon, move: ActiveMove) => boolean | null | number | void;\n\tonType?: (this: Battle, types: string[], pokemon: Pokemon) => string[] | void;\n\tonUseItem?: (this: Battle, item: Item, pokemon: Pokemon) => void;\n\tonUpdate?: (this: Battle, pokemon: Pokemon) => void;\n\tonWeather?: (this: Battle, target: Pokemon, source: null, effect: Condition) => void;\n\tonWeatherModifyDamage?: CommonHandlers['ModifierSourceMove'];\n\tonModifyDamagePhase1?: CommonHandlers['ModifierSourceMove'];\n\tonModifyDamagePhase2?: CommonHandlers['ModifierSourceMove'];\n\tonFoeDamagingHit?: (this: Battle, damage: number, target: Pokemon, source: Pokemon, move: ActiveMove) => void;\n\tonFoeAfterEachBoost?: (this: Battle, boost: SparseBoostsTable, target: Pokemon, source: Pokemon) => void;\n\tonFoeAfterHit?: MoveEventMethods['onAfterHit'];\n\tonFoeAfterSetStatus?: (this: Battle, status: Condition, target: Pokemon, source: Pokemon, effect: Effect) => void;\n\tonFoeAfterSubDamage?: MoveEventMethods['onAfterSubDamage'];\n\tonFoeAfterSwitchInSelf?: (this: Battle, pokemon: Pokemon) => void;\n\tonFoeAfterUseItem?: (this: Battle, item: Item, pokemon: Pokemon) => void;\n\tonFoeAfterBoost?: (this: Battle, boost: SparseBoostsTable, target: Pokemon, source: Pokemon, effect: Effect) => void;\n\tonFoeAfterFaint?: (this: Battle, length: number, target: Pokemon, source: Pokemon, effect: Effect) => void;\n\tonFoeAfterMoveSecondarySelf?: MoveEventMethods['onAfterMoveSecondarySelf'];\n\tonFoeAfterMoveSecondary?: MoveEventMethods['onAfterMoveSecondary'];\n\tonFoeAfterMove?: MoveEventMethods['onAfterMove'];\n\tonFoeAfterMoveSelf?: CommonHandlers['VoidSourceMove'];\n\tonFoeAttract?: (this: Battle, target: Pokemon, source: Pokemon) => void;\n\tonFoeAccuracy?: (\n\t\tthis: Battle, accuracy: number, target: Pokemon, source: Pokemon, move: ActiveMove\n\t) => number | boolean | null | void;\n\tonFoeBasePower?: CommonHandlers['ModifierSourceMove'];\n\tonFoeBeforeFaint?: (this: Battle, pokemon: Pokemon, effect: Effect) => void;\n\tonFoeBeforeMove?: CommonHandlers['VoidSourceMove'];\n\tonFoeBeforeSwitchIn?: (this: Battle, pokemon: Pokemon) => void;\n\tonFoeBeforeSwitchOut?: (this: Battle, pokemon: Pokemon) => void;\n\tonFoeTryBoost?: (this: Battle, boost: SparseBoostsTable, target: Pokemon, source: Pokemon, effect: Effect) => void;\n\tonFoeChargeMove?: CommonHandlers['VoidSourceMove'];\n\tonFoeCriticalHit?: ((this: Battle, pokemon: Pokemon, source: null, move: ActiveMove) => boolean | void) | boolean;\n\tonFoeDamage?: (\n\t\tthis: Battle, damage: number, target: Pokemon, source: Pokemon, effect: Effect\n\t) => number | boolean | null | void;\n\tonFoeDeductPP?: (this: Battle, target: Pokemon, source: Pokemon) => number | void;\n\tonFoeDisableMove?: (this: Battle, pokemon: Pokemon) => void;\n\tonFoeDragOut?: (this: Battle, pokemon: Pokemon, source?: Pokemon, move?: ActiveMove) => void;\n\tonFoeEatItem?: (this: Battle, item: Item, pokemon: Pokemon) => void;\n\tonFoeEffectiveness?: MoveEventMethods['onEffectiveness'];\n\tonFoeFaint?: CommonHandlers['VoidEffect'];\n\tonFoeFlinch?: ((this: Battle, pokemon: Pokemon) => boolean | void) | boolean;\n\tonFoeHit?: MoveEventMethods['onHit'];\n\tonFoeImmunity?: (this: Battle, type: string, pokemon: Pokemon) => void;\n\tonFoeLockMove?: string | ((this: Battle, pokemon: Pokemon) => void | string);\n\tonFoeMaybeTrapPokemon?: (this: Battle, pokemon: Pokemon, source?: Pokemon) => void;\n\tonFoeModifyAccuracy?: CommonHandlers['ModifierMove'];\n\tonFoeModifyAtk?: CommonHandlers['ModifierSourceMove'];\n\tonFoeModifyBoost?: (this: Battle, boosts: SparseBoostsTable, pokemon: Pokemon) => SparseBoostsTable | void;\n\tonFoeModifyCritRatio?: CommonHandlers['ModifierSourceMove'];\n\tonFoeModifyDamage?: CommonHandlers['ModifierSourceMove'];\n\tonFoeModifyDef?: CommonHandlers['ModifierMove'];\n\tonFoeModifyMove?: MoveEventMethods['onModifyMove'];\n\tonFoeModifyPriority?: CommonHandlers['ModifierSourceMove'];\n\tonFoeModifySecondaries?: (\n\t\tthis: Battle, secondaries: SecondaryEffect[], target: Pokemon, source: Pokemon, move: ActiveMove\n\t) => void;\n\tonFoeModifySpA?: CommonHandlers['ModifierSourceMove'];\n\tonFoeModifySpD?: CommonHandlers['ModifierMove'];\n\tonFoeModifySpe?: (this: Battle, spe: number, pokemon: Pokemon) => number | void;\n\tonFoeModifySTAB?: CommonHandlers['ModifierSourceMove'];\n\tonFoeModifyType?: MoveEventMethods['onModifyType'];\n\tonFoeModifyTarget?: MoveEventMethods['onModifyTarget'];\n\tonFoeModifyWeight?: (this: Battle, weighthg: number, pokemon: Pokemon) => number | void;\n\tonFoeMoveAborted?: CommonHandlers['VoidMove'];\n\tonFoeNegateImmunity?: ((this: Battle, pokemon: Pokemon, type: string) => boolean | void) | boolean;\n\tonFoeOverrideAction?: (this: Battle, pokemon: Pokemon, target: Pokemon, move: ActiveMove) => string | void;\n\tonFoePrepareHit?: CommonHandlers['ResultSourceMove'];\n\tonFoeRedirectTarget?: (\n\t\tthis: Battle, target: Pokemon, source: Pokemon, source2: Effect, move: ActiveMove\n\t) => Pokemon | void;\n\tonFoeResidual?: (this: Battle, target: Pokemon & Side, source: Pokemon, effect: Effect) => void;\n\tonFoeSetAbility?: (this: Battle, ability: string, target: Pokemon, source: Pokemon, effect: Effect) => boolean | void;\n\tonFoeSetStatus?: (\n\t\tthis: Battle, status: Condition, target: Pokemon, source: Pokemon, effect: Effect\n\t) => boolean | null | void;\n\tonFoeSetWeather?: (this: Battle, target: Pokemon, source: Pokemon, weather: Condition) => boolean | void;\n\tonFoeStallMove?: (this: Battle, pokemon: Pokemon) => boolean | void;\n\tonFoeSwitchOut?: (this: Battle, pokemon: Pokemon) => void;\n\tonFoeTakeItem?: (\n\t\t(this: Battle, item: Item, pokemon: Pokemon, source: Pokemon, move?: ActiveMove) => boolean | void\n\t) | boolean;\n\tonFoeTerrain?: (this: Battle, pokemon: Pokemon) => void;\n\tonFoeTrapPokemon?: (this: Battle, pokemon: Pokemon) => void;\n\tonFoeTryAddVolatile?: (\n\t\tthis: Battle, status: Condition, target: Pokemon, source: Pokemon, sourceEffect: Effect\n\t) => boolean | null | void;\n\tonFoeTryEatItem?: boolean | ((this: Battle, item: Item, pokemon: Pokemon) => boolean | void);\n\t/* FIXME: onFoeTryHeal() is run with two different sets of arguments */\n\tonFoeTryHeal?: (\n\t\t((this: Battle, relayVar: number, target: Pokemon, source: Pokemon, effect: Effect) => number | boolean | void) |\n\t\t((this: Battle, pokemon: Pokemon) => boolean | void) | boolean\n\t);\n\tonFoeTryHit?: MoveEventMethods['onTryHit'];\n\tonFoeTryHitField?: MoveEventMethods['onTryHitField'];\n\tonFoeTryHitSide?: CommonHandlers['ResultMove'];\n\tonFoeInvulnerability?: CommonHandlers['ExtResultMove'];\n\tonFoeTryMove?: MoveEventMethods['onTryMove'];\n\tonFoeTryPrimaryHit?: (\n\t\tthis: Battle, target: Pokemon, source: Pokemon, move: ActiveMove\n\t) => boolean | null | number | void;\n\tonFoeType?: (this: Battle, types: string[], pokemon: Pokemon) => string[] | void;\n\tonFoeWeatherModifyDamage?: CommonHandlers['ModifierSourceMove'];\n\tonFoeModifyDamagePhase1?: CommonHandlers['ModifierSourceMove'];\n\tonFoeModifyDamagePhase2?: CommonHandlers['ModifierSourceMove'];\n\tonSourceDamagingHit?: (this: Battle, damage: number, target: Pokemon, source: Pokemon, move: ActiveMove) => void;\n\tonSourceAfterEachBoost?: (this: Battle, boost: SparseBoostsTable, target: Pokemon, source: Pokemon) => void;\n\tonSourceAfterHit?: MoveEventMethods['onAfterHit'];\n\tonSourceAfterSetStatus?: (this: Battle, status: Condition, target: Pokemon, source: Pokemon, effect: Effect) => void;\n\tonSourceAfterSubDamage?: MoveEventMethods['onAfterSubDamage'];\n\tonSourceAfterSwitchInSelf?: (this: Battle, pokemon: Pokemon) => void;\n\tonSourceAfterUseItem?: (this: Battle, item: Item, pokemon: Pokemon) => void;\n\tonSourceAfterBoost?: (this: Battle, boost: SparseBoostsTable, target: Pokemon, source: Pokemon, effect: Effect) => void;\n\tonSourceAfterFaint?: (this: Battle, length: number, target: Pokemon, source: Pokemon, effect: Effect) => void;\n\tonSourceAfterMoveSecondarySelf?: MoveEventMethods['onAfterMoveSecondarySelf'];\n\tonSourceAfterMoveSecondary?: MoveEventMethods['onAfterMoveSecondary'];\n\tonSourceAfterMove?: MoveEventMethods['onAfterMove'];\n\tonSourceAfterMoveSelf?: CommonHandlers['VoidSourceMove'];\n\tonSourceAttract?: (this: Battle, target: Pokemon, source: Pokemon) => void;\n\tonSourceAccuracy?: (\n\t\tthis: Battle, accuracy: number, target: Pokemon, source: Pokemon, move: ActiveMove\n\t) => number | boolean | null | void;\n\tonSourceBasePower?: CommonHandlers['ModifierSourceMove'];\n\tonSourceBeforeFaint?: (this: Battle, pokemon: Pokemon, effect: Effect) => void;\n\tonSourceBeforeMove?: CommonHandlers['VoidSourceMove'];\n\tonSourceBeforeSwitchIn?: (this: Battle, pokemon: Pokemon) => void;\n\tonSourceBeforeSwitchOut?: (this: Battle, pokemon: Pokemon) => void;\n\tonSourceTryBoost?: (this: Battle, boost: SparseBoostsTable, target: Pokemon, source: Pokemon, effect: Effect) => void;\n\tonSourceChargeMove?: CommonHandlers['VoidSourceMove'];\n\tonSourceCriticalHit?: ((this: Battle, pokemon: Pokemon, source: null, move: ActiveMove) => boolean | void) | boolean;\n\tonSourceDamage?: (\n\t\tthis: Battle, damage: number, target: Pokemon, source: Pokemon, effect: Effect\n\t) => number | boolean | null | void;\n\tonSourceDeductPP?: (this: Battle, target: Pokemon, source: Pokemon) => number | void;\n\tonSourceDisableMove?: (this: Battle, pokemon: Pokemon) => void;\n\tonSourceDragOut?: (this: Battle, pokemon: Pokemon, source?: Pokemon, move?: ActiveMove) => void;\n\tonSourceEatItem?: (this: Battle, item: Item, pokemon: Pokemon) => void;\n\tonSourceEffectiveness?: MoveEventMethods['onEffectiveness'];\n\tonSourceFaint?: CommonHandlers['VoidEffect'];\n\tonSourceFlinch?: ((this: Battle, pokemon: Pokemon) => boolean | void) | boolean;\n\tonSourceHit?: MoveEventMethods['onHit'];\n\tonSourceImmunity?: (this: Battle, type: string, pokemon: Pokemon) => void;\n\tonSourceLockMove?: string | ((this: Battle, pokemon: Pokemon) => void | string);\n\tonSourceMaybeTrapPokemon?: (this: Battle, pokemon: Pokemon) => void;\n\tonSourceModifyAccuracy?: CommonHandlers['ModifierMove'];\n\tonSourceModifyAtk?: CommonHandlers['ModifierSourceMove'];\n\tonSourceModifyBoost?: (this: Battle, boosts: SparseBoostsTable, pokemon: Pokemon) => SparseBoostsTable | void;\n\tonSourceModifyCritRatio?: CommonHandlers['ModifierSourceMove'];\n\tonSourceModifyDamage?: CommonHandlers['ModifierSourceMove'];\n\tonSourceModifyDef?: CommonHandlers['ModifierMove'];\n\tonSourceModifyMove?: MoveEventMethods['onModifyMove'];\n\tonSourceModifyPriority?: CommonHandlers['ModifierSourceMove'];\n\tonSourceModifySecondaries?: (\n\t\tthis: Battle, secondaries: SecondaryEffect[], target: Pokemon, source: Pokemon, move: ActiveMove\n\t) => void;\n\tonSourceModifySpA?: CommonHandlers['ModifierSourceMove'];\n\tonSourceModifySpD?: CommonHandlers['ModifierMove'];\n\tonSourceModifySpe?: (this: Battle, spe: number, pokemon: Pokemon) => number | void;\n\tonSourceModifySTAB?: CommonHandlers['ModifierSourceMove'];\n\tonSourceModifyType?: MoveEventMethods['onModifyType'];\n\tonSourceModifyTarget?: MoveEventMethods['onModifyTarget'];\n\tonSourceModifyWeight?: (this: Battle, weighthg: number, pokemon: Pokemon) => number | void;\n\tonSourceMoveAborted?: CommonHandlers['VoidMove'];\n\tonSourceNegateImmunity?: ((this: Battle, pokemon: Pokemon, type: string) => boolean | void) | boolean;\n\tonSourceOverrideAction?: (this: Battle, pokemon: Pokemon, target: Pokemon, move: ActiveMove) => string | void;\n\tonSourcePrepareHit?: CommonHandlers['ResultSourceMove'];\n\tonSourceRedirectTarget?: (\n\t\tthis: Battle, target: Pokemon, source: Pokemon, source2: Effect, move: ActiveMove\n\t) => Pokemon | void;\n\tonSourceResidual?: (this: Battle, target: Pokemon & Side, source: Pokemon, effect: Effect) => void;\n\tonSourceSetAbility?: (\n\t\tthis: Battle, ability: string, target: Pokemon, source: Pokemon, effect: Effect\n\t) => boolean | void;\n\tonSourceSetStatus?: (\n\t\tthis: Battle, status: Condition, target: Pokemon, source: Pokemon, effect: Effect\n\t) => boolean | null | void;\n\tonSourceSetWeather?: (this: Battle, target: Pokemon, source: Pokemon, weather: Condition) => boolean | void;\n\tonSourceStallMove?: (this: Battle, pokemon: Pokemon) => boolean | void;\n\tonSourceSwitchOut?: (this: Battle, pokemon: Pokemon) => void;\n\tonSourceTakeItem?: (\n\t\t(this: Battle, item: Item, pokemon: Pokemon, source: Pokemon, move?: ActiveMove) => boolean | void\n\t) | boolean;\n\tonSourceTerrain?: (this: Battle, pokemon: Pokemon) => void;\n\tonSourceTrapPokemon?: (this: Battle, pokemon: Pokemon) => void;\n\tonSourceTryAddVolatile?: (\n\t\tthis: Battle, status: Condition, target: Pokemon, source: Pokemon, sourceEffect: Effect\n\t) => boolean | null | void;\n\tonSourceTryEatItem?: boolean | ((this: Battle, item: Item, pokemon: Pokemon) => boolean | void);\n\t/* FIXME: onSourceTryHeal() is run with two different sets of arguments */\n\tonSourceTryHeal?: (\n\t\t((this: Battle, relayVar: number, target: Pokemon, source: Pokemon, effect: Effect) => number | boolean | void) |\n\t\t((this: Battle, pokemon: Pokemon) => boolean | void) | boolean\n\t);\n\tonSourceTryHit?: MoveEventMethods['onTryHit'];\n\tonSourceTryHitField?: MoveEventMethods['onTryHitField'];\n\tonSourceTryHitSide?: CommonHandlers['ResultMove'];\n\tonSourceInvulnerability?: CommonHandlers['ExtResultMove'];\n\tonSourceTryMove?: MoveEventMethods['onTryMove'];\n\tonSourceTryPrimaryHit?: (\n\t\tthis: Battle, target: Pokemon, source: Pokemon, move: ActiveMove\n\t) => boolean | null | number | void;\n\tonSourceType?: (this: Battle, types: string[], pokemon: Pokemon) => string[] | void;\n\tonSourceWeatherModifyDamage?: CommonHandlers['ModifierSourceMove'];\n\tonSourceModifyDamagePhase1?: CommonHandlers['ModifierSourceMove'];\n\tonSourceModifyDamagePhase2?: CommonHandlers['ModifierSourceMove'];\n\tonAnyDamagingHit?: (this: Battle, damage: number, target: Pokemon, source: Pokemon, move: ActiveMove) => void;\n\tonAnyAfterEachBoost?: (this: Battle, boost: SparseBoostsTable, target: Pokemon, source: Pokemon) => void;\n\tonAnyAfterHit?: MoveEventMethods['onAfterHit'];\n\tonAnyAfterSetStatus?: (this: Battle, status: Condition, target: Pokemon, source: Pokemon, effect: Effect) => void;\n\tonAnyAfterSubDamage?: MoveEventMethods['onAfterSubDamage'];\n\tonAnyAfterSwitchInSelf?: (this: Battle, pokemon: Pokemon) => void;\n\tonAnyAfterUseItem?: (this: Battle, item: Item, pokemon: Pokemon) => void;\n\tonAnyAfterBoost?: (this: Battle, boost: SparseBoostsTable, target: Pokemon, source: Pokemon, effect: Effect) => void;\n\tonAnyAfterFaint?: (this: Battle, length: number, target: Pokemon, source: Pokemon, effect: Effect) => void;\n\tonAnyAfterMoveSecondarySelf?: MoveEventMethods['onAfterMoveSecondarySelf'];\n\tonAnyAfterMoveSecondary?: MoveEventMethods['onAfterMoveSecondary'];\n\tonAnyAfterMove?: MoveEventMethods['onAfterMove'];\n\tonAnyAfterMoveSelf?: CommonHandlers['VoidSourceMove'];\n\tonAnyAttract?: (this: Battle, target: Pokemon, source: Pokemon) => void;\n\tonAnyAccuracy?: (\n\t\tthis: Battle, accuracy: number, target: Pokemon, source: Pokemon, move: ActiveMove\n\t) => number | boolean | null | void;\n\tonAnyBasePower?: CommonHandlers['ModifierSourceMove'];\n\tonAnyBeforeFaint?: (this: Battle, pokemon: Pokemon, effect: Effect) => void;\n\tonAnyBeforeMove?: CommonHandlers['VoidSourceMove'];\n\tonAnyBeforeSwitchIn?: (this: Battle, pokemon: Pokemon) => void;\n\tonAnyBeforeSwitchOut?: (this: Battle, pokemon: Pokemon) => void;\n\tonAnyTryBoost?: (this: Battle, boost: SparseBoostsTable, target: Pokemon, source: Pokemon, effect: Effect) => void;\n\tonAnyChargeMove?: CommonHandlers['VoidSourceMove'];\n\tonAnyCriticalHit?: ((this: Battle, pokemon: Pokemon, source: null, move: ActiveMove) => boolean | void) | boolean;\n\tonAnyDamage?: (\n\t\tthis: Battle, damage: number, target: Pokemon, source: Pokemon, effect: Effect\n\t) => number | boolean | null | void;\n\tonAnyDeductPP?: (this: Battle, target: Pokemon, source: Pokemon) => number | void;\n\tonAnyDisableMove?: (this: Battle, pokemon: Pokemon) => void;\n\tonAnyDragOut?: (this: Battle, pokemon: Pokemon, source?: Pokemon, move?: ActiveMove) => void;\n\tonAnyEatItem?: (this: Battle, item: Item, pokemon: Pokemon) => void;\n\tonAnyEffectiveness?: MoveEventMethods['onEffectiveness'];\n\tonAnyFaint?: CommonHandlers['VoidEffect'];\n\tonAnyFlinch?: ((this: Battle, pokemon: Pokemon) => boolean | void) | boolean;\n\tonAnyHit?: MoveEventMethods['onHit'];\n\tonAnyImmunity?: (this: Battle, type: string, pokemon: Pokemon) => void;\n\tonAnyLockMove?: string | ((this: Battle, pokemon: Pokemon) => void | string);\n\tonAnyMaybeTrapPokemon?: (this: Battle, pokemon: Pokemon) => void;\n\tonAnyModifyAccuracy?: CommonHandlers['ModifierMove'];\n\tonAnyModifyAtk?: CommonHandlers['ModifierSourceMove'];\n\tonAnyModifyBoost?: (this: Battle, boosts: SparseBoostsTable, pokemon: Pokemon) => SparseBoostsTable | void;\n\tonAnyModifyCritRatio?: CommonHandlers['ModifierSourceMove'];\n\tonAnyModifyDamage?: CommonHandlers['ModifierSourceMove'];\n\tonAnyModifyDef?: CommonHandlers['ModifierMove'];\n\tonAnyModifyMove?: MoveEventMethods['onModifyMove'];\n\tonAnyModifyPriority?: CommonHandlers['ModifierSourceMove'];\n\tonAnyModifySecondaries?: (\n\t\tthis: Battle, secondaries: SecondaryEffect[], target: Pokemon, source: Pokemon, move: ActiveMove\n\t) => void;\n\tonAnyModifySpA?: CommonHandlers['ModifierSourceMove'];\n\tonAnyModifySpD?: CommonHandlers['ModifierMove'];\n\tonAnyModifySpe?: (this: Battle, spe: number, pokemon: Pokemon) => number | void;\n\tonAnyModifySTAB?: CommonHandlers['ModifierSourceMove'];\n\tonAnyModifyType?: MoveEventMethods['onModifyType'];\n\tonAnyModifyTarget?: MoveEventMethods['onModifyTarget'];\n\tonAnyModifyWeight?: (this: Battle, weighthg: number, pokemon: Pokemon) => number | void;\n\tonAnyMoveAborted?: CommonHandlers['VoidMove'];\n\tonAnyNegateImmunity?: ((this: Battle, pokemon: Pokemon, type: string) => boolean | void) | boolean;\n\tonAnyOverrideAction?: (this: Battle, pokemon: Pokemon, target: Pokemon, move: ActiveMove) => string | void;\n\tonAnyPrepareHit?: CommonHandlers['ResultSourceMove'];\n\tonAnyPseudoWeatherChange?: (this: Battle, target: Pokemon, source: Pokemon, pseudoWeather: Condition) => void;\n\tonAnyRedirectTarget?: (\n\t\tthis: Battle, target: Pokemon, source: Pokemon, source2: Effect, move: ActiveMove\n\t) => Pokemon | void;\n\tonAnyResidual?: (this: Battle, target: Pokemon & Side, source: Pokemon, effect: Effect) => void;\n\tonAnySetAbility?: (this: Battle, ability: string, target: Pokemon, source: Pokemon, effect: Effect) => boolean | void;\n\tonAnySetStatus?: (\n\t\tthis: Battle, status: Condition, target: Pokemon, source: Pokemon, effect: Effect\n\t) => boolean | null | void;\n\tonAnySetWeather?: (this: Battle, target: Pokemon, source: Pokemon, weather: Condition) => boolean | void;\n\tonAnyStallMove?: (this: Battle, pokemon: Pokemon) => boolean | void;\n\tonAnySwitchIn?: (this: Battle, pokemon: Pokemon) => void;\n\tonAnySwitchOut?: (this: Battle, pokemon: Pokemon) => void;\n\tonAnyTakeItem?: (\n\t\t(this: Battle, item: Item, pokemon: Pokemon, source: Pokemon, move?: ActiveMove) => boolean | void\n\t) | boolean;\n\tonAnyTerrain?: (this: Battle, pokemon: Pokemon) => void;\n\tonAnyTrapPokemon?: (this: Battle, pokemon: Pokemon) => void;\n\tonAnyTryAddVolatile?: (\n\t\tthis: Battle, status: Condition, target: Pokemon, source: Pokemon, sourceEffect: Effect\n\t) => boolean | null | void;\n\tonAnyTryEatItem?: boolean | ((this: Battle, item: Item, pokemon: Pokemon) => boolean | void);\n\t/* FIXME: onAnyTryHeal() is run with two different sets of arguments */\n\tonAnyTryHeal?: (\n\t\t((this: Battle, relayVar: number, target: Pokemon, source: Pokemon, effect: Effect) => number | boolean | void) |\n\t\t((this: Battle, pokemon: Pokemon) => boolean | void) | boolean\n\t);\n\tonAnyTryHit?: MoveEventMethods['onTryHit'];\n\tonAnyTryHitField?: MoveEventMethods['onTryHitField'];\n\tonAnyTryHitSide?: CommonHandlers['ResultMove'];\n\tonAnyInvulnerability?: CommonHandlers['ExtResultMove'];\n\tonAnyTryMove?: MoveEventMethods['onTryMove'];\n\tonAnyTryPrimaryHit?: (\n\t\tthis: Battle, target: Pokemon, source: Pokemon, move: ActiveMove\n\t) => boolean | null | number | void;\n\tonAnyType?: (this: Battle, types: string[], pokemon: Pokemon) => string[] | void;\n\tonAnyWeatherModifyDamage?: CommonHandlers['ModifierSourceMove'];\n\tonAnyModifyDamagePhase1?: CommonHandlers['ModifierSourceMove'];\n\tonAnyModifyDamagePhase2?: CommonHandlers['ModifierSourceMove'];\n\n\t// Priorities (incomplete list)\n\tonAccuracyPriority?: number;\n\tonDamagingHitOrder?: number;\n\tonAfterMoveSecondaryPriority?: number;\n\tonAfterMoveSecondarySelfPriority?: number;\n\tonAfterMoveSelfPriority?: number;\n\tonAfterSetStatusPriority?: number;\n\tonAnyBasePowerPriority?: number;\n\tonAnyInvulnerabilityPriority?: number;\n\tonAnyModifyAccuracyPriority?: number;\n\tonAnyFaintPriority?: number;\n\tonAnyPrepareHitPriority?: number;\n\tonAnySwitchInPriority?: number;\n\tonAnySwitchInSubOrder?: number;\n\tonAllyBasePowerPriority?: number;\n\tonAllyModifyAtkPriority?: number;\n\tonAllyModifySpAPriority?: number;\n\tonAllyModifySpDPriority?: number;\n\tonAttractPriority?: number;\n\tonBasePowerPriority?: number;\n\tonBeforeMovePriority?: number;\n\tonBeforeSwitchOutPriority?: number;\n\tonChangeBoostPriority?: number;\n\tonDamagePriority?: number;\n\tonDragOutPriority?: number;\n\tonEffectivenessPriority?: number;\n\tonFoeBasePowerPriority?: number;\n\tonFoeBeforeMovePriority?: number;\n\tonFoeModifyDefPriority?: number;\n\tonFoeModifySpDPriority?: number;\n\tonFoeRedirectTargetPriority?: number;\n\tonFoeTrapPokemonPriority?: number;\n\tonFractionalPriorityPriority?: number;\n\tonHitPriority?: number;\n\tonInvulnerabilityPriority?: number;\n\tonModifyAccuracyPriority?: number;\n\tonModifyAtkPriority?: number;\n\tonModifyCritRatioPriority?: number;\n\tonModifyDefPriority?: number;\n\tonModifyMovePriority?: number;\n\tonModifyPriorityPriority?: number;\n\tonModifySpAPriority?: number;\n\tonModifySpDPriority?: number;\n\tonModifySpePriority?: number;\n\tonModifySTABPriority?: number;\n\tonModifyTypePriority?: number;\n\tonModifyWeightPriority?: number;\n\tonRedirectTargetPriority?: number;\n\tonResidualOrder?: number;\n\tonResidualPriority?: number;\n\tonResidualSubOrder?: number;\n\tonSourceBasePowerPriority?: number;\n\tonSourceInvulnerabilityPriority?: number;\n\tonSourceModifyAccuracyPriority?: number;\n\tonSourceModifyAtkPriority?: number;\n\tonSourceModifyDamagePriority?: number;\n\tonSourceModifySpAPriority?: number;\n\tonSwitchInPriority?: number;\n\tonSwitchInSubOrder?: number;\n\tonTrapPokemonPriority?: number;\n\tonTryBoostPriority?: number;\n\tonTryEatItemPriority?: number;\n\tonTryHealPriority?: number;\n\tonTryHitPriority?: number;\n\tonTryMovePriority?: number;\n\tonTryPrimaryHitPriority?: number;\n\tonTypePriority?: number;\n}\n\nexport interface PokemonEventMethods extends EventMethods {\n\tonAllyDamagingHit?: (this: Battle, damage: number, target: Pokemon, source: Pokemon, move: ActiveMove) => void;\n\tonAllyAfterEachBoost?: (this: Battle, boost: SparseBoostsTable, target: Pokemon, source: Pokemon) => void;\n\tonAllyAfterHit?: MoveEventMethods['onAfterHit'];\n\tonAllyAfterSetStatus?: (this: Battle, status: Condition, target: Pokemon, source: Pokemon, effect: Effect) => void;\n\tonAllyAfterSubDamage?: MoveEventMethods['onAfterSubDamage'];\n\tonAllyAfterSwitchInSelf?: (this: Battle, pokemon: Pokemon) => void;\n\tonAllyAfterUseItem?: (this: Battle, item: Item, pokemon: Pokemon) => void;\n\tonAllyAfterBoost?: (this: Battle, boost: SparseBoostsTable, target: Pokemon, source: Pokemon, effect: Effect) => void;\n\tonAllyAfterFaint?: (this: Battle, length: number, target: Pokemon, source: Pokemon, effect: Effect) => void;\n\tonAllyAfterMoveSecondarySelf?: MoveEventMethods['onAfterMoveSecondarySelf'];\n\tonAllyAfterMoveSecondary?: MoveEventMethods['onAfterMoveSecondary'];\n\tonAllyAfterMove?: MoveEventMethods['onAfterMove'];\n\tonAllyAfterMoveSelf?: CommonHandlers['VoidSourceMove'];\n\tonAllyAttract?: (this: Battle, target: Pokemon, source: Pokemon) => void;\n\tonAllyAccuracy?: (\n\t\tthis: Battle, accuracy: number, target: Pokemon, source: Pokemon, move: ActiveMove\n\t) => number | boolean | null | void;\n\tonAllyBasePower?: CommonHandlers['ModifierSourceMove'];\n\tonAllyBeforeFaint?: (this: Battle, pokemon: Pokemon, effect: Effect) => void;\n\tonAllyBeforeMove?: CommonHandlers['VoidSourceMove'];\n\tonAllyBeforeSwitchIn?: (this: Battle, pokemon: Pokemon) => void;\n\tonAllyBeforeSwitchOut?: (this: Battle, pokemon: Pokemon) => void;\n\tonAllyTryBoost?: (this: Battle, boost: SparseBoostsTable, target: Pokemon, source: Pokemon, effect: Effect) => void;\n\tonAllyChargeMove?: CommonHandlers['VoidSourceMove'];\n\tonAllyCriticalHit?: ((this: Battle, pokemon: Pokemon, source: null, move: ActiveMove) => boolean | void) | boolean;\n\tonAllyDamage?: (\n\t\tthis: Battle, damage: number, target: Pokemon, source: Pokemon, effect: Effect\n\t) => number | boolean | null | void;\n\tonAllyDeductPP?: (this: Battle, target: Pokemon, source: Pokemon) => number | void;\n\tonAllyDisableMove?: (this: Battle, pokemon: Pokemon) => void;\n\tonAllyDragOut?: (this: Battle, pokemon: Pokemon, source?: Pokemon, move?: ActiveMove) => void;\n\tonAllyEatItem?: (this: Battle, item: Item, pokemon: Pokemon) => void;\n\tonAllyEffectiveness?: MoveEventMethods['onEffectiveness'];\n\tonAllyFaint?: CommonHandlers['VoidEffect'];\n\tonAllyFlinch?: ((this: Battle, pokemon: Pokemon) => boolean | void) | boolean;\n\tonAllyHit?: MoveEventMethods['onHit'];\n\tonAllyImmunity?: (this: Battle, type: string, pokemon: Pokemon) => void;\n\tonAllyLockMove?: string | ((this: Battle, pokemon: Pokemon) => void | string);\n\tonAllyMaybeTrapPokemon?: (this: Battle, pokemon: Pokemon) => void;\n\tonAllyModifyAccuracy?: CommonHandlers['ModifierMove'];\n\tonAllyModifyAtk?: CommonHandlers['ModifierSourceMove'];\n\tonAllyModifyBoost?: (this: Battle, boosts: SparseBoostsTable, pokemon: Pokemon) => SparseBoostsTable | void;\n\tonAllyModifyCritRatio?: CommonHandlers['ModifierSourceMove'];\n\tonAllyModifyDamage?: CommonHandlers['ModifierSourceMove'];\n\tonAllyModifyDef?: CommonHandlers['ModifierMove'];\n\tonAllyModifyMove?: MoveEventMethods['onModifyMove'];\n\tonAllyModifyPriority?: CommonHandlers['ModifierSourceMove'];\n\tonAllyModifySecondaries?: (\n\t\tthis: Battle, secondaries: SecondaryEffect[], target: Pokemon, source: Pokemon, move: ActiveMove\n\t) => void;\n\tonAllyModifySpA?: CommonHandlers['ModifierSourceMove'];\n\tonAllyModifySpD?: CommonHandlers['ModifierMove'];\n\tonAllyModifySpe?: (this: Battle, spe: number, pokemon: Pokemon) => number | void;\n\tonAllyModifySTAB?: CommonHandlers['ModifierSourceMove'];\n\tonAllyModifyType?: MoveEventMethods['onModifyType'];\n\tonAllyModifyTarget?: MoveEventMethods['onModifyTarget'];\n\tonAllyModifyWeight?: (this: Battle, weighthg: number, pokemon: Pokemon) => number | void;\n\tonAllyMoveAborted?: CommonHandlers['VoidMove'];\n\tonAllyNegateImmunity?: ((this: Battle, pokemon: Pokemon, type: string) => boolean | void) | boolean;\n\tonAllyOverrideAction?: (this: Battle, pokemon: Pokemon, target: Pokemon, move: ActiveMove) => string | void;\n\tonAllyPrepareHit?: CommonHandlers['ResultSourceMove'];\n\tonAllyRedirectTarget?: (\n\t\tthis: Battle, target: Pokemon, source: Pokemon, source2: Effect, move: ActiveMove\n\t) => Pokemon | void;\n\tonAllyResidual?: (this: Battle, target: Pokemon & Side, source: Pokemon, effect: Effect) => void;\n\tonAllySetAbility?: (this: Battle, ability: string, target: Pokemon, source: Pokemon, effect: Effect) => boolean | void;\n\tonAllySetStatus?: (\n\t\tthis: Battle, status: Condition, target: Pokemon, source: Pokemon, effect: Effect\n\t) => boolean | null | void;\n\tonAllySetWeather?: (this: Battle, target: Pokemon, source: Pokemon, weather: Condition) => boolean | void;\n\tonAllySideConditionStart?: (this: Battle, target: Pokemon, source: Pokemon, sideCondition: Condition) => void;\n\tonAllyStallMove?: (this: Battle, pokemon: Pokemon) => boolean | void;\n\tonAllySwitchOut?: (this: Battle, pokemon: Pokemon) => void;\n\tonAllyTakeItem?: (\n\t\t(this: Battle, item: Item, pokemon: Pokemon, source: Pokemon, move?: ActiveMove) => boolean | void\n\t) | boolean;\n\tonAllyTerrain?: (this: Battle, pokemon: Pokemon) => void;\n\tonAllyTrapPokemon?: (this: Battle, pokemon: Pokemon) => void;\n\tonAllyTryAddVolatile?: (\n\t\tthis: Battle, status: Condition, target: Pokemon, source: Pokemon, sourceEffect: Effect\n\t) => boolean | null | void;\n\tonAllyTryEatItem?: boolean | ((this: Battle, item: Item, pokemon: Pokemon) => boolean | void);\n\t/* FIXME: onAllyTryHeal() is run with two different sets of arguments */\n\tonAllyTryHeal?: (\n\t\t((this: Battle, relayVar: number, target: Pokemon, source: Pokemon, effect: Effect) => number | boolean | void) |\n\t\t((this: Battle, pokemon: Pokemon) => boolean | void) | boolean\n\t);\n\tonAllyTryHit?: MoveEventMethods['onTryHit'];\n\tonAllyTryHitField?: MoveEventMethods['onTryHitField'];\n\tonAllyTryHitSide?: CommonHandlers['ResultMove'];\n\tonAllyInvulnerability?: CommonHandlers['ExtResultMove'];\n\tonAllyTryMove?: MoveEventMethods['onTryMove'];\n\tonAllyTryPrimaryHit?: (\n\t\tthis: Battle, target: Pokemon, source: Pokemon, move: ActiveMove\n\t) => boolean | null | number | void;\n\tonAllyType?: (this: Battle, types: string[], pokemon: Pokemon) => string[] | void;\n\tonAllyWeatherModifyDamage?: CommonHandlers['ModifierSourceMove'];\n\tonAllyModifyDamagePhase1?: CommonHandlers['ModifierSourceMove'];\n\tonAllyModifyDamagePhase2?: CommonHandlers['ModifierSourceMove'];\n}\nexport interface SideEventMethods extends EventMethods {\n\tonSideStart?: (this: Battle, target: Side, source: Pokemon, sourceEffect: Effect) => void;\n\tonSideRestart?: (this: Battle, target: Side, source: Pokemon, sourceEffect: Effect) => void;\n\tonSideResidual?: (this: Battle, target: Side, source: Pokemon, effect: Effect) => void;\n\tonSideEnd?: (this: Battle, target: Side) => void;\n\tonSideResidualOrder?: number;\n\tonSideResidualPriority?: number;\n\tonSideResidualSubOrder?: number;\n}\nexport interface FieldEventMethods extends EventMethods {\n\tonFieldStart?: (this: Battle, target: Field, source: Pokemon, sourceEffect: Effect) => void;\n\tonFieldRestart?: (this: Battle, target: Field, source: Pokemon, sourceEffect: Effect) => void;\n\tonFieldResidual?: (this: Battle, target: Field, source: Pokemon, effect: Effect) => void;\n\tonFieldEnd?: (this: Battle, target: Field) => void;\n\tonFieldResidualOrder?: number;\n\tonFieldResidualPriority?: number;\n\tonFieldResidualSubOrder?: number;\n}\nexport interface PokemonConditionData extends Partial, PokemonEventMethods {}\nexport interface SideConditionData extends\n\tPartial>, SideEventMethods {}\nexport interface FieldConditionData extends\n\tPartial>, FieldEventMethods {}\n\nexport type ConditionData = PokemonConditionData | SideConditionData | FieldConditionData;\n\nexport type ModdedConditionData = ConditionData & { inherit?: true };\nexport interface ConditionDataTable { [id: IDEntry]: ConditionData }\nexport interface ModdedConditionDataTable { [id: IDEntry]: ModdedConditionData }\n\nexport class Condition extends BasicEffect implements\n\tReadonly {\n\tdeclare readonly effectType: 'Condition' | 'Weather' | 'Status' | 'Terastal';\n\tdeclare readonly counterMax?: number;\n\tdeclare effectOrder?: number;\n\n\tdeclare readonly durationCallback?: (this: Battle, target: Pokemon, source: Pokemon, effect: Effect | null) => number;\n\tdeclare readonly onCopy?: (this: Battle, pokemon: Pokemon) => void;\n\tdeclare readonly onEnd?: (this: Battle, target: Pokemon) => void;\n\tdeclare readonly onRestart?: (\n\t\tthis: Battle, target: Pokemon, source: Pokemon, sourceEffect: Effect\n\t) => boolean | null | void;\n\tdeclare readonly onStart?: (\n\t\tthis: Battle, target: Pokemon, source: Pokemon, sourceEffect: Effect\n\t) => boolean | null | void;\n\n\tconstructor(data: AnyObject) {\n\t\tsuper(data);\n\t\tthis.effectType = (['Weather', 'Status'].includes(data.effectType) ? data.effectType : 'Condition');\n\t\tassignMissingFields(this, data);\n\t}\n}\n\nconst EMPTY_CONDITION: Condition = Utils.deepFreeze(new Condition({ name: '', exists: false }));\n\nexport class DexConditions {\n\treadonly dex: ModdedDex;\n\treadonly conditionCache = new Map();\n\n\tconstructor(dex: ModdedDex) {\n\t\tthis.dex = dex;\n\t}\n\n\tget(name?: string | Effect | null): Condition {\n\t\tif (!name) return EMPTY_CONDITION;\n\t\tif (typeof name !== 'string') return name as Condition;\n\n\t\treturn this.getByID(name.startsWith('item:') || name.startsWith('ability:') ? name as ID : toID(name));\n\t}\n\n\tgetByID(id: ID): Condition {\n\t\tif (id === '') return EMPTY_CONDITION;\n\n\t\tlet condition = this.conditionCache.get(id);\n\t\tif (condition) return condition;\n\n\t\tlet found;\n\t\tif (id.startsWith('item:')) {\n\t\t\tconst item = this.dex.items.getByID(id.slice(5) as ID);\n\t\t\tcondition = { ...item, id: 'item:' + item.id as ID } as any as Condition;\n\t\t} else if (id.startsWith('ability:')) {\n\t\t\tconst ability = this.dex.abilities.getByID(id.slice(8) as ID);\n\t\t\tcondition = { ...ability, id: 'ability:' + ability.id as ID } as any as Condition;\n\t\t} else if (this.dex.data.Rulesets.hasOwnProperty(id)) {\n\t\t\tcondition = this.dex.formats.get(id) as any as Condition;\n\t\t\t// formats can't be frozen if they don't have a ruleTable\n\t\t\tthis.conditionCache.set(id, condition);\n\t\t\treturn condition;\n\t\t} else if (this.dex.data.Conditions.hasOwnProperty(id)) {\n\t\t\tcondition = new Condition({ name: id, ...this.dex.data.Conditions[id] });\n\t\t} else if (\n\t\t\t(this.dex.data.Moves.hasOwnProperty(id) && (found = this.dex.data.Moves[id]).condition) ||\n\t\t\t(this.dex.data.Abilities.hasOwnProperty(id) && (found = this.dex.data.Abilities[id]).condition) ||\n\t\t\t(this.dex.data.Items.hasOwnProperty(id) && (found = this.dex.data.Items[id]).condition)\n\t\t) {\n\t\t\tcondition = new Condition({ name: found.name || id, ...found.condition });\n\t\t} else if (id === 'recoil') {\n\t\t\tcondition = new Condition({ name: 'Recoil', effectType: 'Recoil' });\n\t\t} else if (id === 'drain') {\n\t\t\tcondition = new Condition({ name: 'Drain', effectType: 'Drain' });\n\t\t} else {\n\t\t\tcondition = new Condition({ name: id, exists: false });\n\t\t}\n\n\t\tthis.conditionCache.set(id, this.dex.deepFreeze(condition));\n\t\treturn condition;\n\t}\n}\n"], "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAsB;AACtB,sBAAuD;AA6mBhD,MAAM,kBAAkB,4BACwD;AAAA,EAetF,YAAY,MAAiB;AAC5B,UAAM,IAAI;AACV,SAAK,aAAc,CAAC,WAAW,QAAQ,EAAE,SAAS,KAAK,UAAU,IAAI,KAAK,aAAa;AACvF,6CAAoB,MAAM,IAAI;AAAA,EAC/B;AACD;AAEA,MAAM,kBAA6B,mBAAM,WAAW,IAAI,UAAU,EAAE,MAAM,IAAI,QAAQ,MAAM,CAAC,CAAC;AAEvF,MAAM,cAAc;AAAA,EAI1B,YAAY,KAAgB;AAF5B,SAAS,iBAAiB,oBAAI,IAAmB;AAGhD,SAAK,MAAM;AAAA,EACZ;AAAA,EAEA,IAAI,MAA0C;AAC7C,QAAI,CAAC;AAAM,aAAO;AAClB,QAAI,OAAO,SAAS;AAAU,aAAO;AAErC,WAAO,KAAK,QAAQ,KAAK,WAAW,OAAO,KAAK,KAAK,WAAW,UAAU,IAAI,WAAa,sBAAK,IAAI,CAAC;AAAA,EACtG;AAAA,EAEA,QAAQ,IAAmB;AAC1B,QAAI,OAAO;AAAI,aAAO;AAEtB,QAAI,YAAY,KAAK,eAAe,IAAI,EAAE;AAC1C,QAAI;AAAW,aAAO;AAEtB,QAAI;AACJ,QAAI,GAAG,WAAW,OAAO,GAAG;AAC3B,YAAM,OAAO,KAAK,IAAI,MAAM,QAAQ,GAAG,MAAM,CAAC,CAAO;AACrD,kBAAY,EAAE,GAAG,MAAM,IAAI,UAAU,KAAK,GAAS;AAAA,IACpD,WAAW,GAAG,WAAW,UAAU,GAAG;AACrC,YAAM,UAAU,KAAK,IAAI,UAAU,QAAQ,GAAG,MAAM,CAAC,CAAO;AAC5D,kBAAY,EAAE,GAAG,SAAS,IAAI,aAAa,QAAQ,GAAS;AAAA,IAC7D,WAAW,KAAK,IAAI,KAAK,SAAS,eAAe,EAAE,GAAG;AACrD,kBAAY,KAAK,IAAI,QAAQ,IAAI,EAAE;AAEnC,WAAK,eAAe,IAAI,IAAI,SAAS;AACrC,aAAO;AAAA,IACR,WAAW,KAAK,IAAI,KAAK,WAAW,eAAe,EAAE,GAAG;AACvD,kBAAY,IAAI,UAAU,EAAE,MAAM,IAAI,GAAG,KAAK,IAAI,KAAK,WAAW,EAAE,EAAE,CAAC;AAAA,IACxE,WACE,KAAK,IAAI,KAAK,MAAM,eAAe,EAAE,MAAM,QAAQ,KAAK,IAAI,KAAK,MAAM,EAAE,GAAG,aAC5E,KAAK,IAAI,KAAK,UAAU,eAAe,EAAE,MAAM,QAAQ,KAAK,IAAI,KAAK,UAAU,EAAE,GAAG,aACpF,KAAK,IAAI,KAAK,MAAM,eAAe,EAAE,MAAM,QAAQ,KAAK,IAAI,KAAK,MAAM,EAAE,GAAG,WAC5E;AACD,kBAAY,IAAI,UAAU,EAAE,MAAM,MAAM,QAAQ,IAAI,GAAG,MAAM,UAAU,CAAC;AAAA,IACzE,WAAW,OAAO,UAAU;AAC3B,kBAAY,IAAI,UAAU,EAAE,MAAM,UAAU,YAAY,SAAS,CAAC;AAAA,IACnE,WAAW,OAAO,SAAS;AAC1B,kBAAY,IAAI,UAAU,EAAE,MAAM,SAAS,YAAY,QAAQ,CAAC;AAAA,IACjE,OAAO;AACN,kBAAY,IAAI,UAAU,EAAE,MAAM,IAAI,QAAQ,MAAM,CAAC;AAAA,IACtD;AAEA,SAAK,eAAe,IAAI,IAAI,KAAK,IAAI,WAAW,SAAS,CAAC;AAC1D,WAAO;AAAA,EACR;AACD;", "names": [] }