Add JSDocs Comments

This commit is contained in:
brandonarude 2024-05-20 10:42:19 -07:00
parent 8e385b3acf
commit 2edc5bfdf7

View File

@ -1644,16 +1644,36 @@ export class SunlightChargeAttr extends ChargeAttr {
}
}
/**
*
* Special handler for the Sky Drop Move
* @extends ChargeAttr
* @see {@link firstTurn}
* @see {@linkcode secondTurnText}
* @see {@linkcode apply}
* @see {@linkcode getCondition}
*
*/
export class SkyDropChargeAttr extends ChargeAttr {
/** Add a flag because ChargeAttr skills use themselves twice instead of once over one-to-two turns */
private firstTurn: boolean;
/** Holder for Battle Message when the Target is released */
private secondTurnText: string;
constructor() {
super(ChargeAnim.SKY_DROP_CHARGING, 'took {TARGET}\ninto the sky!', BattlerTagType.FLYING, true);
// Add a flag because ChargeAttr skills use themselves twice instead of once over one-to-two turns
this.firstTurn = true;
this.secondTurnText = "The {TARGET} was freed from the Sky Drop!"
this.secondTurnText = "The {TARGET} was freed from the Sky Drop!";
}
/**
* Extends the apply function to allow for different battle messages between the
* first and second turns.
* @param user The {@linkcode Pokemon} using Sky Drop
* @param target The {@linkcode Pokemon} targeted by the Sky Drop attack
* @param move the {@linkcode Move} being used (i.e. Sky Drop)
* @param args Any Additional Args
*/
apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): Promise<boolean> {
return new Promise(resolve => {
if(this.firstTurn){
@ -1668,6 +1688,11 @@ export class SkyDropChargeAttr extends ChargeAttr {
});
};
/**
* Check Target's weight and cause Sky Drop to fail is the target is more than 200kg
* @param target The {@linkcode Pokemon} targeted by the attack
* @returns false if the target is 200kg or more
*/
getCondition(): MoveConditionFunc{
return (user, target, move) => target.getWeight() < 200;
}