From 6000c494a7c6f5fce3bbcc74c3e6d2f4519b447b Mon Sep 17 00:00:00 2001 From: notpatchmaybe <104580041+notpatchmaybe@users.noreply.github.com> Date: Fri, 10 May 2024 17:06:27 +0100 Subject: [PATCH] TSDoc commentation added --- src/data/move.ts | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/src/data/move.ts b/src/data/move.ts index d40b615c571..30b23dd3423 100644 --- a/src/data/move.ts +++ b/src/data/move.ts @@ -1775,18 +1775,29 @@ export class ResetStatsAttr extends MoveEffectAttr { } } +/** + * Attribute used for moves which swap the user and the target's stat changes. + */ export class SwapStatsAttr extends MoveEffectAttr { + /** + * Swaps the user and the target's stat changes. + * @param user Pokemon that used the move + * @param target The target of the move + * @param move Move with this attribute + * @param args N/A + * @returns true if the function succeeds + */ apply(user: Pokemon, target: Pokemon, move: Move, args: any []): boolean { if (!super.apply(user, target, move, args)) - return false; - let priorBoostArray : integer[] = [ 0, 0, 0, 0, 0, 0, 0 ]; + return false; //Exits if the move can't apply + let priorBoostArray : integer[] = [ 0, 0, 0, 0, 0, 0, 0 ]; //For storing user stat boosts for (let s = 0; s < target.summonData.battleStats.length; s++) { - priorBoostArray[s] = user.summonData.battleStats[s]; - user.summonData.battleStats[s] = target.summonData.battleStats[s]; - target.summonData.battleStats[s] = priorBoostArray[s]; + priorBoostArray[s] = user.summonData.battleStats[s]; //Store user stat boosts + user.summonData.battleStats[s] = target.summonData.battleStats[s]; //Applies target boosts to self + target.summonData.battleStats[s] = priorBoostArray[s]; //Applies stored boosts to target } target.updateInfo(); user.updateInfo();