File size: 8,242 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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
'use strict';

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

let battle;

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

	it('should only copy dance moves used by other Pokemon', () => {
		battle = common.createBattle([[
			{ species: 'Oricorio', ability: 'dancer', moves: ['swordsdance'] },
		], [
			{ species: 'Oricorio', ability: 'dancer', moves: ['howl'] },
		]]);
		battle.makeChoices('move swordsdance', 'move howl');
		assert.statStage(battle.p1.active[0], 'atk', 2);
		assert.statStage(battle.p2.active[0], 'atk', 3);
	});

	it('should activate in order of lowest to highest raw speed', () => {
		battle = common.createBattle({ gameType: 'doubles' }, [[
			{ species: 'Shedinja', level: 98, ability: 'dancer', item: 'focussash', moves: ['sleeptalk'] },
			{ species: 'Shedinja', level: 99, ability: 'dancer', moves: ['sleeptalk'] },
		], [
			{ species: 'Shedinja', ability: 'wonderguard', moves: ['fierydance'] },
			{ species: 'Shedinja', ability: 'dancer', moves: ['sleeptalk'] },
		]]);
		const [, fastDancer] = battle.p1.active;
		const [wwDanceSource, foeDancer] = battle.p2.active;
		fastDancer.boostBy({ spe: 6 });
		battle.makeChoices('move sleeptalk, move sleeptalk', 'move fierydance 1, move sleeptalk');
		assert.fainted(wwDanceSource);
		assert.fainted(foeDancer);
	});

	it('should activate in order of lowest to highest raw speed inside Trick Room', () => {
		battle = common.createBattle({ gameType: 'doubles' }, [[
			{ species: 'Shedinja', level: 98, ability: 'dancer', item: 'focussash', moves: ['sleeptalk'] },
			{ species: 'Shedinja', level: 99, ability: 'dancer', moves: ['sleeptalk'] },
		], [
			{ species: 'Shedinja', ability: 'wonderguard', moves: ['fierydance', 'trickroom'] },
			{ species: 'Shedinja', ability: 'dancer', moves: ['sleeptalk'] },
		]]);
		const [, fastDancer] = battle.p1.active;
		const [wwDanceSource, foeDancer] = battle.p2.active;
		fastDancer.boostBy({ spe: 6 });
		battle.makeChoices('move sleeptalk, move sleeptalk', 'move trickroom, move sleeptalk');
		battle.makeChoices('move sleeptalk, move sleeptalk', 'move fierydance 1, move sleeptalk');
		assert.fainted(wwDanceSource);
		assert.fainted(foeDancer);
	});

	it(`should not copy a move that was blocked by Protect`, () => {
		battle = common.createBattle([[
			{ species: 'Oricorio', ability: 'dancer', moves: ['protect'] },
		], [
			{ species: 'Wynaut', ability: 'dancer', moves: ['fierydance'] },
		]]);

		battle.makeChoices();
		assert.fullHP(battle.p2.active[0]);
	});

	it(`should not copy Teeter Dance when all targets are confused`, () => {
		battle = common.createBattle({ gameType: 'doubles' }, [[
			{ species: 'Oricorio', ability: 'dancer', moves: ['sleeptalk', 'protect'] },
			{ species: 'Slowbro', ability: 'owntempo', moves: ['sleeptalk'] },
		], [
			{ species: 'Wynaut', ability: 'dancer', item: 'persimberry', moves: ['sleeptalk', 'teeterdance'] },
			{ species: 'Slowking', ability: 'owntempo', moves: ['sleeptalk'] },
		]]);

		const wynaut = battle.p2.active[0];
		battle.makeChoices('move protect, move sleeptalk', 'move teeterdance, move sleeptalk');
		assert.holdsItem(wynaut, `Persim Berry should not be consumed, because Dancer did not activate`);

		battle.makeChoices('auto', 'move teeterdance, move sleeptalk');
		assert(battle.log.some(line => line.includes('Dancer')));
	});

	it(`should not copy a Dance move that failed for other reasons`, () => {
		battle = common.createBattle({ gameType: 'doubles' }, [[
			{ species: 'mew', ability: 'dancer', moves: ['dragondance', 'protect'] },
			{ species: 'wynaut', ability: 'dancer', moves: ['featherdance'] },
		], [
			{ species: 'oricoriopau', ability: 'dancer', moves: ['revelationdance', 'protect'] },
			{ species: 'shedinja', ability: 'wonderguard', moves: ['finalgambit'] },
		]]);
		const mew = battle.p1.active[0];
		const wynaut = battle.p1.active[1];
		const oricorio = battle.p2.active[0];

		mew.boostBy({ atk: 6, spe: 6 });
		oricorio.boostBy({ atk: -6 });

		battle.makeChoices('move dragondance, move featherdance 1', 'move revelationdance -2, move finalgambit 1');
		assert.fullHP(oricorio, `Nothing should target Oricorio because Revelation Dance failed from Wonder Guard`);
		assert.statStage(wynaut, 'atk', 0, `Wynaut's attack should not have changed from either Feather Dance or Dragon Dance, because both failed`);
	});

	it(`should not copy a move that missed`, () => {
		battle = common.createBattle([[
			{ species: 'Oricorio', ability: 'dancer', moves: ['revelationdance'] },
		], [
			{ species: 'Wynaut', ability: 'dancer', moves: ['dig'] },
		]]);

		// Modding accuracy so Revelation Dance always misses if Oricorio uses it (Wynaut should in fact never use it though)
		battle.onEvent('Accuracy', battle.format, (accuracy, target, pokemon, move) => {
			return pokemon.id === 'wynaut';
		});

		battle.makeChoices(); // miss on initial use
		battle.makeChoices(); // miss into semi-invulnerability
		assert.false(battle.log.some(line => line.includes('Dancer')));
	});

	it('should copy a move that hit, but did 0 damage', () => {
		battle = common.createBattle([[
			{ species: 'Oricorio', ability: 'dancer', moves: ['fierydance'] },
		], [
			{ species: 'Shedinja', ability: 'dancer', item: 'focussash', moves: ['meanlook'] },
		]]);
		const dancer = battle.p1.active[0];
		assert.hurts(dancer, () => battle.makeChoices('move fierydance', 'move meanlook'));
	});

	it('should not activate if the holder fainted', () => {
		battle = common.createBattle([[
			{ species: 'Oricoriopompom', ability: 'dancer', moves: ['revelationdance'] },
		], [
			{ species: 'oricorio', ability: 'dancer', level: 1, moves: ['sleeptalk'] },
			{ species: 'oricorio', ability: 'dancer', level: 1, moves: ['sleeptalk'] },
		]]);
		battle.makeChoices();
		assert(!battle.log.includes('|-activate|p2: Oricorio|ability: Dancer'));
	});

	it('should target the user of a Dance move unless it was an ally attacking an opponent', () => {
		battle = common.createBattle({ gameType: 'doubles' }, [[
			{ species: 'Oricorio', level: 98, ability: 'dancer', item: 'laggingtail', moves: ['sleeptalk', 'protect', 'teeterdance'] },
			{ species: 'Oricorio', level: 99, ability: 'heatproof', moves: ['fierydance', 'sleeptalk'] },
		], [
			{ species: 'Oricorio', ability: 'heatproof', moves: ['fierydance', 'sleeptalk'] },
			{ species: 'Suicune', ability: 'heatproof', moves: ['sleeptalk'] },
		]]);

		const opponentTargetingAlly = battle.p2.active[0];
		assert.hurts(opponentTargetingAlly, () => battle.makeChoices('move sleeptalk, move sleeptalk', 'move fierydance 2, move sleeptalk'));

		const opponentTargetingOpponent = battle.p2.active[0];
		assert.hurts(opponentTargetingOpponent, () => battle.makeChoices('move sleeptalk, move sleeptalk', 'move fierydance -2, move sleeptalk'));

		const allyTargetingDancer = battle.p1.active[1];
		assert.hurts(allyTargetingDancer, () => battle.makeChoices('move sleeptalk, move fierydance -1', 'move sleeptalk, move sleeptalk'));

		const allyTargetingOpponent = battle.p1.active[1];
		const allyHP = allyTargetingOpponent.hp;
		const opponentTargetedByAlly = battle.p2.active[1];
		const opponentNotTargetedByAlly = battle.p2.active[0];
		const opponentHP = opponentNotTargetedByAlly.hp;
		assert.hurts(opponentTargetedByAlly, () => battle.makeChoices('move sleeptalk, move fierydance 2', 'move sleeptalk, move sleeptalk'));
		assert.equal(allyTargetingOpponent.hp, allyHP);
		assert.equal(opponentNotTargetedByAlly.hp, opponentHP);
	});

	it('should adopt the target selected by copycat', () => {
		battle = common.createBattle({ gameType: 'doubles', seed: [1, 2, 3, 4] }, [[
			{ species: 'oricoriopau', ability: 'dancer', moves: ['featherdance'] },
			{ species: 'flamigo', moves: ['copycat'] },
		], [
			{ species: 'fletchinder', level: 1, moves: ['sleeptalk'] },
			{ species: 'squawkabilly', level: 1, moves: ['sleeptalk'] },
		]]);
		battle.makeChoices('move featherdance 1, move copycat', 'auto');
		const flamigo = battle.p1.active[1];
		const [fletchinder, squawkabilly] = battle.p2.active;
		assert.equal(flamigo.boosts.atk, 0);
		assert.equal(fletchinder.boosts.atk, -2);
		assert.equal(squawkabilly.boosts.atk, -4);
	});
});