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

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

let battle;

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

	it(`should use the base move's type if it is a damaging move`, () => {
		battle = common.createBattle([[
			{ species: 'Kecleon', item: 'normaliumz', moves: ['hiddenpower'] },
		], [
			{ species: 'Gengar', moves: ['sleeptalk'] },
		]]);
		battle.makeChoices('move hiddenpower zmove', 'auto');
		assert.fullHP(battle.p2.active[0]);
	});

	it(`should not use the base move's priority if it is a damaging move`, () => {
		battle = common.createBattle([[
			{ species: 'Kecleon', item: 'ghostiumz', moves: ['shadowsneak'] },
		], [
			{ species: 'Starmie', moves: ['reflecttype'] },
		]]);
		battle.makeChoices('move shadowsneak zmove', 'auto');
		assert.fullHP(battle.p2.active[0]);
	});

	it(`should be possible to activate them when the base move is disabled`, () => {
		battle = common.createBattle([[
			{ species: 'Chansey', item: 'normaliumz', ability: 'naturalcure', moves: ['doubleteam', 'fireblast'] },
		], [
			{ species: 'Mightyena', ability: 'intimidate', moves: ['taunt'] },
		]]);
		const chansey = battle.p1.active[0];
		assert.statStage(chansey, 'atk', -1);
		battle.makeChoices();

		assert(battle.actions.canZMove(chansey), `Chansey should be able to use its Z Move`);
		battle.makeChoices('move doubleteam zmove', 'auto'); // Z-Effect: Restores negative stat stages to 0
		assert.statStage(chansey, 'atk', 0);
	});

	it(`should be impossible to activate them when all the base moves are disabled`, () => {
		battle = common.createBattle([[
			{ species: 'Chansey', item: 'normaliumz', ability: 'naturalcure', moves: ['doubleteam', 'minimize'] },
		], [
			{ species: 'Mightyena', ability: 'intimidate', moves: ['taunt'] },
		]]);

		const chansey = battle.p1.active[0];
		assert.statStage(chansey, 'atk', -1);
		battle.makeChoices();

		assert.false(battle.actions.canZMove(chansey), `Chansey should not be able to use its Z Move`);
		battle.makeChoices();
		assert.statStage(chansey, 'atk', -1);
		assert.cantMove(() => battle.makeChoices('move doubleteam zmove', ''));
	});
});