From 47350dcca2126270f8f9663466a2fa7b100773bd Mon Sep 17 00:00:00 2001 From: flx-sta <50131232+flx-sta@users.noreply.github.com> Date: Mon, 30 Sep 2024 13:27:34 -0700 Subject: [PATCH] chore: fix namings, types and docs suggested by @torranx --- src/battle-scene.ts | 6 +++--- src/modifier/modifier.ts | 17 ++++++----------- 2 files changed, 9 insertions(+), 14 deletions(-) diff --git a/src/battle-scene.ts b/src/battle-scene.ts index 78296e3d387..6fcaea1a8fc 100644 --- a/src/battle-scene.ts +++ b/src/battle-scene.ts @@ -2785,11 +2785,11 @@ export default class BattleScene extends SceneBase { /** * Get all of the modifiers that pass the `modifierFilter` function * @param modifierFilter The function used to filter a target's modifiers - * @param player Whether to search the player (`true`) or the enemy (`false`); Defaults to `true` + * @param isPlayer Whether to search the player (`true`) or the enemy (`false`); Defaults to `true` * @returns the list of all modifiers that passed the `modifierFilter` function */ - findModifiers(modifierFilter: ModifierPredicate, player: boolean = true): PersistentModifier[] { - return (player ? this.modifiers : this.enemyModifiers).filter(modifierFilter); + findModifiers(modifierFilter: ModifierPredicate, isPlayer: boolean = true): PersistentModifier[] { + return (isPlayer ? this.modifiers : this.enemyModifiers).filter(modifierFilter); } /** diff --git a/src/modifier/modifier.ts b/src/modifier/modifier.ts index 0f2e0c3010e..3a05e3ba32f 100644 --- a/src/modifier/modifier.ts +++ b/src/modifier/modifier.ts @@ -142,7 +142,7 @@ export abstract class Modifier { } /** - * Checks if {@linkcode Modifier} should applied + * Checks if {@linkcode Modifier} should be applied * @param _args parameters passed to {@linkcode Modifier#apply} * @returns always `true` by default */ @@ -485,7 +485,7 @@ export class TempStatStageBoosterModifier extends LapsingPersistentModifier { * @param statLevel {@linkcode Utils.NumberHolder} that holds the resulting value of the stat stage multiplier * @returns `true` if the modifier can be applied, false otherwise */ - override shouldApply(tempBattleStat?: TempBattleStat, statLevel?: Utils.IntegerHolder): boolean { + override shouldApply(tempBattleStat?: TempBattleStat, statLevel?: Utils.NumberHolder): boolean { return !!tempBattleStat && !!statLevel && TEMP_BATTLE_STATS.includes(tempBattleStat) && (tempBattleStat === this.stat) && (statLevel instanceof Utils.NumberHolder); } @@ -494,7 +494,7 @@ export class TempStatStageBoosterModifier extends LapsingPersistentModifier { * @param _tempBattleStat {@linkcode TempBattleStat} N/A * @param statLevel {@linkcode Utils.NumberHolder} that holds the resulting value of the stat stage multiplier */ - override apply(_tempBattleStat: TempBattleStat, statLevel: Utils.IntegerHolder): boolean { + override apply(_tempBattleStat: TempBattleStat, statLevel: Utils.NumberHolder): boolean { statLevel.value += this.boost; return true; } @@ -524,16 +524,16 @@ export class TempCritBoosterModifier extends LapsingPersistentModifier { * @param critLevel {@linkcode Utils.NumberHolder} N/A * @returns `true` if the critical-hit stage boost applies successfully */ - override shouldApply(critLevel?: Utils.IntegerHolder): boolean { + override shouldApply(critLevel?: Utils.NumberHolder): boolean { return !!critLevel && (critLevel instanceof Utils.NumberHolder); } /** * Increases the current critical-hit stage value by 1. - * @param critLevel {@linkcode Utils.IntegerHolder} that holds the resulting critical-hit level + * @param critLevel {@linkcode Utils.NumberHolder} that holds the resulting critical-hit level * @returns `true` if the critical-hit stage boost applies successfully */ - override apply(critLevel: Utils.IntegerHolder): boolean { + override apply(critLevel: Utils.NumberHolder): boolean { critLevel.value++; return true; } @@ -566,11 +566,6 @@ export class MegaEvolutionAccessModifier extends PersistentModifier { return new MegaEvolutionAccessModifier(this.type, this.stackCount); } - /** - * Apply {@linkcode MegaEvolutionAccessModifier} - * @param _args N/A - * @returns always `true` - */ override apply(..._args: unknown[]): boolean { return true; }