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

51 lines
2.4 KiB
JavaScript

'use strict';
const assert = require('./../../assert');
const common = require('./../../common');
let battle;
describe('Belly Drum', function () {
afterEach(() => battle.destroy());
it("should reduce the user's HP by half of their maximum HP, then boost their Attack to maximum", function () {
battle = common.createBattle();
const p1 = battle.join('p1', 'Guest 1', 1, [{species: "Linoone", ability: 'limber', moves: ['bellydrum']}]);
battle.join('p2', 'Guest 2', 1, [{species: "Terrakion", ability: 'justified', moves: ['bulkup']}]);
battle.makeChoices('move bellydrum', 'move bulkup');
assert.strictEqual(p1.active[0].hp, Math.ceil(p1.active[0].maxhp / 2));
assert.statStage(p1.active[0], 'atk', 6);
});
it("should fail if the user's HP is less than half of their maximum HP", function () {
battle = common.createBattle();
const p1 = battle.join('p1', 'Guest 1', 1, [{species: "Linoone", ability: 'sturdy', moves: ['bellydrum']}]);
battle.join('p2', 'Guest 2', 1, [{species: "Terrakion", ability: 'justified', moves: ['closecombat']}]);
battle.makeChoices('move bellydrum', 'move closecombat');
assert.strictEqual(p1.active[0].hp, 1);
assert.statStage(p1.active[0], 'atk', 0);
});
});
describe('Z-Belly Drum', function () {
afterEach(() => battle.destroy());
it("should heal the user, then reduce their HP by half their max HP and boost the user's Attack to maximum", function () {
battle = common.createBattle();
const p1 = battle.join('p1', 'Guest 1', 1, [{species: "Linoone", ability: 'limber', item: 'normaliumz', moves: ['bellydrum']}]);
battle.join('p2', 'Guest 2', 1, [{species: "Rattata", ability: 'guts', moves: ['quickattack']}]);
battle.makeChoices('move bellydrum zmove', 'move quickattack');
assert.strictEqual(p1.active[0].hp, Math.ceil(p1.active[0].maxhp / 2));
assert.statStage(p1.active[0], 'atk', 6);
});
it("should not fail even if the user's HP is less than half of their maximum HP", function () {
battle = common.createBattle();
const p1 = battle.join('p1', 'Guest 1', 1, [{species: "Linoone", ability: 'sturdy', item: 'normaliumz', moves: ['bellydrum']}]);
battle.join('p2', 'Guest 2', 1, [{species: "Terrakion", ability: 'justified', moves: ['closecombat']}]);
battle.makeChoices('move bellydrum zmove', 'move closecombat');
assert.strictEqual(p1.active[0].hp, Math.ceil(p1.active[0].maxhp / 2));
assert.statStage(p1.active[0], 'atk', 6);
});
});