File size: 1,747 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('Berserk', () => {
	afterEach(() => {
		battle.destroy();
	});

	it(`should activate prior to healing from Sitrus Berry`, () => {
		battle = common.createBattle([[
			{ species: 'drampa', item: 'sitrusberry', ability: 'berserk', evs: { hp: 4 }, moves: ['sleeptalk'] },
		], [
			{ species: 'wynaut', ability: 'compoundeyes', moves: ['superfang'] },
		]]);

		battle.makeChoices();
		const drampa = battle.p1.active[0];
		assert.statStage(drampa, 'spa', 1);
		assert.equal(drampa.hp, Math.floor(drampa.maxhp / 2) + Math.floor(drampa.maxhp / 4));
	});

	it(`should not activate prior to healing from Sitrus Berry after a multi-hit move`, () => {
		battle = common.createBattle([[
			{ species: 'drampa', item: 'sitrusberry', ability: 'berserk', evs: { hp: 4 }, moves: ['sleeptalk'] },
		], [
			{ species: 'wynaut', ability: 'parentalbond', moves: ['seismictoss'] },
		]]);

		battle.makeChoices();
		const drampa = battle.p1.active[0];
		assert.statStage(drampa, 'spa', 0);
		assert.equal(drampa.hp, drampa.maxhp - 200 + Math.floor(drampa.maxhp / 4));
	});

	it(`should not activate below 50% HP if it was damaged by Dragon Darts`, () => {
		battle = common.createBattle({ gameType: 'doubles' }, [[
			{ species: 'drampa', ability: 'berserk', evs: { hp: 4 }, moves: ['sleeptalk'] },
			{ species: 'togedemaru', ability: 'compoundeyes', moves: ['superfang'] },
		], [
			{ species: 'wynaut', moves: ['dragondarts'] },
			{ species: 'shuckle', moves: ['sleeptalk'] },
		]]);

		battle.makeChoices('move sleeptalk, move superfang -1', 'auto');
		const drampa = battle.p1.active[0];
		assert.statStage(drampa, 'spa', 1);
	});
});