From 94aeacfa47d3fe7dc89b48d310189ab5ada68716 Mon Sep 17 00:00:00 2001 From: Mumble <171087428+frutescens@users.noreply.github.com> Date: Tue, 1 Oct 2024 21:21:35 -0700 Subject: [PATCH] Apply suggestions from code review Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> --- src/data/arena-tag.ts | 15 ++++++--------- src/data/battler-tags.ts | 11 ++++------- 2 files changed, 10 insertions(+), 16 deletions(-) diff --git a/src/data/arena-tag.ts b/src/data/arena-tag.ts index 810cadc3a2a..9b6262ed14e 100644 --- a/src/data/arena-tag.ts +++ b/src/data/arena-tag.ts @@ -965,19 +965,16 @@ class ImprisonTag extends ArenaTrapTag { /** * Helper function that retrieves the source Pokemon - * @param {BattleScene} scene medium to retrieve the source Pokemon - * @returns {Pokemon} pokemon or undefined + * @param scene medium to retrieve the source Pokemon + * @returns The source {@linkcode Pokemon} or `null` if none is found */ - private retrieveSource(scene: BattleScene): Pokemon | undefined { - if (this.sourceId) { - return scene.getPokemonById(this.sourceId) ?? undefined; - } - return undefined; + private retrieveSource(scene: BattleScene): Pokemon | null { + return this.sourceId ? scene.getPokemonById(this.sourceId) : null; } /** * Helper function that retrieves the Pokemon affected - * @param {BattleScene} scene medium to retrieve the involved Pokemon + * @param scene medium to retrieve the involved Pokemon * @returns list of opposing Pokemon on the field */ private retrieveField(scene: BattleScene): PlayerPokemon[] | EnemyPokemon[] { @@ -1004,7 +1001,7 @@ class ImprisonTag extends ArenaTrapTag { * @param _arena * @returns `true` if the source of the tag is still active on the field | `false` if not */ - override lapse({ scene }: Arena): boolean { + override lapse({ scene }: BattleScene): boolean { const source = this.retrieveSource(scene); return source ? source.isActive(true) : false; } diff --git a/src/data/battler-tags.ts b/src/data/battler-tags.ts index 1ade248ff84..0f05c1296d9 100644 --- a/src/data/battler-tags.ts +++ b/src/data/battler-tags.ts @@ -332,7 +332,7 @@ export class GorillaTacticsTag extends MoveRestrictionBattlerTag { /** * Loads the Gorilla Tactics Battler Tag along with its unique class variable moveId * @override - * @param source {@linkcode BattlerTag} Gorilla Tactic's Battler Tag information + * @param source Gorilla Tactics' {@linkcode BattlerTag} information */ override loadTag(source: BattlerTag | any): void { super.loadTag(source); @@ -2633,13 +2633,10 @@ export class ImprisonTag extends MoveRestrictionBattlerTag { /** * Helper function that retrieves the source Pokemon object * @param scene medium to retrieve the source Pokemon - * @returns source pokemon {@linkcode Pokemon} or undefined + * @returns The source {@linkcode Pokemon} or `null` if none is found */ - private retrieveSource(scene: BattleScene): Pokemon | undefined { - if (this.sourceId) { - return scene.getPokemonById(this.sourceId) ?? undefined; - } - return undefined; + private retrieveSource(scene: BattleScene): Pokemon | null { + return this.sourceId ? scene.getPokemonById(this.sourceId) : null; } }