mirror of
https://github.com/smogon/pokemon-showdown.git
synced 2026-05-14 16:30:43 -05:00
Battle will soon be a Node.js Stream, which has an .on() function, which Battle#on would conflict with. PS events aren't Node events, so naming a PS event function .on() was kind of misleading anyway.
45 lines
1.3 KiB
JavaScript
45 lines
1.3 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.commitDecisions();
|
|
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.commitDecisions();
|
|
assert.ok(successfulEvent);
|
|
});
|
|
});
|