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

	it(`should activate Aguav Berry at 50% health`, () => {
		battle = common.createBattle([[
			{ species: "wobbuffet", ability: 'gluttony', item: 'aguavberry', evs: { hp: 4 }, moves: ['sleeptalk'] },
		], [
			{ species: "wynaut", ability: 'compoundeyes', moves: ['superfang'] },
		]]);

		battle.makeChoices();
		const wobbuffet = battle.p1.active[0];
		assert.equal(wobbuffet.hp, Math.floor(wobbuffet.maxhp / 2) + Math.floor(wobbuffet.maxhp / 3));
	});

	it(`should activate after Belly Drum`, () => {
		battle = common.createBattle([[
			{ species: "snorlax", ability: 'gluttony', item: 'aguavberry', evs: { hp: 4 }, moves: ['bellydrum'] },
		], [
			{ species: "wynaut", moves: ['sleeptalk'] },
		]]);

		battle.makeChoices();
		const snorlax = battle.p1.active[0];
		assert.equal(snorlax.hp, Math.floor(snorlax.maxhp / 2) + Math.floor(snorlax.maxhp / 3));
	});

	it(`should activate after poison damage`, () => {
		battle = common.createBattle([[
			{ species: "wobbuffet", ability: 'gluttony', item: 'aguavberry', evs: { hp: 28 }, moves: ['sleeptalk'] },
		], [
			{ species: "wynaut", ability: 'noguard', moves: ['poisonpowder'] },
		]]);

		for (let i = 0; i < 4; i++) battle.makeChoices();
		const wobbuffet = battle.p1.active[0];
		assert.equal(wobbuffet.hp, Math.floor(wobbuffet.maxhp / 2) + Math.floor(wobbuffet.maxhp / 3));
	});
});