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

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

let battle;

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

	it(`should negate natural immunities and deal normal type effectiveness with the other type(s)`, () => {
		battle = common.createBattle([[
			{ species: "Smeargle", ability: 'owntempo', moves: ['earthquake', 'vitalthrow', 'shadowball', 'psychic'] },
		], [
			{ species: "Thundurus", ability: 'prankster', item: 'ringtarget', moves: ['rest'] },
			{ species: "Drifblim", ability: 'unburden', item: 'ringtarget', moves: ['rest'] },
			{ species: "Girafarig", ability: 'innerfocus', item: 'ringtarget', moves: ['rest'] },
			{ species: "Absol", ability: 'superluck', item: 'ringtarget', moves: ['rest'] },
		]]);

		battle.makeChoices('move earthquake', 'move rest');
		assert(battle.log[battle.lastMoveLine + 1].startsWith('|-supereffective|'));
		assert.false.fullHP(battle.p2.active[0]);

		battle.makeChoices('move vitalthrow', 'switch 2'); // Drifblim
		assert(battle.log[battle.lastMoveLine + 1].startsWith('|-resisted|'));
		assert.false.fullHP(battle.p2.active[0]);

		battle.makeChoices('move shadowball', 'switch 3'); // Girafarig
		assert(battle.log[battle.lastMoveLine + 1].startsWith('|-supereffective|'));
		assert.false.fullHP(battle.p2.active[0]);

		battle.makeChoices('move psychic', 'switch 4'); // Absol
		assert.false.fullHP(battle.p2.active[0]);
	});

	it(`should not affect ability-based immunities`, () => {
		battle = common.createBattle([[
			{ species: 'Hariyama', moves: ['earthquake'] },
		], [
			{ species: 'Mismagius', ability: 'levitate', item: 'ringtarget', moves: ['sleeptalk'] },
			{ species: 'Rotom-Fan', ability: 'levitate', item: 'ringtarget', moves: ['sleeptalk'] },
		]]);

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

		// even if Rotom-Fan
		battle.makeChoices('move earthquake', 'switch 2');
		assert.fullHP(battle.p2.active[0]);
	});

	it(`should not affect Magnet Rise`, () => {
		battle = common.createBattle([[
			{ species: 'Wynaut', moves: ['earthquake'] },
		], [
			{ species: 'Klefki', item: 'ringtarget', moves: ['magnetrise'] },
		]]);

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