Added TSDoc Documentation

Added documentation to the 3 new Ally classes to cover allies with the ability.
pull/754/head
Dread134 2024-05-12 14:02:15 -04:00
parent f930f733b2
commit 5f0942b7a5
4 changed files with 15 additions and 4 deletions

View File

@ -1646,6 +1646,10 @@ export class ProtectStatAbAttr extends PreStatChangeAbAttr {
}
}
/**
* Extends from {@link ProtectStatAbAttr} to allow abilities to mark that they can protect allies from stat changes.
* Requires the Affected Pokemon to then check if ally has any ability with this attribute and apply the effect.
*/
export class AllyProtectStatAbAttr extends ProtectStatAbAttr { }
export class PreSetStatusAbAttr extends AbAttr {
@ -1677,6 +1681,10 @@ export class StatusEffectImmunityAbAttr extends PreSetStatusAbAttr {
}
}
/**
* Extends from {@link StatusEffectImmunityAbAttr} to allow abilities to mark that they can protect allies from status effects.
* Requires the Affected Pokemon to then check if ally has any ability with this attribute and apply the effect.
*/
export class AllyStatusEffectImmunityAbAttr extends StatusEffectImmunityAbAttr { }
export class PreApplyBattlerTagAbAttr extends AbAttr {
@ -1708,6 +1716,10 @@ export class BattlerTagImmunityAbAttr extends PreApplyBattlerTagAbAttr {
}
}
/**
* Extends from {@link BattlerTagImmunityAbAttr} to allow abilities to mark that they can protect allies from battler tags.
* Requires the Affected Pokemon to then check if ally has any ability with this attribute and apply the effect.
*/
export class AllyBattlerTagImmunityAbAttr extends BattlerTagImmunityAbAttr { }
export class BlockCritAbAttr extends AbAttr {

View File

@ -436,9 +436,8 @@ class StickyWebTag extends ArenaTrapTag {
if (pokemon.isGrounded()) {
const cancelled = new Utils.BooleanHolder(false);
applyAbAttrs(ProtectStatAbAttr, pokemon, cancelled);
if (!cancelled.value) {
if (!cancelled.value) // If Pokemon fails to protect themselves, check if ally has an ability to protect them
applyAbAttrs(AllyProtectStatAbAttr, pokemon.getAlly(), cancelled);
}
if (!cancelled.value) {
pokemon.scene.queueMessage(`The opposing ${pokemon.name} was caught in a sticky web!`);

View File

@ -2021,7 +2021,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
const cancelled = new Utils.BooleanHolder(false);
applyPreSetStatusAbAttrs(StatusEffectImmunityAbAttr, this, effect, cancelled, quiet);
if (!cancelled.value)
if (!cancelled.value) // If Pokemon fails to protect themselves, check if ally has an ability to protect them
applyPreSetStatusAbAttrs(AllyStatusEffectImmunityAbAttr, this.getAlly(), effect, cancelled, quiet);
if (cancelled.value)

View File

@ -2740,7 +2740,7 @@ export class StatChangePhase extends PokemonPhase {
if (!cancelled.value && !this.selfTarget && this.levels < 0)
applyPreStatChangeAbAttrs(ProtectStatAbAttr, this.getPokemon(), stat, cancelled);
if (!cancelled.value && !this.selfTarget)
if (!cancelled.value && !this.selfTarget) // If Pokemon fails to protect themselves, check if ally has an ability to protect them
applyPreStatChangeAbAttrs(AllyProtectStatAbAttr, this.getPokemon().getAlly(), stat, cancelled);
return !cancelled.value;