Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Mold Breaker interactions with abilities' Start events #10877

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
1 change: 0 additions & 1 deletion data/abilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
1 change: 0 additions & 1 deletion data/mods/gen9ssb/abilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
5 changes: 5 additions & 0 deletions sim/battle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -565,6 +565,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');
Expand Down
12 changes: 12 additions & 0 deletions test/sim/abilities/flowergift.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,16 @@ describe('Flower Gift', () => {
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`, () => {
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');
});
});