pokemon-showdown/test/simulator/misc/statusmoves.js
Kevin Lau 85ee0961c1 Further upgrade status move tests
Steel-types are immune to the poison status in Gen 3+, so wrap it into the
"fail when the opposing Pokemon is immune to the status it sets" and set
up the poison-inflicting status test to check Generation 2.

Spin off Thunder Wave to its own test, and also create a test for Glare to
check its Generation 3 behavior as well.
2015-06-18 17:05:49 -07:00

94 lines
3.9 KiB
JavaScript

var assert = require('assert');
var battle;
describe('Most status moves', function () {
afterEach(function () {
battle.destroy();
});
it('should ignore natural type immunities', function () {
battle = BattleEngine.Battle.construct();
battle.join('p1', 'Guest 1', 1, [{species: "Smeargle", ability: 'prankster', item: 'leftovers', moves: ['gastroacid', 'glare', 'confuseray', 'sandattack']}]);
battle.join('p2', 'Guest 2', 1, [
{species: "Klefki", ability: 'magician', happiness: 0, moves: ['return']},
{species: "Dusknoir", ability: 'frisk', moves: ['shadowpunch']},
{species: "Slaking", ability: 'truant', moves: ['shadowclaw']},
{species: "Tornadus", ability: 'prankster', moves: ['tailwind']},
{species: "Unown", ability: 'levitate', moves: ['hiddenpower']}
]);
battle.commitDecisions();
assert.strictEqual(battle.p2.active[0].item, '');
battle.choose('p1', 'move 2');
battle.choose('p2', 'switch 2');
assert.strictEqual(battle.p2.active[0].status, 'par');
battle.choose('p1', 'move 3');
battle.choose('p2', 'switch 3');
assert.ok(battle.p2.active[0].volatiles['confusion']);
battle.choose('p1', 'move 4');
battle.choose('p2', 'switch 4');
assert.strictEqual(battle.p2.active[0].boosts['accuracy'], -1);
battle.choose('p1', 'move 4');
battle.choose('p2', 'switch 5');
assert.strictEqual(battle.p2.active[0].boosts['accuracy'], -1);
});
it('should fail when the opposing Pokemon is immune to the status effect it sets', function () {
this.timeout(0);
battle = BattleEngine.Battle.construct();
battle.join('p1', 'Guest 1', 1, [{species: "Smeargle", ability: 'noguard', item: 'laggingtail', moves: ['thunderwave', 'willowisp', 'poisongas', 'toxic']}]);
battle.join('p2', 'Guest 2', 1, [
{species: "Zapdos", ability: 'pressure', moves: ['charge']},
{species: "Emboar", ability: 'blaze', moves: ['sleeptalk']},
{species: "Muk", ability: 'stench', moves: ['shadowsneak']},
{species: "Aron", ability: 'sturdy', moves: ['magnetrise']}
]);
battle.commitDecisions();
assert.strictEqual(battle.p2.active[0].status, '');
assert.ok(battle.log[battle.lastMoveLine + 1].startsWith('|-immune|'));
battle.choose('p1', 'move 2');
battle.choose('p2', 'switch 2');
assert.strictEqual(battle.p2.active[0].status, '');
assert.ok(battle.log[battle.lastMoveLine + 1].startsWith('|-immune|'));
battle.choose('p1', 'move 3');
battle.choose('p2', 'switch 3');
assert.strictEqual(battle.p2.active[0].status, '');
assert.ok(battle.log[battle.lastMoveLine + 1].startsWith('|-immune|'));
battle.choose('p1', 'move 4');
battle.commitDecisions();
assert.strictEqual(battle.p2.active[0].status, '');
assert.ok(battle.log[battle.lastMoveLine + 1].startsWith('|-immune|'));
battle.choose('p1', 'move 3');
battle.choose('p2', 'switch 4');
assert.strictEqual(battle.p2.active[0].status, '');
assert.ok(battle.log[battle.lastMoveLine + 1].startsWith('|-immune|'));
battle.choose('p1', 'move 4');
battle.commitDecisions();
assert.strictEqual(battle.p2.active[0].status, '');
assert.ok(battle.log[battle.lastMoveLine + 1].startsWith('|-immune|'));
});
});
describe('Poison-inflicting status moves [Gen 2]', function () {
afterEach(function () {
battle.destroy();
});
it('should not ignore type immunities', function () {
battle = BattleEngine.Battle.construct('battle-gsc-psn-steel', 'gen2customgame');
battle.join('p1', 'Guest 1', 1, [{species: "Smeargle", moves: ['poisonpowder', 'poisongas', 'toxic']}]);
battle.join('p2', 'Guest 2', 1, [{species: "Magneton", moves: ['sleeptalk']}]);
// Set all moves to perfect accuracy
battle.on('Accuracy', battle.getFormat(), true);
battle.commitDecisions();
assert.strictEqual(battle.p2.active[0].status, '');
battle.choose('p1', 'move 2');
battle.commitDecisions();
assert.strictEqual(battle.p2.active[0].status, '');
battle.choose('p1', 'move 3');
battle.commitDecisions();
assert.strictEqual(battle.p2.active[0].status, '');
});
});