From 2b455bbb4ccf0cf72b8035a94cc1dbf3e3a9ecec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Bastos=20Dias?= Date: Mon, 10 Feb 2025 05:53:39 +0000 Subject: [PATCH 1/8] Wind Rider's Start event is suppressed by Mold Breaker --- data/abilities.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/data/abilities.ts b/data/abilities.ts index 98b039e4304b7..7630073ab747c 100644 --- a/data/abilities.ts +++ b/data/abilities.ts @@ -5456,6 +5456,7 @@ export const Abilities: import('../sim/dex-abilities').AbilityDataTable = { }, windrider: { onStart(pokemon) { + if (this.suppressingAbility(pokemon)) return; if (pokemon.side.sideConditions['tailwind']) { this.boost({atk: 1}, pokemon, pokemon); } From 7af41ad7cc26d096724f321e3f10a7cce83eb8fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Bastos=20Dias?= Date: Mon, 10 Feb 2025 06:49:46 +0000 Subject: [PATCH 2/8] Ice Face's Start event is suppressed by Mold Breaker --- data/abilities.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/data/abilities.ts b/data/abilities.ts index 7630073ab747c..117931710ee05 100644 --- a/data/abilities.ts +++ b/data/abilities.ts @@ -1910,6 +1910,7 @@ export const Abilities: import('../sim/dex-abilities').AbilityDataTable = { iceface: { onSwitchInPriority: -2, onStart(pokemon) { + if (this.suppressingAbility(pokemon)) return; if (this.field.isWeather(['hail', 'snow']) && pokemon.species.id === 'eiscuenoice') { this.add('-activate', pokemon, 'ability: Ice Face'); this.effectState.busted = false; From 2996c1177ecc33e4b3ac7971c0acd46933e69561 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Bastos=20Dias?= Date: Mon, 10 Feb 2025 09:16:52 +0000 Subject: [PATCH 3/8] Refactor using breakable --- data/abilities.ts | 3 --- data/mods/gen9ssb/abilities.ts | 1 - sim/battle.ts | 1 + 3 files changed, 1 insertion(+), 4 deletions(-) diff --git a/data/abilities.ts b/data/abilities.ts index 117931710ee05..03de3ad998f11 100644 --- a/data/abilities.ts +++ b/data/abilities.ts @@ -301,7 +301,6 @@ export const Abilities: import('../sim/dex-abilities').AbilityDataTable = { }, aurabreak: { onStart(pokemon) { - if (this.suppressingAbility(pokemon)) return; this.add('-ability', pokemon, 'Aura Break'); }, onAnyTryPrimaryHit(target, source, move) { @@ -1910,7 +1909,6 @@ export const Abilities: import('../sim/dex-abilities').AbilityDataTable = { iceface: { onSwitchInPriority: -2, onStart(pokemon) { - if (this.suppressingAbility(pokemon)) return; if (this.field.isWeather(['hail', 'snow']) && pokemon.species.id === 'eiscuenoice') { this.add('-activate', pokemon, 'ability: Ice Face'); this.effectState.busted = false; @@ -5457,7 +5455,6 @@ export const Abilities: import('../sim/dex-abilities').AbilityDataTable = { }, windrider: { onStart(pokemon) { - if (this.suppressingAbility(pokemon)) return; if (pokemon.side.sideConditions['tailwind']) { this.boost({atk: 1}, pokemon, pokemon); } diff --git a/data/mods/gen9ssb/abilities.ts b/data/mods/gen9ssb/abilities.ts index fd6936e0ce6fe..973becdbec454 100644 --- a/data/mods/gen9ssb/abilities.ts +++ b/data/mods/gen9ssb/abilities.ts @@ -236,7 +236,6 @@ export const Abilities: import('../../../sim/dex-abilities').ModdedAbilityDataTa desc: "Active Pokemon without this Ability have their Attack multiplied by 0.85x. This Pokemon ignores other Pokemon's stat stages when taking or doing damage.", name: "Clod of Ruin", onStart(pokemon) { - if (this.suppressingAbility(pokemon)) return; this.add('-ability', pokemon, 'Clod of Ruin'); }, onAnyModifyAtk(atk, target, source, move) { diff --git a/sim/battle.ts b/sim/battle.ts index faff5f5bb066b..0f7671640bee8 100644 --- a/sim/battle.ts +++ b/sim/battle.ts @@ -826,6 +826,7 @@ export class Battle { Boost: 1, DragOut: 1, Effectiveness: 1, + Start: 1, }; if (eventid in AttackingEvents) { this.debug(eventid + ' handler suppressed by Mold Breaker'); From 39f314533eaa0b81cd47619883e7f303643f1b27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Bastos=20Dias?= Date: Mon, 10 Feb 2025 11:11:10 +0000 Subject: [PATCH 4/8] Fix breakable check --- sim/battle.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sim/battle.ts b/sim/battle.ts index 0f7671640bee8..17d361fb9b937 100644 --- a/sim/battle.ts +++ b/sim/battle.ts @@ -568,6 +568,11 @@ export class Battle { // it's changed; call it off return relayVar; } + if (eventid === 'SwitchIn' && effect.effectType === 'Ability' && effect.flags['breakable'] && + this.suppressingAbility(target as Pokemon)) { + this.debug(eventid + ' handler suppressed by Mold Breaker'); + return relayVar; + } if (eventid !== 'Start' && eventid !== 'TakeItem' && effect.effectType === 'Item' && (target instanceof Pokemon) && target.ignoringItem()) { this.debug(eventid + ' handler suppressed by Embargo, Klutz or Magic Room'); @@ -826,7 +831,6 @@ export class Battle { Boost: 1, DragOut: 1, Effectiveness: 1, - Start: 1, }; if (eventid in AttackingEvents) { this.debug(eventid + ' handler suppressed by Mold Breaker'); From 3a0e8e72a9a0ea82517cef81334f2b208222170a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Bastos=20Dias?= Date: Mon, 10 Feb 2025 12:18:39 +0000 Subject: [PATCH 5/8] Cloud Nine's Start event is suppressed by Mold Breaker --- data/abilities.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/data/abilities.ts b/data/abilities.ts index 03de3ad998f11..5165b2685546a 100644 --- a/data/abilities.ts +++ b/data/abilities.ts @@ -91,6 +91,7 @@ export const Abilities: import('../sim/dex-abilities').AbilityDataTable = { onSwitchIn(pokemon) { // Air Lock does not activate when Skill Swapped or when Neutralizing Gas leaves the field this.add('-ability', pokemon, 'Air Lock'); + if (this.suppressingAbility(pokemon)) return; ((this.effect as any).onStart as (p: Pokemon) => void).call(this, pokemon); }, onStart(pokemon) { @@ -537,6 +538,7 @@ export const Abilities: import('../sim/dex-abilities').AbilityDataTable = { onSwitchIn(pokemon) { // Cloud Nine does not activate when Skill Swapped or when Neutralizing Gas leaves the field this.add('-ability', pokemon, 'Cloud Nine'); + if (this.suppressingAbility(pokemon)) return; ((this.effect as any).onStart as (p: Pokemon) => void).call(this, pokemon); }, onStart(pokemon) { From a386057c373a0022cc84e8f4476994504b3114f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Bastos=20Dias?= Date: Mon, 10 Feb 2025 13:12:54 +0000 Subject: [PATCH 6/8] Revert "Cloud Nine's Start event is suppressed by Mold Breaker" This reverts commit 3a0e8e72a9a0ea82517cef81334f2b208222170a. --- data/abilities.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/data/abilities.ts b/data/abilities.ts index 5165b2685546a..03de3ad998f11 100644 --- a/data/abilities.ts +++ b/data/abilities.ts @@ -91,7 +91,6 @@ export const Abilities: import('../sim/dex-abilities').AbilityDataTable = { onSwitchIn(pokemon) { // Air Lock does not activate when Skill Swapped or when Neutralizing Gas leaves the field this.add('-ability', pokemon, 'Air Lock'); - if (this.suppressingAbility(pokemon)) return; ((this.effect as any).onStart as (p: Pokemon) => void).call(this, pokemon); }, onStart(pokemon) { @@ -538,7 +537,6 @@ export const Abilities: import('../sim/dex-abilities').AbilityDataTable = { onSwitchIn(pokemon) { // Cloud Nine does not activate when Skill Swapped or when Neutralizing Gas leaves the field this.add('-ability', pokemon, 'Cloud Nine'); - if (this.suppressingAbility(pokemon)) return; ((this.effect as any).onStart as (p: Pokemon) => void).call(this, pokemon); }, onStart(pokemon) { From 82e60ae07cbc6c2adbde11267f3f687c4dcdc6d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Bastos=20Dias?= Date: Thu, 13 Feb 2025 04:28:00 +0000 Subject: [PATCH 7/8] Add generic test --- test/sim/abilities/flowergift.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/test/sim/abilities/flowergift.js b/test/sim/abilities/flowergift.js index a76edbef5bdd7..6001d37c4cb81 100644 --- a/test/sim/abilities/flowergift.js +++ b/test/sim/abilities/flowergift.js @@ -65,4 +65,16 @@ describe('Flower Gift', function () { battle.makeChoices('auto', 'move blastburn dynamax'); assert(battle.log.every(line => !line.startsWith('|-formechange'))); }); + + it(`should not trigger if dragged in by a Mold Breaker Pokemon`, function () { + battle = common.createBattle([[ + {species: 'Torkoal', ability: 'drought', moves: ['sleeptalk']}, + {species: 'Cherrim', ability: 'flowergift', moves: ['sleeptalk']}, + ], [ + {species: 'Haxorus', ability: 'moldbreaker', moves: ['roar']}, + ]]); + battle.makeChoices(); + assert.equal(battle.field.weather, 'sunnyday'); + assert.species(battle.p1.active[0], 'Cherrim'); + }); }); From 997e91f93252875ef23404580a8530ad8322df3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Bastos=20Dias?= Date: Wed, 26 Feb 2025 21:50:37 +0000 Subject: [PATCH 8/8] Update to ESLint 9 --- test/sim/abilities/flowergift.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/sim/abilities/flowergift.js b/test/sim/abilities/flowergift.js index 103efade1b2e9..af125bb07d326 100644 --- a/test/sim/abilities/flowergift.js +++ b/test/sim/abilities/flowergift.js @@ -66,12 +66,12 @@ describe('Flower Gift', () => { assert(battle.log.every(line => !line.startsWith('|-formechange'))); }); - it(`should not trigger if dragged in by a Mold Breaker Pokemon`, function () { + it(`should not trigger if dragged in by a Mold Breaker Pokemon`, () => { battle = common.createBattle([[ - {species: 'Torkoal', ability: 'drought', moves: ['sleeptalk']}, - {species: 'Cherrim', ability: 'flowergift', moves: ['sleeptalk']}, + { species: 'Torkoal', ability: 'drought', moves: ['sleeptalk'] }, + { species: 'Cherrim', ability: 'flowergift', moves: ['sleeptalk'] }, ], [ - {species: 'Haxorus', ability: 'moldbreaker', moves: ['roar']}, + { species: 'Haxorus', ability: 'moldbreaker', moves: ['roar'] }, ]]); battle.makeChoices(); assert.equal(battle.field.weather, 'sunnyday');