File size: 2,395 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
63
64
65
66
67
68
69
70
71
72
'use strict';

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

let battle;

describe('Illusion', () => {
	afterEach(() => {
		battle.destroy();
	});

	it(`should not instantly wear off before Dynamaxing`, () => {
		battle = common.gen(8).createBattle([[
			{ species: "Zoroark", ability: 'illusion', moves: ['sleeptalk'] },
			{ species: "Diglett", moves: ['sleeptalk'] },
		], [
			{ species: "Wynaut", moves: ['sleeptalk'] },
		]]);

		battle.makeChoices('move sleeptalk dynamax', 'auto');
		assert(battle.log.every(line => !line.includes('|-end|p1a: Zoroark|Illusion')));
	});

	it(`should prevent the user from Dynamaxed when Illusioning as a Pokemon that cannot Dynamax`, () => {
		battle = common.gen(8).createBattle([[
			{ species: "Zoroark", ability: 'illusion', moves: ['sleeptalk'] },
			{ species: "Eternatus", moves: ['sleeptalk'] },
		], [
			{ species: "Wynaut", moves: ['sleeptalk'] },
		]]);

		assert.cantMove(() => battle.choose('p1', 'move sleeptalk dynamax'));
	});

	it(`should be able to wear off normally while Dynamaxed`, () => {
		battle = common.gen(8).createBattle([[
			{ species: "Zoroark", ability: 'illusion', moves: ['machpunch'] },
			{ species: "Diglett", moves: ['sleeptalk'] },
		], [
			{ species: "Wynaut", moves: ['thunderbolt'] },
		]]);

		battle.makeChoices('move machpunch dynamax', 'auto');
		assert(battle.log.some(line => line.includes('|-end|p1a: Zoroark|Illusion')));
	});

	it(`should Illusion as the regular Dynamax version of G-Max Pokemon while Dynamaxed`, () => {
		battle = common.gen(8).createBattle([[
			{ species: "Zoroark", ability: 'illusion', moves: ['sleeptalk'] },
			{ species: "Charizard", gigantamax: true, moves: ['ember', 'sleeptalk'] },
		], [
			{ species: "Wynaut", moves: ['sleeptalk'] },
		]]);

		battle.makeChoices('move sleeptalk dynamax', 'auto');
		assert(battle.log.every(line => !line.includes('Gmax')));
	});

	it(`should instantly wear off before using a Z-move`, () => {
		battle = common.gen(7).createBattle([[
			{ species: "Zoroark", ability: 'illusion', item: 'fightiniumz', moves: ['machpunch', 'sleeptalk'] },
			{ species: "Octillery", moves: ['sleeptalk'] },
		], [
			{ species: "Wynaut", moves: ['sleeptalk'] },
		]]);

		battle.makeChoices('move machpunch zmove', 'auto');
		assert(battle.log.some(line => line.includes('|-end|p1a: Zoroark|Illusion')));
	});
});