mirror of
https://github.com/smogon/pokemon-showdown.git
synced 2026-03-21 17:25:10 -05:00
In most other similar systems, like TeamValidator, we use `thing.dex` instead of having it extend `ModdedDex`. Battle has always extended `ModdedDex`, though. This changes Battle to match the others. This should fix an issue with `Battle.data` not being cached. This also frees up Battle to extend ObjectReadWriteStream<string> in a future update.
45 lines
1.4 KiB
JavaScript
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.format, function (damage, attacker, defender, move) {
|
|
if (move.id === 'frostbreath') {
|
|
successfulEvent = true;
|
|
assert.false(defender.getMoveHitData(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.format, function (damage, attacker, defender, move) {
|
|
if (move.id === 'frostbreath') {
|
|
successfulEvent = true;
|
|
assert.ok(defender.getMoveHitData(move).crit);
|
|
}
|
|
});
|
|
battle.makeChoices('move quickattack', 'move frostbreath');
|
|
assert.ok(successfulEvent);
|
|
});
|
|
});
|