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

47 lines
1.9 KiB
JavaScript

'use strict';
const assert = require('./../../assert');
const common = require('./../../common');
let battle;
describe('Ingrain', function () {
afterEach(function () {
battle.destroy();
});
it('should heal the user by 1/16 of its max HP at the end of each turn', function () {
battle = common.createBattle();
battle.join('p1', 'Guest 1', 1, [{species: 'Cradily', ability: 'stormdrain', moves: ['ingrain']}]);
battle.join('p2', 'Guest 2', 1, [{species: 'Miltank', ability: 'thickfat', moves: ['seismictoss']}]);
battle.commitDecisions();
assert.strictEqual(battle.p1.active[0].hp, Math.floor(battle.p1.active[0].maxhp * 17 / 16) - 100);
});
it('should prevent the user from being forced out or switching out', function () {
battle = common.createBattle();
battle.join('p1', 'Guest 1', 1, [
{species: 'Cradily', ability: 'stormdrain', moves: ['ingrain']},
{species: 'Pikachu', ability: 'static', moves: ['thunder']},
]);
battle.join('p2', 'Guest 2', 1, [{species: 'Arcanine', ability: 'flashfire', moves: ['sleeptalk', 'roar']}]);
battle.choose('p2', 'move 2');
battle.commitDecisions();
assert.strictEqual(battle.p1.active[0].speciesid, 'cradily');
battle.choose('p1', 'switch 2');
battle.commitDecisions();
assert.strictEqual(battle.p1.active[0].speciesid, 'cradily');
});
it('should remove the users\' Ground immunities', function () {
battle = common.createBattle();
battle.join('p1', 'Guest 1', 1, [{species: 'Tropius', ability: 'harvest', moves: ['earthquake', 'ingrain']}]);
battle.join('p2', 'Guest 2', 1, [{species: 'Carnivine', ability: 'levitate', moves: ['earthquake', 'ingrain']}]);
battle.choose('p1', 'move 2');
battle.choose('p2', 'move 2');
battle.commitDecisions();
assert.notStrictEqual(battle.p1.active[0].hp, battle.p1.active[0].maxhp);
assert.notStrictEqual(battle.p2.active[0].hp, battle.p2.active[0].maxhp);
});
});