File size: 4,079 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
'use strict';

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

let battle;

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

	it('should block damage from one move', () => {
		battle = common.gen(7).createBattle([[
			{ species: 'Mimikyu', ability: 'disguise', moves: ['splash'] },
		], [
			{ species: 'Mewtwo', ability: 'pressure', moves: ['psystrike'] },
		]]);
		assert.false.hurts(battle.p1.active[0], () => battle.makeChoices());
		assert.hurts(battle.p1.active[0], () => battle.makeChoices());
	});

	it('should only block damage from the first hit of a move', () => {
		battle = common.gen(7).createBattle([[
			{ species: 'Mimikyu', ability: 'disguise', moves: ['splash'] },
		], [
			{ species: 'Beedrill', ability: 'swarm', moves: ['twineedle'] },
		]]);
		assert.hurts(battle.p1.active[0], () => battle.makeChoices());
	});

	it(`should bust Disguise on self-hit confusion`, () => {
		battle = common.gen(7).createBattle({ forceRandomChance: true }, [[
			{ species: 'Mimikyu', ability: 'disguise', moves: ['splash'] },
		], [
			{ species: 'Sableye', ability: 'prankster', moves: ['confuseray'] },
		]]);

		battle.makeChoices();
		assert(battle.p1.active[0].abilityState.busted);
	});

	it('should not block damage from weather effects', () => {
		battle = common.createBattle([[
			{ species: 'Mimikyu', ability: 'disguise', moves: ['splash'] },
		], [
			{ species: 'Tyranitar', ability: 'sandstream', moves: ['rest'] },
		]]);
		assert.hurts(battle.p1.active[0], () => battle.makeChoices());
	});

	it('should not block damage from entry hazards', () => {
		battle = common.createBattle([[
			{ species: 'Zangoose', ability: 'toxicboost', item: 'laggingtail', moves: ['return'] },
			{ species: 'Mimikyu', ability: 'disguise', moves: ['splash'] },
		], [
			{ species: 'forretress', ability: 'sturdy', item: 'redcard', moves: ['spikes'] },
		]]);
		battle.makeChoices();
		assert.false.fullHP(battle.p1.active[0]);
	});

	it('should not block status moves or damage from status', () => {
		battle = common.createBattle([[
			{ species: 'Mimikyu', ability: 'disguise', moves: ['splash'] },
		], [
			{ species: 'Ariados', ability: 'swarm', moves: ['toxicthread'] },
		]]);
		const pokemon = battle.p1.active[0];
		assert.sets(() => pokemon.status, 'psn', () => battle.makeChoices());
		assert.statStage(pokemon, 'spe', -1);
		assert.false.fullHP(pokemon);
	});

	it('should not block secondary effects from damaging moves', () => {
		battle = common.gen(7).createBattle([[
			{ species: 'Mimikyu', ability: 'disguise', moves: ['splash'] },
		], [
			{ species: 'Pikachu', ability: 'lightningrod', moves: ['nuzzle'] },
		]]);
		const pokemon = battle.p1.active[0];
		assert.sets(() => pokemon.status, 'par', () => battle.makeChoices());
		assert.fullHP(pokemon);
	});

	it('should cause Counter to deal 1 damage if it blocks a move', () => {
		battle = common.createBattle([[
			{ species: 'Mimikyu', ability: 'disguise', moves: ['counter'] },
		], [
			{ species: 'Weavile', ability: 'pressure', moves: ['feintattack'] },
		]]);
		assert.hurtsBy(battle.p2.active[0], 1, () => battle.makeChoices());
	});

	it('should not trigger critical hits while active', () => {
		battle = common.createBattle([[
			{ species: 'Mimikyu', ability: 'disguise', moves: ['sleeptalk'] },
		], [
			{ species: 'Cryogonal', ability: 'noguard', moves: ['frostbreath'] },
		]]);
		battle.makeChoices();
		assert(battle.log.every(line => !line.startsWith('|-crit')));
	});

	it(`should not work while Transformed`, () => {
		battle = common.createBattle([[
			{ species: 'Mimikyu', ability: 'disguise', moves: ['transform'] },
		], [
			{ species: 'Mimikyu', ability: 'disguise', moves: ['sleeptalk', 'aerialace'] },
		]]);
		battle.makeChoices();
		battle.makeChoices('auto', 'move aerialace');
		const transformedMimikyu = battle.p1.active[0];
		assert.species(transformedMimikyu, 'Mimikyu', `Transformed Mimikyu should not have changed to Mimikyu-busted after taking damage`);
		assert.false.fullHP(transformedMimikyu);
	});
});