pokemon-showdown/test/simulator/abilities/shellarmor.js
Kevin Lau e846fbb129 Fix Battle Armor and Shell Armor tests to no longer use the battle log
Instead, they can use Battle#on to check for the move dealing a critical
hit within the ModifyDamage event instead.
2015-08-12 16:02:12 -07:00

41 lines
1.5 KiB
JavaScript

var assert = require('assert');
var battle;
describe('Shell Armor', function () {
afterEach(function () {
battle.destroy();
});
it('should prevent moves from dealing critical hits', function () {
battle = BattleEngine.Battle.construct('battle-shellarmor', 'customgame');
battle.join('p1', 'Guest 1', 1, [{species: 'Slowbro', ability: 'shellarmor', moves: ['quickattack']}]);
battle.join('p2', 'Guest 2', 1, [{species: 'Cyrogonal', ability: 'noguard', moves: ['frostbreath']}]);
battle.commitDecisions(); // Team Preview
var 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 = BattleEngine.Battle.construct('battle-shellarmor-moldbreaker', 'customgame');
battle.join('p1', 'Guest 1', 1, [{species: 'Slowbro', ability: 'shellarmor', moves: ['quickattack']}]);
battle.join('p2', 'Guest 2', 1, [{species: 'Cyrogonal', ability: 'moldbreaker', item: 'zoomlens', moves: ['frostbreath']}]);
battle.commitDecisions(); // Team Preview
var 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);
});
});