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

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

let battle;

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

	it(`should be disabled if the user has not consumed a berry`, () => {
		battle = common.createBattle([[
			{ species: 'Swalot', item: 'lumberry', moves: ['belch', 'stockpile'] },
		], [
			{ species: 'Registeel', item: 'laggingtail', moves: ['glare'] },
		]]);

		const swalot = battle.p1.active[0];
		battle.makeChoices('move stockpile', 'move glare');
		assert.equal(swalot.lastMove.id, 'stockpile');
		battle.makeChoices('move belch', 'move glare');
		assert.equal(swalot.lastMove.id, 'belch');
	});

	it('should count berries as consumed with Bug Bite or Pluck', () => {
		battle = common.createBattle();
		battle.setPlayer('p1', { team: [{ species: 'Swalot', ability: 'gluttony', item: 'salacberry', moves: ['belch', 'bugbite'] }] });
		battle.setPlayer('p2', { team: [{ species: 'Swalot', ability: 'gluttony', item: 'salacberry', moves: ['belch', 'pluck'] }] });
		battle.makeChoices('move Bugbite', 'move Pluck');
		battle.makeChoices('move Belch', 'move Belch');
		assert.equal(battle.p1.active[0].lastMove.id, 'belch');
		assert.equal(battle.p2.active[0].lastMove.id, 'belch');
	});

	it('should count berries as consumed when they are Flung', () => {
		battle = common.createBattle();
		battle.setPlayer('p1', { team: [{ species: 'Swalot', ability: 'gluttony', moves: ['belch', 'stockpile'] }] });
		battle.setPlayer('p2', { team: [{ species: 'Machamp', ability: 'noguard', item: 'salacberry', moves: ['fling'] }] });
		battle.makeChoices('move Stockpile', 'move Fling');
		battle.makeChoices('move Belch', 'move Fling');
		assert.equal(battle.p1.active[0].lastMove.id, 'belch');
	});

	it('should still count berries as consumed after switch out', () => {
		battle = common.createBattle();
		battle.setPlayer('p1', { team: [
			{ species: 'Swalot', item: 'lumberry', moves: ['belch', 'uturn'] },
			{ species: 'Swalot', moves: ['toxic'] },
		] });
		battle.setPlayer('p2', { team: [{
			species: 'Rotom', moves: ['rest', 'willowisp'],
		}] });
		battle.makeChoices('move Uturn', 'move Will-o-Wisp');
		battle.makeChoices('switch 2', ''); // For U-Turn
		battle.makeChoices('switch 2', 'move Will-o-Wisp');
		battle.makeChoices('move Belch', 'move Will-o-Wisp');
		assert.equal(battle.p1.active[0].lastMove.id, 'belch');
	});
});