Fix interaction between Wonder Guard and typeless moves (#11548)
Some checks are pending
Node.js CI / build (18.x) (push) Waiting to run

This commit is contained in:
André Bastos Dias 2025-10-31 23:31:59 +00:00 committed by GitHub
parent 00fe920ec0
commit 6e5e42e1d3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 37 additions and 2 deletions

View File

@ -5478,7 +5478,7 @@ export const Abilities: import('../sim/dex-abilities').AbilityDataTable = {
},
wonderguard: {
onTryHit(target, source, move) {
if (target === source || move.category === 'Status' || move.type === '???' || move.id === 'struggle') return;
if (target === source || move.category === 'Status' || move.id === 'struggle') return;
if (move.id === 'skydrop' && !source.volatiles['skydrop']) return;
this.debug('Wonder Guard immunity: ' + move.id);
if (target.runEffectiveness(move) <= 0 || !target.runImmunity(move)) {

View File

@ -549,7 +549,7 @@ export const Abilities: import('../../../sim/dex-abilities').ModdedAbilityDataTa
this.hint("In Gen 4, Fire Fang is always able to hit through Wonder Guard.", true, target.side);
return;
}
if (target === source || move.category === 'Status' || move.type === '???' || move.id === 'struggle') return;
if (target === source || move.category === 'Status' || move.type === '???') return;
this.debug('Wonder Guard immunity: ' + move.id);
if (target.runEffectiveness(move) <= 0 || !target.runImmunity(move)) {
this.add('-immune', target, '[from] ability: Wonder Guard');

View File

@ -53,4 +53,39 @@ describe('Wonder Guard', () => {
battle.makeChoices();
assert(battle.log.some(line => line.includes('|-immune|p2a: Muk|[from] ability: Wonder Guard')));
});
it('should not make the user immune to Struggle', () => {
battle = common.createBattle([[
{ species: 'Pawmot', moves: ['sleeptalk'] },
], [
{ species: 'Shedinja', ability: 'wonderguard', moves: ['sleeptalk', 'disable'] },
]]);
battle.makeChoices('move sleeptalk', 'move disable');
assert.hurts(battle.p2.active[0], () => battle.makeChoices());
});
it('should make the user immune to typeless moves', () => {
battle = common.createBattle([[
{ species: 'Arcanine', moves: ['burnup', 'revelationdance'] },
], [
{ species: 'Clefable', moves: ['sleeptalk'] },
{ species: 'Shedinja', ability: 'wonderguard', moves: ['sleeptalk'] },
]]);
battle.makeChoices('move burnup', 'move sleeptalk');
battle.makeChoices('move revelationdance', 'switch 2');
assert.fullHP(battle.p2.active[0]);
});
describe('[Gen 4]', () => {
it('should not make the user immune to typeless moves', () => {
battle = common.gen(4).createBattle([[
{ species: 'Jirachi', moves: ['doomdesire', 'beatup', 'sleeptalk'] },
], [
{ species: 'Clefable', ability: 'wonderguard', moves: ['sleeptalk'] },
]]);
battle.makeChoices('move doomdesire', 'move sleeptalk');
assert.hurts(battle.p2.active[0], () => battle.makeChoices('move beatup', 'move sleeptalk'));
assert.hurts(battle.p2.active[0], () => battle.makeChoices('move sleeptalk', 'move sleeptalk'));
});
});
});