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

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

let battle;

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

	it('should maximize Attack when hit by a critical hit', () => {
		battle = common.createBattle([[
			{ species: "Cryogonal", ability: 'noguard', moves: ['frostbreath'] },
		], [
			{ species: "Primeape", ability: 'angerpoint', moves: ['endure'] },
		]]);
		const angerMon = battle.p2.active[0];

		battle.makeChoices();
		assert.statStage(angerMon, 'atk', 6);
	});

	it('should maximize Attack when hit by a critical hit even if the foe has Mold Breaker', () => {
		battle = common.createBattle([[
			{ species: "Haxorus", ability: 'moldbreaker', item: 'scopelens', moves: ['focusenergy', 'falseswipe'] },
		], [
			{ species: "Primeape", ability: 'angerpoint', moves: ['defensecurl'] },
		]]);
		const angerMon = battle.p2.active[0];

		battle.makeChoices('move focusenergy', 'move defensecurl');
		battle.makeChoices('move falseswipe', 'move defensecurl');
		assert.statStage(angerMon, 'atk', 6);
	});

	it('should not maximize Attack when dealing a critical hit', () => {
		battle = common.createBattle([[
			{ species: "Cryogonal", ability: 'noguard', moves: ['endure'] },
		], [
			{ species: "Primeape", ability: 'angerpoint', moves: ['stormthrow'] },
		]]);
		const [defender, angerMon] = [battle.p1.active[0], battle.p2.active[0]];

		battle.makeChoices('move endure', 'move stormthrow');
		assert.statStage(defender, 'atk', 0);
		assert.statStage(angerMon, 'atk', 0);
	});

	it('should not maximize Attack when behind a substitute', () => {
		battle = common.createBattle([[
			{ species: "Cryogonal", ability: 'noguard', item: 'laggingtail', moves: ['frostbreath'] },
		], [
			{ species: "Primeape", ability: 'angerpoint', moves: ['substitute'] },
		]]);
		const angerMon = battle.p2.active[0];

		battle.makeChoices('move frostbreath', 'move substitute');
		assert.statStage(angerMon, 'atk', 0);
	});
});