pokemon-showdown/test/simulator/abilities/battlearmor.js
Ivo Julca 67da1a1221 Test: Use the new common#createBattle method
- This cuts down tons of code that define player names, avatars,
and deal with Team Preview.
2016-06-17 05:45:22 -05:00

46 lines
1.3 KiB
JavaScript

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