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