File size: 4,908 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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
'use strict';

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

let battle;

describe('G-Max Volcalith', () => {
	afterEach(() => {
		battle.destroy();
	});

	it(`should not damage Rock-types`, () => {
		battle = common.gen(8).createBattle({ gameType: 'doubles' }, [[
			{ species: 'Coalossal', moves: ['rockthrow'], gigantamax: true },
			{ species: 'Wynaut', moves: ['sleeptalk'] },
		], [
			{ species: 'Blastoise', moves: ['sleeptalk'] },
			{ species: 'Boldore', moves: ['sleeptalk'] },
		]]);

		battle.makeChoices('move rockthrow 1 dynamax, move sleeptalk', 'move sleeptalk, move sleeptalk');
		assert.fullHP(battle.p2.active[1]);
	});

	it(`should deal damage for four turns, including the fourth turn`, () => {
		battle = common.gen(8).createBattle({ gameType: 'doubles' }, [[
			{ species: 'Coalossal', moves: ['sleeptalk', 'rockthrow'], gigantamax: true },
			{ species: 'Wynaut', moves: ['sleeptalk'] },
		], [
			{ species: 'Blastoise', moves: ['sleeptalk'] },
			{ species: 'Boldore', moves: ['sleeptalk'] },
		]]);

		battle.makeChoices('move rockthrow 2 dynamax, move sleeptalk', 'move sleeptalk, move sleeptalk');
		for (let i = 0; i < 3; i++) { battle.makeChoices(); }

		const blastoise = battle.p2.active[0];
		assert.equal(blastoise.hp, blastoise.maxhp - (Math.floor(blastoise.maxhp / 6) * 4));
	});

	it.skip(`should deal damage alongside Sea of Fire or G-Max Wildfire in the order those field effects were set`, () => {
		battle = common.gen(8).createBattle({ gameType: 'doubles' }, [[
			{ species: 'Coalossal', item: 'Eject Button', moves: ['rockthrow', 'sleeptalk'], gigantamax: true },
			{ species: 'Wynaut', moves: ['sleeptalk', 'grasspledge'] },
			{ species: 'Wynaut', moves: ['sleeptalk', 'firepledge'] },
		], [
			{ species: 'Blissey', moves: ['sleeptalk'] },
			{ species: 'Chansey', moves: ['sleeptalk'] },
		]]);

		// Set up Volcalith first, then Sea of Fire
		battle.makeChoices('move rockthrow 1 dynamax, move grasspledge -1', 'auto');
		battle.makeChoices('switch 3');
		battle.makeChoices('move firepledge 1, move grasspledge 1', 'auto');

		const log = battle.getDebugLog();
		const pledgeDamageIndex = log.lastIndexOf('|[from] Fire Pledge');
		const volcalithDamageIndex = log.lastIndexOf('|[from] G-Max Volcalith');
		assert(volcalithDamageIndex < pledgeDamageIndex, 'G-Max Volcalith should damage before Sea of Fire, because Volcalith was set up first.');
	});

	it(`should damage Pokemon in order of Speed`, () => {
		battle = common.gen(8).createBattle({ gameType: 'doubles' }, [[
			{ species: 'Coalossal', moves: ['sleeptalk', 'rockthrow'], gigantamax: true },
			{ species: 'Wynaut', moves: ['sleeptalk'] },
		], [
			{ species: 'Coalossal', moves: ['sleeptalk', 'rockthrow'], gigantamax: true },
			{ species: 'Mewtwo', moves: ['sleeptalk', 'trickroom'] },
		]]);

		battle.makeChoices('move rockthrow 1 dynamax, move sleeptalk', 'move rockthrow 1 dynamax, move sleeptalk');
		battle.makeChoices('auto', 'move sleeptalk, move trickroom');

		const log = battle.getDebugLog();
		const mewtwoDamagedIndex = log.indexOf('|-damage|p1b: Wynaut');
		const wynautDamagedIndex = log.indexOf('|-damage|p2b: Mewtwo');
		assert(wynautDamagedIndex < mewtwoDamagedIndex, 'Mewtwo should be damaged before Wynaut in normal circumstances.');

		const mewtwoDamagedTRIndex = log.lastIndexOf('|-damage|p1b: Wynaut');
		const wynautDamagedTRIndex = log.lastIndexOf('|-damage|p2b: Mewtwo');
		assert(mewtwoDamagedTRIndex < wynautDamagedTRIndex, 'Wynaut should be damaged before Mewtwo in Trick Room.');
	});

	it(`should deal damage before Black Sludge recovery/damage`, () => {
		battle = common.gen(8).createBattle({ gameType: 'doubles' }, [[
			{ species: 'Coalossal', moves: ['sleeptalk', 'rockthrow'], gigantamax: true },
			{ species: 'Wynaut', moves: ['sleeptalk'] },
		], [
			{ species: 'Toxicroak', item: 'blacksludge', moves: ['sleeptalk'] },
			{ species: 'Boldore', moves: ['sleeptalk'] },
		]]);

		battle.makeChoices('move rockthrow 2 dynamax, move sleeptalk', 'move sleeptalk, move sleeptalk');
		const toxicroak = battle.p2.active[0];
		assert.equal(toxicroak.hp, toxicroak.maxhp - Math.floor(toxicroak.maxhp / 6) + Math.floor(toxicroak.maxhp / 16));
	});

	it(`should deal damage before Grassy Terrain recovery`, () => {
		battle = common.gen(8).createBattle({ gameType: 'doubles' }, [[
			{ species: 'Coalossal', moves: ['sleeptalk', 'rockthrow'], gigantamax: true },
			{ species: 'Wynaut', moves: ['sleeptalk'] },
		], [
			{ species: 'Rillaboom', ability: 'grassysurge', moves: ['sleeptalk'] },
			{ species: 'Boldore', moves: ['sleeptalk'] },
		]]);

		battle.makeChoices('move rockthrow 2 dynamax, move sleeptalk', 'move sleeptalk, move sleeptalk');
		const rillaboom = battle.p2.active[0];
		assert.equal(rillaboom.hp, rillaboom.maxhp - Math.floor(rillaboom.maxhp / 6) + Math.floor(rillaboom.maxhp / 16));
	});
});