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

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

let battle;

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

	it(`should be able to target an ally in doubles`, () => {
		battle = common.createBattle({ gameType: 'doubles' }, [[
			{ species: 'Wynaut', moves: ['acupressure'] },
			{ species: 'Smoochum', moves: ['sleeptalk'] },
		], [
			{ species: 'Clamperl', moves: ['sleeptalk'] },
			{ species: 'Whismur', moves: ['sleeptalk'] },
		]]);

		assert.false.cantMove(() => battle.choose('p1', 'move acupressure -2, move sleeptalk'));
	});

	it(`should be unable to target any opponent in free-for-alls`, () => {
		battle = common.createBattle({ gameType: 'freeforall' }, [[
			{ species: 'Wynaut', moves: ['acupressure'] },
		], [
			{ species: 'Cufant', moves: ['sleeptalk'] },
		], [
			{ species: 'Qwilfish', moves: ['sleeptalk'] },
		], [
			{ species: 'Marowak', moves: ['sleeptalk'] },
		]]);

		assert.cantMove(() => battle.choose('p1', 'move acupressure 1'));
		assert.cantMove(() => battle.choose('p1', 'move acupressure 2'));
		assert.cantMove(() => battle.choose('p1', 'move acupressure -2'));
	});

	// https://www.smogon.com/forums/threads/acupressure-targeting.3733779/post-9920405
	it(`should redirect to the user if a targetted ally faints`, () => {
		battle = common.createBattle({ gameType: 'doubles' }, [[
			{ species: 'Pincurchin', moves: ['acupressure'] },
			{ species: 'Flutter Mane', moves: ['memento'] },
		], [
			{ species: 'Furret', moves: ['sleeptalk'] },
			{ species: 'Chien-Pao', moves: ['haze'] },
		]]);

		battle.makeChoices('move acupressure -2, move memento 1', 'auto');
		assert(Object.values(battle.p1.active[0].boosts).some(n => n === 2));
		battle.makeChoices('move acupressure -2, pass', 'auto');
		assert(Object.values(battle.p1.active[0].boosts).some(n => n === 2));
	});

	it(`in Gen 5, should not redirect to the uesr if a targetted ally faints`, () => {
		battle = common.gen(5).createBattle({ gameType: 'doubles' }, [[
			{ species: 'Shuckle', moves: ['acupressure'] },
			{ species: 'Dugtrio', moves: ['memento'] },
		], [
			{ species: 'Marshtomp', moves: ['sleeptalk'] },
			{ species: 'Nincada', moves: ['sleeptalk'] },
		]]);

		battle.makeChoices('move acupressure -2, move memento 1', 'auto');
		assert(Object.values(battle.p1.active[0].boosts).every(n => n === 0));
		battle.makeChoices('move acupressure -2, pass', 'auto');
		assert(Object.values(battle.p1.active[0].boosts).every(n => n === 0));
	});
});