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

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

let battle;

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

	it(`should activate after a physical move`, () => {
		battle = common.createBattle([[
			{ species: "Charizard", evs: { hp: 252 }, moves: ['scratch', 'ember'] },
		], [
			{ species: "Cramorant", item: 'jabocaberry', moves: ['sleeptalk'] },
		]]);

		const charizard = battle.p1.active[0];
		battle.makeChoices('move ember', 'default');
		assert.fullHP(charizard);
		assert.hurtsBy(charizard, charizard.maxhp / 8, () => battle.makeChoices());
	});

	it(`should activate even if the holder has 0 HP`, () => {
		battle = common.createBattle([[
			{ species: "Morpeko", evs: { hp: 252 }, moves: ['aurawheel'] },
		], [
			{ species: "Cramorant", item: 'jabocaberry', moves: ['sleeptalk'] },
		]]);

		const morpeko = battle.p1.active[0];
		assert.hurtsBy(morpeko, morpeko.maxhp / 8, () => battle.makeChoices());
	});

	it(`should not activate after a physical move used by a Pokemon with Magic Guard`, () => {
		battle = common.createBattle([[
			{ species: "Clefable", ability: 'magicguard', moves: ['pound'] },
		], [
			{ species: "Cramorant", item: 'jabocaberry', moves: ['sleeptalk'] },
		]]);

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