File size: 3,476 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('Costar', () => {
	afterEach(() => {
		battle.destroy();
	});

	it('should copy the teammate\'s crit ratio on activation', () => {
		battle = common.createBattle({ gameType: 'doubles' });
		battle.setPlayer('p1', { team: [
			{ species: 'Smeargle', level: 1, moves: ['sleeptalk', 'focusenergy'] },
			{ species: 'Suicune', level: 1, moves: ['sleeptalk'] },
			{ species: 'Flamigo', level: 1, ability: 'costar', moves: ['sleeptalk'] },
		] });
		battle.setPlayer('p2', { team: [
			{ species: 'Suicune', level: 1, moves: ['sleeptalk'] },
			{ species: 'pikachu', level: 1, moves: ['sleeptalk'] },
			{ species: 'weezinggalar', level: 1, ability: 'neutralizinggas', moves: ['sleeptalk'] },
		] });

		battle.makeChoices('move focusenergy, move sleeptalk', 'move sleeptalk, move sleeptalk');
		battle.makeChoices('move sleeptalk, switch flamigo', 'move sleeptalk, move sleeptalk');

		const flamigo = battle.p1.active[1];
		assert(flamigo.volatiles['focusenergy'], "Costar should copy volatile crit modifiers.");

		battle.makeChoices('switch suicune, move sleeptalk', 'switch weezinggalar, move sleeptalk');
		battle.makeChoices('move sleeptalk, move sleeptalk', 'switch suicune, move sleeptalk');
		assert(!flamigo.volatiles['focusenergy'], "Costar should copy having no volatile crit modifiers when re-activated.");
	});

	it('should copy both positive and negative stat changes', () => {
		battle = common.createBattle({ gameType: 'doubles' });
		battle.setPlayer('p1', { team: [
			{ species: 'Suicune', level: 1, moves: ['sleeptalk'] },
			{ species: 'Smeargle', level: 1, moves: ['sleeptalk', 'shellsmash'] },
			{ species: 'Flamigo', level: 1, ability: 'costar', moves: ['sleeptalk'] },
		] });
		battle.setPlayer('p2', { team: [
			{ species: 'Suicune', level: 1, moves: ['sleeptalk'] },
			{ species: 'Suicune', level: 1, moves: ['sleeptalk'] },
		] });

		battle.makeChoices('move sleeptalk, move shellsmash', 'move sleeptalk, move sleeptalk');
		battle.makeChoices('switch flamigo, move sleeptalk', 'move sleeptalk, move sleeptalk');

		const flamigo = battle.p1.active[0];
		assert.statStage(flamigo, 'atk', 2, "A pokemon should copy the target's positive stat changes (atk) when switching in with Costar.");
		assert.statStage(flamigo, 'spa', 2, "A pokemon should copy the target's positive stat changes (spa) when switching in with Costar.");
		assert.statStage(flamigo, 'spe', 2, "A pokemon should copy the target's positive stat changes (spe) when switching in with Costar.");
		assert.statStage(flamigo, 'def', -1, "A pokemon should copy the target's negative stat changes (def) when switching in with Costar.");
		assert.statStage(flamigo, 'spd', -1, "A pokemon should copy the target's negative stat changes (spd) when switching in with Costar.");
	});

	it('should always activate later than Intimidate during simultaneous switch-ins', () => {
		battle = common.createBattle({ gameType: 'doubles' }, [[
			{ species: 'flamigo', ability: 'costar', moves: ['sleeptalk'] },
			{ species: 'registeel', ability: 'clearbody', moves: ['sleeptalk'] },
		], [
			{ species: 'litten', ability: 'intimidate', moves: ['sleeptalk'] },
			{ species: 'dipplin', ability: 'supersweetsyrup', moves: ['sleeptalk'] },
		]]);
		const flamigo = battle.p1.active[0];
		assert.statStage(flamigo, 'atk', 0);
		assert.statStage(flamigo, 'evasion', 0);
	});
});