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

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

let battle;

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

	it(`should replace the Abilities of the user and its ally with the Ability of its target`, () => {
		battle = common.createBattle({ gameType: 'doubles' }, [[
			{ species: 'wynaut', ability: 'shadowtag', moves: ['doodle'] },
			{ species: 'ironhands', ability: 'quarkdrive', moves: ['sleeptalk'] },
		], [
			{ species: 'clefable', ability: 'magicguard', moves: ['sleeptalk'] },
			{ species: 'mudkip', ability: 'torrent', moves: ['sleeptalk'] },
		]]);
		battle.makeChoices('move doodle 1, auto', 'auto');
		assert.equal(battle.p1.active[0].ability, 'magicguard');
		assert.equal(battle.p1.active[1].ability, 'magicguard');
	});

	it(`should fail against certain Abilities`, () => {
		battle = common.createBattle({ gameType: 'doubles' }, [[
			{ species: 'wynaut', ability: 'shadowtag', moves: ['doodle'] },
			{ species: 'ironhands', ability: 'quarkdrive', moves: ['sleeptalk'] },
		], [
			{ species: 'fluttermane', ability: 'protosynthesis', moves: ['sleeptalk'] },
			{ species: 'mudkip', ability: 'torrent', moves: ['sleeptalk'] },
		]]);
		battle.makeChoices('move doodle 1, auto', 'auto');
		assert.equal(battle.p1.active[0].ability, 'shadowtag');
		assert.equal(battle.p1.active[1].ability, 'quarkdrive');
	});

	it(`should not fail if only the user has an unreplaceable Ability`, () => {
		battle = common.createBattle({ gameType: 'doubles' }, [[
			{ species: 'komala', ability: 'comatose', moves: ['doodle'] },
			{ species: 'wynaut', ability: 'shadowtag', moves: ['swordsdance'] },
		], [
			{ species: 'clefable', ability: 'magicguard', moves: ['swordsdance'] },
			{ species: 'mudkip', ability: 'torrent', moves: ['swordsdance'] },
		]]);
		battle.makeChoices('move doodle 1, auto', 'auto');
		assert.equal(battle.p1.active[0].ability, 'comatose');
		assert.equal(battle.p1.active[1].ability, 'magicguard');
		assert.false(battle.log.some(line => line.includes('|-fail')));
	});
});