File size: 2,904 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
'use strict';

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

let battle;

describe("White Herb", () => {
	afterEach(() => {
		battle.destroy();
	});

	it('should activate after Parting Shot drops both stats, but before the switch is resolved', () => {
		battle = common.createBattle([[
			{ species: 'torracat', moves: ['partingshot'] },
			{ species: 'litten', moves: ['sleeptalk'] },
		], [
			{ species: 'wynaut', item: 'whiteherb', moves: ['sleeptalk'] },
		]]);
		battle.makeChoices();
		const wynaut = battle.p2.active[0];
		assert.false.holdsItem(wynaut);
		assert.statStage(wynaut, 'atk', 0);
		assert.statStage(wynaut, 'spa', 0);
	});

	it.skip('should activate after Abilities that boost stats on KOs', () => {
		battle = common.createBattle([[
			{ species: 'litten', level: 1, ability: 'noguard', moves: ['sleeptalk'] },
			{ species: 'torracat', moves: ['partingshot'] },
		], [
			{ species: 'wynaut', item: 'whiteherb', ability: 'grimneigh', moves: ['dracometeor'] },
		]]);
		battle.makeChoices();
		const wynaut = battle.p2.active[0];
		assert.false.holdsItem(wynaut);
		assert.statStage(wynaut, 'spa', 0);
	});

	it('should activate after two Intimidate switch in at the same time', () => {
		battle = common.createBattle({ gameType: 'doubles' }, [[
			{ species: 'litten', ability: 'intimidate', moves: ['sleeptalk'] },
			{ species: 'torracat', ability: 'intimidate', moves: ['sleeptalk', 'finalgambit'] },
			{ species: 'litten', ability: 'intimidate', moves: ['sleeptalk'] },
			{ species: 'landorustherian', ability: 'intimidate', moves: ['sleeptalk'] },
		], [
			{ species: 'wynaut', item: 'whiteherb', moves: ['sleeptalk', 'recycle'] },
			{ species: 'fraxure', moves: ['sleeptalk'] },
		]]);

		// Leads
		battle.makeChoices();
		const wynaut = battle.p2.active[0];
		assert.false.holdsItem(wynaut);
		assert.statStage(wynaut, 'atk', 0);

		// After a double KO
		battle.makeChoices('move sleeptalk, move finalgambit -1', 'move recycle, move sleeptalk');
		battle.makeChoices('switch 3, switch 4');
		assert.false.holdsItem(wynaut);
		assert.statStage(wynaut, 'atk', 0);
	});

	it('should activate before Opportunist during switch-ins', () => {
		battle = common.createBattle({ gameType: 'doubles' }, [[
			{ species: 'axew', moves: ['sleeptalk'] },
			{ species: 'fraxure', moves: ['finalgambit'] },
			{ species: 'zacian', ability: 'intrepidsword', moves: ['sleeptalk'] },
			{ species: 'torracat', ability: 'intimidate', moves: ['sleeptalk'] },
		], [
			{ species: 'flittle', item: 'whiteherb', ability: 'opportunist', moves: ['sleeptalk'] },
			{ species: 'haxorus', moves: ['sleeptalk'] },
		]]);
		battle.makeChoices('move sleeptalk, move finalgambit -1', 'auto');
		battle.makeChoices('switch 3, switch 4');
		const flittle = battle.p2.active[0];
		assert.false.holdsItem(flittle);
		assert.statStage(flittle, 'atk', 1);
	});
});