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

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

let battle;

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

	it('should invert relative stat changes', function () {
		this.timeout(0);
		battle = common.createBattle([[
			{ species: "Spinda", ability: 'contrary', moves: ['superpower'] },
		], [
			{ species: "Dragonite", ability: 'multiscale', moves: ['dragondance'] },
		]]);
		const contraryMon = battle.p1.active[0];
		battle.makeChoices('move superpower', 'move dragondance');
		assert.statStage(contraryMon, 'atk', 1);
		assert.statStage(contraryMon, 'def', 1);
	});

	it('should not invert absolute stat changes', () => {
		battle = common.createBattle([[
			{ species: "Serperior", ability: 'contrary', moves: ['leechseed'] },
		], [
			{ species: "Growlithe", ability: 'intimidate', moves: ['topsyturvy'] },
		]]);
		const contraryMon = battle.p1.active[0];
		battle.makeChoices('move leechseed', 'move topsyturvy');
		assert.statStage(contraryMon, 'atk', -1);
	});

	it('should invert Belly Drum\'s maximizing Attack', () => {
		battle = common.createBattle([[
			{ species: "Spinda", ability: 'contrary', moves: ['bellydrum'] },
		], [
			{ species: "Dragonite", ability: 'multiscale', moves: ['dragondance'] },
		]]);
		const contraryMon = battle.p1.active[0];
		battle.makeChoices('move bellydrum', 'move dragondance');
		assert.statStage(contraryMon, 'atk', -6);
	});

	it('should be suppressed by Mold Breaker', () => {
		battle = common.createBattle([[
			{ species: "Spinda", ability: 'contrary', moves: ['tackle'] },
		], [
			{ species: "Dragonite", ability: 'moldbreaker', moves: ['growl'] },
		]]);
		const contraryMon = battle.p1.active[0];
		battle.makeChoices('move tackle', 'move growl');
		assert.statStage(contraryMon, 'atk', -1);
	});
});