File size: 2,052 Bytes
5c2ed06
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
'use strict';

const assert = require('./../../assert');
const common = require('./../../common');

let battle;

describe("Mirror Armor", () => {
	afterEach(() => {
		battle.destroy();
	});

	it("should bounce boosts back to the source", () => {
		battle = common.createBattle();
		battle.setPlayer('p1', { team: [
			{ species: 'Corviknight', ability: 'mirrorarmor', moves: ['endure'] },
		] });
		battle.setPlayer('p2', { team: [
			{ species: 'Machop', ability: 'noguard', moves: ['rocktomb', 'leer'] },
		] });
		battle.makeChoices('auto', 'move rocktomb');
		const corv = battle.p1.active[0];
		const machop = battle.p2.active[0];
		assert.statStage(corv, 'spe', 0);
		assert.statStage(machop, 'spe', -1);
		battle.makeChoices('auto', 'move leer');
		assert.statStage(corv, 'def', 0);
		assert.statStage(machop, 'def', -1);
	});

	it("should reflect Parting Shot's stat drops, then the Parting Shot user should switch", () => {
		battle = common.createBattle([[
			{ species: 'Corviknight', ability: 'mirrorarmor', moves: ['sleeptalk'] },
		], [
			{ species: 'Drapion', moves: ['partingshot'] },
			{ species: 'Pangoro', moves: ['sleeptalk'] },
		]]);
		battle.makeChoices();
		const corv = battle.p1.active[0];
		const drapion = battle.p2.active[0];
		assert.statStage(corv, 'atk', 0);
		assert.statStage(corv, 'spa', 0);
		assert.statStage(drapion, 'atk', -1);
		assert.statStage(drapion, 'spa', -1);
		assert.equal(battle.requestState, 'switch');
	});

	it("should activate, but silently, if the source has fainted", () => {
		battle = common.createBattle([[
			{ species: 'corviknight', ability: 'mirrorarmor', moves: ['bravebird'] },
		], [
			{ species: 'gossifleur', ability: 'cottondown', moves: ['sleeptalk'] },
			{ species: 'wynaut', ability: 'shadowtag', moves: ['sleeptalk'] },
		]]);
		battle.makeChoices();
		assert.statStage(battle.p1.active[0], 'spe', 0);
		for (const line of battle.log) {
			assert.false(line.includes("Mirror Armor"), `Expected no Mirror Armor message, but got the following message:\n${line}`);
		}
	});
});