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

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

let battle;

describe("Hunger Switch", () => {
	afterEach(() => {
		battle.destroy();
	});

	it("should alternate forms every turn", () => {
		battle = common.createBattle([[
			{ species: 'Morpeko', ability: 'hungerswitch', moves: ['rest'] },
		], [
			{ species: 'Magikarp', ability: 'Swift Swim', moves: ['splash'] },
		]]);
		const peko = battle.p1.active[0];
		assert.species(peko, 'Morpeko');
		battle.makeChoices();
		assert.species(peko, 'Morpeko-Hangry');
		battle.makeChoices();
		assert.species(peko, 'Morpeko');
	});

	it("should revert back to the base form when switched out", () => {
		battle = common.createBattle([[
			{ species: 'Morpeko', ability: 'hungerswitch', moves: ['rest'] },
			{ species: 'Furret', ability: 'Run Away', moves: ['sleeptalk'] },
		], [
			{ species: 'Magikarp', ability: 'Swift Swim', moves: ['splash'] },
			{ species: 'Koffing', ability: 'neutralizinggas', moves: ['sleeptalk'] },
		]]);
		const peko = battle.p1.active[0];
		battle.makeChoices();
		assert.species(peko, 'Morpeko-Hangry');
		battle.makeChoices('switch 2', 'auto');
		battle.makeChoices('switch 2', 'switch 2');
		assert.species(peko, 'Morpeko');
	});

	it("should stop activating when Morpeko Terastallizes", () => {
		battle = common.gen(9).createBattle([[
			{ species: 'Morpeko', ability: 'hungerswitch', moves: ['rest'] },
		], [
			{ species: 'Magikarp', ability: 'Swift Swim', moves: ['splash'] },
		]]);
		const peko = battle.p1.active[0];
		battle.makeChoices();
		assert.species(peko, 'Morpeko-Hangry');
		battle.makeChoices('move 1 terastallize', 'auto');
		assert.species(peko, 'Morpeko-Hangry');
	});

	it("should maintain its form when Terastallized, even when switched out", () => {
		battle = common.gen(9).createBattle([[
			{ species: 'Morpeko', ability: 'hungerswitch', moves: ['rest'] },
			{ species: 'Furret', ability: 'Run Away', moves: ['sleeptalk'] },
		], [
			{ species: 'Magikarp', ability: 'Swift Swim', moves: ['splash'] },
			{ species: 'Koffing', ability: 'neutralizinggas', moves: ['sleeptalk'] },
		]]);
		const peko = battle.p1.active[0];
		battle.makeChoices();
		battle.makeChoices('move 1 terastallize', 'auto');
		assert.species(peko, 'Morpeko-Hangry');
		battle.makeChoices('switch 2', 'auto');
		battle.makeChoices('switch 2', 'switch 2');
		assert.species(peko, 'Morpeko-Hangry');
	});
});