var assert = require('assert');
var battle;

describe('Intimidate', function () {
	afterEach(function () {
		battle.destroy();
	});

	it('should decrease Atk by 1 level', function () {
		battle = BattleEngine.Battle.construct();
		battle.join('p1', 'Guest 1', 1, [{species: "Smeargle", ability: 'owntempo', moves: ['sketch']}]);
		battle.join('p2', 'Guest 2', 1, [{species: "Gyarados", ability: 'intimidate',  moves: ['splash']}]);
		assert.strictEqual(battle.p1.active[0].boosts['atk'], -1);
	});

	it('should be blocked by Substitute', function () {
		battle = BattleEngine.Battle.construct();
		battle.join('p1', 'Guest 1', 1, [
			{species: "Escavalier", item: 'leftovers', ability: 'shellarmor', moves: ['substitute']}
		]);
		battle.join('p2', 'Guest 2', 1, [
			{species: "Greninja", item: 'laggingtail', ability: 'protean',  moves: ['uturn']},
			{species: "Gyarados", item: 'leftovers', ability: 'intimidate',  moves: ['splash']}
		]);
		battle.commitDecisions();
		battle.choose('p2', 'switch 2');
		assert.strictEqual(battle.p1.active[0].boosts['atk'], 0);
	});

	it('should affect adjacent foes only', function () {
		battle = BattleEngine.Battle.construct('battle-intimidate-adjacency', 'triplescustomgame');
		battle.join('p1', 'Guest 1', 1, [
			{species: "Bulbasaur", item: 'leftovers', ability: 'overgrow', moves: ['vinewhip']},
			{species: "Charmander", item: 'leftovers', ability: 'blaze', moves: ['ember']},
			{species: "Squirtle", item: 'leftovers', ability: 'torrent', moves: ['bubble']}
		]);
		battle.join('p2', 'Guest 2', 1, [
			{species: "Greninja", ability: 'protean',  moves: ['uturn']},
			{species: "Mew", ability: 'synchronize',  moves: ['softboiled']},
			{species: "Gyarados", ability: 'intimidate',  moves: ['splash']}
		]);
		battle.commitDecisions();
		assert.strictEqual(battle.p1.active[0].boosts['atk'], -1);
		assert.strictEqual(battle.p1.active[1].boosts['atk'], -1);
		assert.strictEqual(battle.p1.active[2].boosts['atk'], 0);
	});
});

@@ -1969,13 +1969,498 @@
 0);%0A%09%7D);
+%0A%0A%09it('should wait until all simultaneous switch ins have completed before activating', function () %7B%0A%09%09battle = BattleEngine.Battle.construct();%0A%09%09battle.join('p1', 'Guest 1', 1, %5B%7Bspecies: %22Arcanine%22, ability: 'intimidate', moves: %5B'morningsun'%5D%7D%5D);%0A%09%09battle.join('p2', 'Guest 2', 1, %5B%7Bspecies: %22Gyarados%22, ability: 'intimidate', moves: %5B'dragondance'%5D%7D%5D);%0A%09%09assert.strictEqual(battle.p1.active%5B0%5D.boosts%5B'atk'%5D, -1);%0A%09%09assert.strictEqual(battle.p2.active%5B0%5D.boosts%5B'atk'%5D, -1);%0A%09%7D);
 %0A%7D);%0A

Add Intimidate test to check simultaneous switches