File size: 2,075 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
'use strict';

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

let battle;

describe(`Court Change`, () => {
	afterEach(() => {
		battle.destroy();
	});

	it(`should swap certain side conditions to the opponent's side and vice versa`, () => {
		battle = common.createBattle([[
			{ species: 'wynaut', moves: ['sleeptalk', 'stealthrock', 'lightscreen'] },
		], [
			{ species: 'cinderace', moves: ['courtchange', 'tailwind', 'safeguard'] },
		]]);
		battle.makeChoices('move stealthrock', 'move tailwind');
		battle.makeChoices('move lightscreen', 'move safeguard');
		battle.makeChoices('move sleeptalk', 'move courtchange');

		assert(!!battle.p1.sideConditions['tailwind']);
		assert(!!battle.p1.sideConditions['safeguard']);
		assert(!!battle.p1.sideConditions['stealthrock']);
		assert(!!battle.p2.sideConditions['lightscreen']);
	});

	it(`should allow Sticky Web to trigger Defiant when set by the Defiant user's team`, () => {
		battle = common.createBattle([[
			{ species: 'cinderace', moves: ['courtchange', 'stickyweb', 'sleeptalk'] },
			{ species: 'pawniard', ability: 'defiant', moves: ['sleeptalk'] },
		], [
			{ species: 'wynaut', moves: ['sleeptalk'] },
		]]);
		battle.makeChoices('move stickyweb', 'auto');
		battle.makeChoices('move courtchange', 'auto');
		battle.makeChoices('switch 2', 'auto');

		assert(!!battle.p1.sideConditions['stickyweb']);
		assert.statStage(battle.p1.active[0], 'atk', 2);
	});

	it(`[Gen 8] should not allow Sticky Web to trigger Defiant when set by the Defiant user's team`, () => {
		battle = common.gen(8).createBattle([[
			{ species: 'cinderace', moves: ['courtchange', 'stickyweb', 'sleeptalk'] },
			{ species: 'pawniard', ability: 'defiant', moves: ['sleeptalk'] },
		], [
			{ species: 'wynaut', moves: ['sleeptalk'] },
		]]);
		battle.makeChoices('move stickyweb', 'auto');
		battle.makeChoices('move courtchange', 'auto');
		battle.makeChoices('switch 2', 'auto');

		assert(!!battle.p1.sideConditions['stickyweb']);
		assert.statStage(battle.p1.active[0], 'atk', 0);
	});
});