Skip to content

Commit

Permalink
Fix Dazzling
Browse files Browse the repository at this point in the history
I don't like using Bulbapedia as a source, but our researchers are all
asleep and TI said this was high-priority.
  • Loading branch information
Zarel committed Apr 16, 2020
1 parent 6884c7e commit 80634c6
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 9 deletions.
24 changes: 18 additions & 6 deletions data/abilities.js
Original file line number Diff line number Diff line change
Expand Up @@ -642,10 +642,16 @@ let BattleAbilities = {
dazzling: {
desc: "While this Pokemon is active, priority moves from opposing Pokemon targeted at allies are prevented from having an effect.",
shortDesc: "While this Pokemon is active, allies are protected from opposing priority moves.",
onFoeTryMove(target, source, effect) {
if ((source.side === this.effectData.target.side || effect.id === 'perishsong') && effect.priority > 0.1 && effect.target !== 'foeSide') {
onFoeTryMove(target, source, move) {
const targetAllExceptions = ['perishsong', 'flowershield', 'rototiller'];
if (move.target === 'foeSide' || (move.target === 'all' && !targetAllExceptions.includes(move.id))) {
return;
}

const dazzlingHolder = this.effectData.target;
if ((source.side === dazzlingHolder.side || move.target === 'all') && move.priority > 0.1) {
this.attrLastMove('[still]');
this.add('cant', this.effectData.target, 'ability: Dazzling', effect, '[of] ' + target);
this.add('cant', dazzlingHolder, 'ability: Dazzling', move, '[of] ' + target);
return false;
}
},
Expand Down Expand Up @@ -3036,10 +3042,16 @@ let BattleAbilities = {
queenlymajesty: {
desc: "While this Pokemon is active, priority moves from opposing Pokemon targeted at allies are prevented from having an effect.",
shortDesc: "While this Pokemon is active, allies are protected from opposing priority moves.",
onFoeTryMove(target, source, effect) {
if ((source.side === this.effectData.target.side || effect.id === 'perishsong') && effect.priority > 0.1 && effect.target !== 'foeSide') {
onFoeTryMove(target, source, move) {
const targetAllExceptions = ['perishsong', 'flowershield', 'rototiller'];
if (move.target === 'foeSide' || (move.target === 'all' && !targetAllExceptions.includes(move.id))) {
return;
}

const dazzlingHolder = this.effectData.target;
if ((source.side === dazzlingHolder.side || move.target === 'all') && move.priority > 0.1) {
this.attrLastMove('[still]');
this.add('cant', this.effectData.target, 'ability: Queenly Majesty', effect, '[of] ' + target);
this.add('cant', dazzlingHolder, 'ability: Queenly Majesty', move, '[of] ' + target);
return false;
}
},
Expand Down
7 changes: 4 additions & 3 deletions test/sim/abilities/dazzling.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,15 @@ describe('Dazzling', function () {
assert.equal(battle.p2.active[0].boosts.atk, 2);
});

it.skip('should not block moves that target all Pokemon', function () {
it('should not block moves that target all Pokemon, except Perish Song, Rototiller, and Flower Shield', function () {
battle = common.createBattle([
[{species: "Bruxish", ability: 'dazzling', moves: ['swordsdance', 'sleeptalk']}],
[{species: "Mew", ability: 'prankster', moves: ['sleeptalk', 'haze']}],
[{species: "Mew", ability: 'prankster', moves: ['perishsong', 'haze']}],
]);

battle.makeChoices('move swordsdance', 'move sleeptalk');
battle.makeChoices('move swordsdance', 'move perishsong');
battle.makeChoices('move sleeptalk', 'move haze');
assert.equal(battle.p1.active[0].boosts.atk, 0);
assert.false(battle.p1.active[0].volatiles.perishsong);
});
});

0 comments on commit 80634c6

Please sign in to comment.