From b6a7bd1b2d08a238f6e09a5c3ee6e058d5faf21e Mon Sep 17 00:00:00 2001 From: Dean Date: Wed, 19 Feb 2025 12:18:01 -0800 Subject: [PATCH] Add PreLeaveField attr for neutralizing gas --- src/data/ability.ts | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/src/data/ability.ts b/src/data/ability.ts index 5a23093be19..bf555bd215a 100644 --- a/src/data/ability.ts +++ b/src/data/ability.ts @@ -12,7 +12,7 @@ import { getNonVolatileStatusEffects, getStatusEffectDescriptor, getStatusEffect import { Gender } from "./gender"; import type Move from "./move"; import { AttackMove, MoveCategory, MoveFlags, MoveTarget, FlinchAttr, OneHitKOAttr, HitHealAttr, allMoves, StatusMove, SelfStatusMove, VariablePowerAttr, applyMoveAttrs, VariableMoveTypeAttr, RandomMovesetMoveAttr, RandomMoveAttr, NaturePowerAttr, CopyMoveAttr, NeutralDamageAgainstFlyingTypeMultiplierAttr, FixedDamageAttr } from "./move"; -import type { ArenaTrapTag } from "./arena-tag"; +import type { ArenaTrapTag, SuppressAbilitiesTag } from "./arena-tag"; import { ArenaTagSide } from "./arena-tag"; import { BerryModifier, HitHealModifier, PokemonHeldItemModifier } from "../modifier/modifier"; import { TerrainType } from "./terrain"; @@ -2779,6 +2779,23 @@ export class PreLeaveFieldClearWeatherAbAttr extends PreLeaveFieldAbAttr { } } +export class PreLeaveFieldRemoveSuppressAbilitiesSourceAbAttr extends PreLeaveFieldAbAttr { + constructor() { + super(false); + } + + applyPreLeaveField(pokemon: Pokemon, passive: boolean, simulated: boolean, args: any[]): boolean | Promise { + if (!simulated) { + const suppressTag = globalScene.arena.getTag(ArenaTagType.NEUTRALIZING_GAS) as SuppressAbilitiesTag; + if (suppressTag) { + suppressTag.onSourceLeave(globalScene.arena); + } + return false; + } + return true; + } +} + export class PreStatStageChangeAbAttr extends AbAttr { applyPreStatStageChange(pokemon: Pokemon | null, passive: boolean, simulated: boolean, stat: BattleStat, cancelled: Utils.BooleanHolder, args: any[]): boolean | Promise { return false; @@ -6247,7 +6264,8 @@ export function initAbilities() { new Ability(Abilities.GORILLA_TACTICS, 8) .attr(GorillaTacticsAbAttr), new Ability(Abilities.NEUTRALIZING_GAS, 8) - .attr(SuppressFieldAbilitiesAbAttr) + .attr(PostSummonAddArenaTagAbAttr, ArenaTagType.NEUTRALIZING_GAS, 0) + .attr(PreLeaveFieldRemoveSuppressAbilitiesSourceAbAttr) .attr(UncopiableAbilityAbAttr) .attr(UnswappableAbilityAbAttr) .attr(NoTransformAbilityAbAttr)