File size: 2,449 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('Mail', () => {
	afterEach(() => {
		battle.destroy();
	});

	it('should not be stolen by most moves or abilities', () => {
		battle = common.createBattle();
		battle.setPlayer('p1', { team: [{ species: 'Blissey', ability: 'naturalcure', item: 'mail', moves: ['softboiled'] }] });
		battle.setPlayer('p2', { team: [
			{ species: 'Fennekin', ability: 'magician', moves: ['grassknot'] },
			{ species: 'Abra', ability: 'synchronize', moves: ['trick'] },
			{ species: 'Lopunny', ability: 'klutz', moves: ['switcheroo'] },
		] });
		const holder = battle.p1.active[0];
		assert.constant(() => holder.item, () => battle.makeChoices('move softboiled', 'move grassknot'));
		battle.makeChoices('move softboiled', 'switch 2');
		assert.constant(() => holder.item, () => battle.makeChoices('move softboiled', 'move trick'));
		battle.makeChoices('move softboiled', 'switch 3');
		assert.constant(() => holder.item, () => battle.makeChoices('move softboiled', 'move switcheroo'));
	});

	it('should not be removed by Fling', () => {
		battle = common.createBattle();
		battle.setPlayer('p1', { team: [{ species: 'Pangoro', ability: 'ironfist', moves: ['swordsdance'] }] });
		battle.setPlayer('p2', { team: [{ species: 'Abra', ability: 'synchronize', item: 'mail', moves: ['fling'] }] });
		const holder = battle.p2.active[0];
		assert.constant(() => holder.item, () => battle.makeChoices('move swordsdance', 'move fling'));
	});

	it('should be removed by Knock Off', () => {
		battle = common.createBattle();
		battle.setPlayer('p1', { team: [{ species: 'Pangoro', ability: 'ironfist', item: 'mail', moves: ['swordsdance'] }] });
		battle.setPlayer('p2', { team: [{ species: 'Abra', ability: 'synchronize', moves: ['knockoff'] }] });
		const holder = battle.p1.active[0];
		assert.false.constant(() => holder.item, () => battle.makeChoices('move swordsdance', 'move knockoff'));
	});

	it('should be stolen by Thief', () => {
		battle = common.createBattle();
		battle.setPlayer('p1', { team: [{ species: 'Pangoro', ability: 'ironfist', item: 'mail', moves: ['swordsdance'] }] });
		battle.setPlayer('p2', { team: [{ species: 'Abra', ability: 'synchronize', moves: ['thief'] }] });
		const holder = battle.p1.active[0];
		assert.false.constant(() => holder.item, () => battle.makeChoices('move swordsdance', 'move thief'));
	});
});