From 89e49128897e0be83b3cd36fba8acfbf4557dccf Mon Sep 17 00:00:00 2001 From: Dean Date: Sat, 1 Feb 2025 22:59:05 -0800 Subject: [PATCH] Update PostTerrainChange --- src/data/ability.ts | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/data/ability.ts b/src/data/ability.ts index f2a3d304aea..5341a776c56 100644 --- a/src/data/ability.ts +++ b/src/data/ability.ts @@ -3514,6 +3514,10 @@ export class PostWeatherLapseDamageAbAttr extends PostWeatherLapseAbAttr { } export class PostTerrainChangeAbAttr extends AbAttr { + willSucceedPostTerrainChange(pokemon: Pokemon, passive: boolean, simulated: boolean, terrain: TerrainType, args: any[]): boolean { + return true; + } + applyPostTerrainChange(pokemon: Pokemon, passive: boolean, simulated: boolean, terrain: TerrainType, args: any[]): boolean { return false; } @@ -3532,11 +3536,11 @@ export class PostTerrainChangeAddBattlerTagAttr extends PostTerrainChangeAbAttr this.terrainTypes = terrainTypes; } - applyPostTerrainChange(pokemon: Pokemon, passive: boolean, simulated: boolean, terrain: TerrainType, args: any[]): boolean { - if (!this.terrainTypes.find(t => t === terrain)) { - return false; - } + willSucceedPostTerrainChange(pokemon: Pokemon, passive: boolean, simulated: boolean, terrain: TerrainType, args: any[]): boolean { + return !!this.terrainTypes.find(t => t === terrain) && pokemon.canAddTag(this.tagType); + } + applyPostTerrainChange(pokemon: Pokemon, passive: boolean, simulated: boolean, terrain: TerrainType, args: any[]): boolean { if (simulated) { return pokemon.canAddTag(this.tagType); } else { @@ -5394,7 +5398,8 @@ export function applyPostWeatherLapseAbAttrs(attrType: Constructor, pokemon: Pokemon, terrain: TerrainType, simulated: boolean = false, ...args: any[]): Promise { - return applyAbAttrsInternal(attrType, pokemon, (attr, passive) => attr.applyPostTerrainChange(pokemon, passive, simulated, terrain, args), args, false, simulated); + return applyAbAttrsInternal(attrType, pokemon, (attr, passive) => attr.applyPostTerrainChange(pokemon, passive, simulated, terrain, args), + (attr, passive) => attr.willSucceedPostTerrainChange(pokemon, passive, simulated, terrain, args), args, false, simulated); } export function applyCheckTrappedAbAttrs(attrType: Constructor,