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

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

let battle;

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

	it('should flinch on the first turn out', () => {
		battle = common.createBattle([[
			{ species: 'Chansey', ability: 'naturalcure', moves: ['fakeout'] },
		], [
			{ species: 'Venusaur', ability: 'overgrow', moves: ['swift'] },
		]]);
		battle.makeChoices('move fakeout', 'move swift');
		assert.equal(battle.p1.active[0].hp, battle.p1.active[0].maxhp);
	});

	it('should not flinch on the second turn out', () => {
		battle = common.createBattle([[
			{ species: 'Chansey', ability: 'naturalcure', moves: ['fakeout'] },
		], [
			{ species: 'Venusaur', ability: 'overgrow', moves: ['swift'] },
		]]);
		battle.makeChoices('move fakeout', 'move swift');
		assert.equal(battle.p1.active[0].hp, battle.p1.active[0].maxhp);
		battle.makeChoices('move fakeout', 'move swift');
		assert.notEqual(battle.p1.active[0].hp, battle.p1.active[0].maxhp);
	});

	it('should flinch after switching out and back in to refresh the move', () => {
		battle = common.createBattle([[
			{ species: 'Chansey', ability: 'naturalcure', moves: ['fakeout'] },
			{ species: 'Blissey', ability: 'naturalcure', moves: ['fakeout'] },
		], [
			{ species: 'Venusaur', ability: 'overgrow', moves: ['swift', 'sleeptalk'] },
		]]);
		battle.makeChoices('move fakeout', 'move swift');
		battle.makeChoices('switch 2', 'move sleeptalk');
		battle.makeChoices('switch 2', 'move sleeptalk');
		battle.makeChoices('move fakeout', 'move swift');
		assert.equal(battle.p1.active[0].hp, battle.p1.active[0].maxhp);
	});

	it('should not flinch if the user has already used a Dancer move first', () => {
		battle = common.createBattle([[
			{ species: 'Chansey', ability: 'naturalcure', moves: ['fakeout'] },
			{ species: 'Oricorio', ability: 'dancer', moves: ['fakeout'] },
		], [
			{ species: 'Venusaur', ability: 'overgrow', moves: ['swift', 'quiverdance'] },
		]]);
		battle.makeChoices('switch 2', 'move quiverdance');
		battle.makeChoices('move fakeout', 'move swift');
		assert.notEqual(battle.p1.active[0].hp, battle.p1.active[0].maxhp);
	});

	it('should not flinch if the target had prepared to Focus Punch', () => {
		battle = common.createBattle([[
			{ species: 'Hitmontop', ability: 'steadfast', moves: ['fakeout'] },
		], [
			{ species: 'Gallade', ability: 'steadfast', moves: ['focuspunch'] },
		]]);
		battle.makeChoices();
		assert.equal(battle.p2.active[0].boosts.spe, 0);
	});
});