From e5964743aa8fbe8105598e1cfb302368ebfcf0c9 Mon Sep 17 00:00:00 2001 From: td76099 Date: Sun, 19 May 2024 00:38:19 -0400 Subject: [PATCH] Adding doc comments based on new standard --- src/data/ability.ts | 41 +++++++++++++++++++++++++++++++++++------ 1 file changed, 35 insertions(+), 6 deletions(-) diff --git a/src/data/ability.ts b/src/data/ability.ts index b71bdb75561..ed59b445647 100644 --- a/src/data/ability.ts +++ b/src/data/ability.ts @@ -2254,19 +2254,48 @@ export class RunSuccessAbAttr extends AbAttr { } } +/** + * Base class for checking if a Pokemon is trapped by arena trap + * @extends AbAttr + * @see {@linkcode applyCheckTrapped} + */ export class CheckTrappedAbAttr extends AbAttr { constructor() { super(false); } - - applyCheckTrapped(pokemon: Pokemon, passive: boolean, trapped: Utils.BooleanHolder, otherPokemon: Pokemon[], args: any[]): boolean | Promise { + /** + * Checks if enemy Pokemon is trapped by an Arena Trap-esque ability + * @param pokemon N/A + * @param passive N/A + * @param trapped N/A + * @param otherPokemon N/A + * @param args N/A + * @returns if enemy Pokemon is trapped or not + */ + applyCheckTrapped(pokemon: Pokemon, passive: boolean, trapped: Utils.BooleanHolder, otherPokemon: Pokemon, args: any[]): boolean | Promise { return false; } } + +/** + * Determines whether a Pokemon is blocked from switching/running away + * because of a trapping ability or move. + * @extends CheckTrappedAbAttr + * @see {@linkcode applyCheckTrapped} + */ export class ArenaTrapAbAttr extends CheckTrappedAbAttr { - applyCheckTrapped(pokemon: Pokemon, passive: boolean, trapped: Utils.BooleanHolder, otherPokemon: Pokemon[], args: any[]): boolean { - if (otherPokemon[0].getTypes().includes(Type.GHOST)){ + /** + * Checks if enemy Pokemon is trapped by an Arena Trap-esque ability + * @param pokemon The {@link Pokemon} with this {@link AbAttr} + * @param passive N/A + * @param trapped {@link Utils.BooleanHolder} indicating whether the other Pokemon is trapped or not + * @param otherPokemon The {@link Pokemon} that is affected by an Arena Trap ability + * @param args N/A + * @returns if enemy Pokemon is trapped or not + */ + applyCheckTrapped(pokemon: Pokemon, passive: boolean, trapped: Utils.BooleanHolder, otherPokemon: Pokemon, args: any[]): boolean { + if (otherPokemon.getTypes().includes(Type.GHOST)){ trapped.value = false; return false; } @@ -2735,8 +2764,8 @@ export function applyPostTerrainChangeAbAttrs(attrType: { new(...args: any[]): P } export function applyCheckTrappedAbAttrs(attrType: { new(...args: any[]): CheckTrappedAbAttr }, - pokemon: Pokemon, trapped: Utils.BooleanHolder, ...args: any[]): Promise { - return applyAbAttrsInternal(attrType, pokemon, (attr, passive) => attr.applyCheckTrapped(pokemon, passive, trapped, args), args, true); + pokemon: Pokemon, trapped: Utils.BooleanHolder, otherPokemon: Pokemon, ...args: any[]): Promise { + return applyAbAttrsInternal(attrType, pokemon, (attr, passive) => attr.applyCheckTrapped(pokemon, passive, trapped, otherPokemon, args), args, true); } export function applyPostBattleAbAttrs(attrType: { new(...args: any[]): PostBattleAbAttr },