pokemon-showdown/test/sim/abilities/thickfat.js
Guangcong Luo 7a023746ba
Refactor battle.dex out of battle (#5851)
In most other similar systems, like TeamValidator, we use `thing.dex` instead of having it extend `ModdedDex`. Battle has always extended `ModdedDex`, though. This changes Battle to match the others.

This should fix an issue with `Battle.data` not being cached.

This also frees up Battle to extend ObjectReadWriteStream<string> in a future update.
2019-10-06 07:38:08 +11:00

45 lines
1.6 KiB
JavaScript

'use strict';
const assert = require('./../../assert');
const common = require('./../../common');
let battle;
describe('Thick Fat', function () {
afterEach(function () {
battle.destroy();
});
it('should halve damage from Fire- or Ice-type attacks', function () {
// calls to resetRNG are to avoid crits
battle = common.createBattle();
battle.setPlayer('p1', {team: [{species: "Hariyama", ability: 'thickfat', moves: ['splash']}]});
battle.setPlayer('p2', {team: [{species: "Nidoking", ability: 'sheerforce', moves: ['incinerate', 'icebeam']}]});
const target = battle.p1.active[0];
// should not crit
battle.makeChoices('move splash', 'move incinerate');
assert.bounded(target.maxhp - target.hp, [29, 35]);
battle.heal(target.maxhp, target, target, battle.format);
battle.resetRNG();
// should not crit
battle.makeChoices('move splash', 'move icebeam');
assert.bounded(target.maxhp - target.hp, [56, 66]);
});
it('should be suppressed by Mold Breaker', function () {
// calls to resetRNG are to avoid crits
battle = common.createBattle();
battle.setPlayer('p1', {team: [{species: "Hariyama", ability: 'thickfat', moves: ['splash']}]});
battle.setPlayer('p2', {team: [{species: "Nidoking", ability: 'moldbreaker', moves: ['incinerate', 'icebeam']}]});
const target = battle.p1.active[0];
// should not crit
battle.makeChoices('move splash', 'move incinerate');
assert.bounded(target.maxhp - target.hp, [57, 68]);
battle.heal(target.maxhp, target, target, battle.format);
battle.resetRNG();
// should not crit
battle.makeChoices('move splash', 'move icebeam');
assert.bounded(target.maxhp - target.hp, [85, 101]);
});
});