pokemon-showdown/test/simulator/abilities/dryskin.js
Brandon Gottlob 27d3e4fc5b Refactor tests to use new makeChoices API (#4528)
See 8473c3f4fa for the example followed in the refactor
2018-03-30 16:06:14 -05:00

56 lines
2.6 KiB
JavaScript

'use strict';
const assert = require('./../../assert');
const common = require('./../../common');
let battle;
describe('Dry Skin', function () {
afterEach(function () {
battle.destroy();
});
it('should take 1/8 max HP every turn that Sunny Day is active', function () {
battle = common.createBattle();
const p1 = battle.join('p1', 'Guest 1', 1, [{species: 'Toxicroak', ability: 'dryskin', moves: ['bulkup']}]);
battle.join('p2', 'Guest 2', 1, [{species: 'Ninetales', ability: 'flashfire', moves: ['sunnyday']}]);
assert.hurtsBy(p1.active[0], Math.floor(p1.active[0].maxhp / 8), () => battle.makeChoices('move bulkup', 'move sunnyday'));
});
it('should heal 1/8 max HP every turn that Rain Dance is active', function () {
battle = common.createBattle();
const p1 = battle.join('p1', 'Guest 1', 1, [{species: 'Toxicroak', ability: 'dryskin', moves: ['substitute']}]);
battle.join('p2', 'Guest 2', 1, [{species: 'Politoed', ability: 'damp', moves: ['encore', 'raindance']}]);
battle.makeChoices('move substitute', 'move encore');
assert.hurtsBy(p1.active[0], -Math.floor(p1.active[0].maxhp / 8), () => battle.makeChoices('move substitute', 'move raindance'));
});
it('should grant immunity to Water-type moves and heal 1/4 max HP', function () {
battle = common.createBattle();
battle.join('p1', 'Guest 1', 1, [{species: 'Toxicroak', ability: 'dryskin', moves: ['substitute']}]);
battle.join('p2', 'Guest 2', 1, [{species: 'Politoed', ability: 'damp', moves: ['watergun']}]);
battle.makeChoices('move substitute', 'move watergun');
assert.fullHP(battle.p1.active[0]);
});
it('should cause the user to take 1.25x damage from Fire-type attacks', function () {
battle = common.createBattle();
battle.join('p1', 'Guest 1', 1, [{species: 'Toxicroak', ability: 'dryskin', moves: ['bulkup']}]);
battle.join('p2', 'Guest 2', 1, [{species: 'Haxorus', ability: 'unnerve', moves: ['incinerate']}]);
battle.makeChoices('move bulkup', 'move incinerate');
let damage = battle.p1.active[0].maxhp - battle.p1.active[0].hp;
assert.bounded(damage, [51, 61]);
});
it('should be suppressed by Mold Breaker', function () {
battle = common.createBattle();
battle.join('p1', 'Guest 1', 1, [{species: 'Toxicroak', ability: 'dryskin', moves: ['bulkup']}]);
battle.join('p2', 'Guest 2', 1, [{species: 'Haxorus', ability: 'moldbreaker', moves: ['incinerate', 'surf']}]);
battle.makeChoices('move bulkup', 'move incinerate');
const target = battle.p1.active[0];
const damage = target.maxhp - target.hp;
assert.bounded(damage, [41, 49]);
assert.hurts(target, () => battle.makeChoices('move bulkup', 'move surf'));
});
});