diff --git a/src/data/ability.ts b/src/data/ability.ts index 5fad3e4ba..2af4effef 100644 --- a/src/data/ability.ts +++ b/src/data/ability.ts @@ -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 { diff --git a/src/data/arena-tag.ts b/src/data/arena-tag.ts index 42ae8215c..929da1c4e 100644 --- a/src/data/arena-tag.ts +++ b/src/data/arena-tag.ts @@ -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!`); diff --git a/src/field/pokemon.ts b/src/field/pokemon.ts index 602354f75..cf181580a 100644 --- a/src/field/pokemon.ts +++ b/src/field/pokemon.ts @@ -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) diff --git a/src/phases.ts b/src/phases.ts index e34670e7b..b0f79af45 100644 --- a/src/phases.ts +++ b/src/phases.ts @@ -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;