pokemon-showdown/test/simulator/moves/stealthrock.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

43 lines
1.4 KiB
JavaScript

'use strict';
const assert = require('./../../assert');
const common = require('./../../common');
let battle;
describe('Stealth Rock', function () {
afterEach(function () {
battle.destroy();
});
it('should succeed against Substitute', function () {
battle = common.createBattle();
battle.join('p1', 'Guest 1', 1, [{species: "Smeargle", moves: ['stealthrock']}]);
battle.join('p2', 'Guest 2', 1, [{species: "Ninjask", moves: ['substitute']}]);
battle.commitDecisions();
assert(battle.p2.sideConditions['stealthrock']);
});
it('should deal damage to Pokemon switching in based on their type effectiveness against Rock-type', function () {
battle = common.createBattle();
battle.join('p1', 'Guest 1', 1, [{species: "Smeargle", moves: ['splash', 'stealthrock']}]);
battle.join('p2', 'Guest 2', 1, [
{species: "Ninjask", moves: ['protect']},
{species: "Volcarona", moves: ['roost']},
{species: "Staraptor", moves: ['roost']},
{species: "Chansey", moves: ['wish']},
{species: "Hitmonchan", moves: ['rest']},
{species: "Steelix", moves: ['rest']},
]);
battle.choose('p1', 'move 2');
battle.commitDecisions();
let pokemon;
for (let i = 2; i <= 6; i++) {
battle.choose('p2', 'switch ' + i);
battle.commitDecisions();
pokemon = battle.p2.active[0];
assert.strictEqual(pokemon.maxhp - pokemon.hp, Math.floor(pokemon.maxhp * Math.pow(0.5, i - 1)));
}
});
});