pokemon-showdown/test/simulator/abilities/flashfire.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

64 lines
2.8 KiB
JavaScript

'use strict';
const assert = require('./../../assert');
const common = require('./../../common');
let battle;
describe('Flash Fire', function () {
afterEach(function () {
battle.destroy();
});
it('should grant immunity to Fire-type moves and increase Fire-type attacks by 50% once activated', function () {
battle = common.createBattle();
const p1 = battle.join('p1', 'Guest 1', 1, [{species: 'Heatran', ability: 'flashfire', moves: ['incinerate']}]);
const p2 = battle.join('p2', 'Guest 2', 1, [{species: 'Talonflame', ability: 'galewings', moves: ['flareblitz']}]);
battle.makeChoices('move incinerate', 'move flareblitz');
assert.fullHP(p1.active[0]);
let damage = p2.active[0].maxhp - p2.active[0].hp;
assert.bounded(damage, [82, 97]);
});
it('should grant Fire-type immunity even if the user is frozen', function () {
battle = common.createBattle();
const p1 = battle.join('p1', 'Guest 1', 1, [{species: 'Heatran', ability: 'flashfire', moves: ['sleeptalk']}]);
battle.join('p2', 'Guest 2', 1, [{species: 'Talonflame', ability: 'galewings', moves: ['flareblitz']}]);
p1.active[0].setStatus('frz');
assert.false.hurts(p1.active[0], () => battle.makeChoices('move sleeptalk', 'move flareblitz'));
});
it('should have its Fire-type immunity suppressed by Mold Breaker', function () {
battle = common.createBattle();
battle.join('p1', 'Guest 1', 1, [{species: 'Heatran', ability: 'flashfire', moves: ['incinerate']}]);
battle.join('p2', 'Guest 2', 1, [{species: 'Haxorus', ability: 'moldbreaker', moves: ['firepunch']}]);
assert.hurts(battle.p1.active[0], () => battle.makeChoices('move incinerate', 'move firepunch'));
});
it('should lose the Flash Fire boost if its ability is changed', function () {
battle = common.createBattle();
battle.join('p1', 'Guest 1', 1, [{species: 'Heatran', ability: 'flashfire', moves: ['sleeptalk', 'incinerate']}]);
battle.join('p2', 'Guest 2', 1, [{species: 'Talonflame', ability: 'galewings', moves: ['incinerate', 'worryseed']}]);
battle.makeChoices('move sleeptalk', 'move incinerate');
battle.resetRNG();
battle.makeChoices('move incinerate', 'move worryseed');
let damage = battle.p2.active[0].maxhp - battle.p2.active[0].hp;
assert.bounded(damage, [54, 65]);
});
});
describe('Flash Fire [Gen 4]', function () {
afterEach(function () {
battle.destroy();
});
// TODO: Check if this is actually a behavior in Gen 3-4
it.skip('should grant Fire-type immunity even if the user is frozen', function () {
battle = common.createBattle();
const p1 = battle.join('p1', 'Guest 1', 1, [{species: 'Heatran', ability: 'flashfire', moves: ['sleeptalk']}]);
battle.join('p2', 'Guest 2', 1, [{species: 'Charizard', ability: 'blaze', moves: ['flamethrower']}]);
p1.active[0].setStatus('frz');
assert.false.hurts(p1.active[0], () => battle.makeChoices('move sleeptalk', 'move flamethrower'));
});
});