pokemon-showdown/test/sim/abilities/multiscale.js
Guangcong Luo 229f5f809d Use assert in strict mode
This makes it so we can use `assert.equal` instead of
`assert.strictEqual`, which I think is more readable.
2020-02-20 00:39:31 -08:00

41 lines
1.4 KiB
JavaScript

'use strict';
const assert = require('./../../assert');
const common = require('./../../common');
let battle;
describe('Multiscale', function () {
afterEach(function () {
battle.destroy();
});
it('should halve damage when it is at full health', function () {
battle = common.createBattle();
battle.setPlayer('p1', {team: [{species: "Dragonite", ability: 'multiscale', moves: ['splash']}]});
battle.setPlayer('p2', {team: [{species: "Gyarados", ability: 'moxie', moves: ['incinerate']}]});
let damage, curhp;
let pokemon = battle.p1.active[0];
battle.makeChoices('move splash', 'move incinerate');
damage = pokemon.maxhp - pokemon.hp;
curhp = pokemon.hp;
battle.resetRNG();
battle.makeChoices('move splash', 'move incinerate');
assert.equal(damage, battle.modify(curhp - pokemon.hp, 0.5));
});
it('should be suppressed by Mold Breaker', function () {
battle = common.createBattle();
battle.setPlayer('p1', {team: [{species: "Dragonite", ability: 'multiscale', moves: ['splash']}]});
battle.setPlayer('p2', {team: [{species: "Gyarados", ability: 'moldbreaker', moves: ['incinerate']}]});
let damage, curhp;
let pokemon = battle.p1.active[0];
battle.makeChoices('move splash', 'move incinerate');
damage = pokemon.maxhp - pokemon.hp;
curhp = pokemon.hp;
battle.resetRNG();
battle.makeChoices('move splash', 'move incinerate');
assert.equal(curhp - pokemon.hp, damage);
});
});