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

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

let battle;

describe('Chloroblast', () => {
	afterEach(() => {
		battle.destroy();
	});

	it('should deal recoil damage to the user equal to half its max HP, rounded up', () => {
		battle = common.createBattle([[
			{ species: "Electrode-Hisui", item: 'widelens', moves: ['chloroblast'] },
		], [
			{ species: "Blissey", moves: ['sleeptalk'] },
		]]);
		assert.hurtsBy(battle.p1.active[0], Math.round(battle.p1.active[0].maxhp / 2), () => battle.makeChoices());
	});

	it('should not deal recoil damage to the user if it misses or is blocked by Protect', () => {
		battle = common.createBattle([[
			{ species: "Electrode-Hisui", item: 'widelens', moves: ['chloroblast', 'protect'] },
		], [
			{ species: "Talonflame", ability: 'galewings', moves: ['fly', 'protect'] },
		]]);
		battle.makeChoices('move chloroblast', 'move fly');
		battle.makeChoices('move protect', 'auto');
		battle.makeChoices('move chloroblast', 'move protect');
		assert.fullHP(battle.p1.active[0]);
	});

	it('should have its recoil damage negated by Rock Head', () => {
		battle = common.createBattle([[
			{ species: "Electrode-Hisui", ability: 'rockhead', item: 'widelens', moves: ['chloroblast'] },
		], [
			{ species: "Blissey", moves: ['sleeptalk'] },
		]]);
		battle.makeChoices();
		assert.fullHP(battle.p1.active[0]);
	});

	it('should not have its base power boosted by Reckless', () => {
		battle = common.createBattle([[
			{ species: "Electrode-Hisui", ability: 'reckless', item: 'widelens', moves: ['chloroblast'] },
		], [
			{ species: "Blissey", ability: 'shellarmor', moves: ['sleeptalk'] },
		]]);
		battle.makeChoices();
		const damage = battle.p2.active[0].maxhp - battle.p2.active[0].hp;
		assert.bounded(damage, [103, 123]);
	});
});