pokemon-showdown/test/simulator/abilities/shellarmor.js
Brandon Gottlob 27d3e4fc5b Refactor tests to use new makeChoices API (#4528)
See 8473c3f4fa for the example followed in the refactor
2018-03-30 16:06:14 -05:00

45 lines
1.4 KiB
JavaScript

'use strict';
const assert = require('./../../assert');
const common = require('./../../common');
let battle;
describe('Shell Armor', function () {
afterEach(function () {
battle.destroy();
});
it('should prevent moves from dealing critical hits', function () {
battle = common.createBattle([
[{species: 'Slowbro', ability: 'shellarmor', moves: ['quickattack']}],
[{species: 'Cryogonal', ability: 'noguard', moves: ['frostbreath']}],
]);
let successfulEvent = false;
battle.onEvent('ModifyDamage', battle.getFormat(), function (damage, attacker, defender, move) {
if (move.id === 'frostbreath') {
successfulEvent = true;
assert.false(move.crit);
}
});
battle.makeChoices('move quickattack', 'move frostbreath');
assert.ok(successfulEvent);
});
it('should be suppressed by Mold Breaker', function () {
battle = common.createBattle([
[{species: 'Slowbro', ability: 'shellarmor', moves: ['quickattack']}],
[{species: 'Cryogonal', ability: 'moldbreaker', item: 'zoomlens', moves: ['frostbreath']}],
]);
let successfulEvent = false;
battle.onEvent('ModifyDamage', battle.getFormat(), function (damage, attacker, defender, move) {
if (move.id === 'frostbreath') {
successfulEvent = true;
assert.ok(move.crit);
}
});
battle.makeChoices('move quickattack', 'move frostbreath');
assert.ok(successfulEvent);
});
});