Spaces:
				
			
			
	
			
			
		Paused
		
	
	
	
			
			
	
	
	
	
		
		
		Paused
		
	File size: 3,422 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 | 'use strict';
const assert = require('./../../assert');
const common = require('./../../common');
let battle;
describe('Clear Body', () => {
	afterEach(() => {
		battle.destroy();
	});
	it('should negate stat drops from opposing effects', () => {
		battle = common.createBattle([[
			{ species: 'Tentacruel', ability: 'clearbody', moves: ['recover'] },
		], [
			{ species: 'Arbok', ability: 'intimidate', moves: ['acidspray', 'leer', 'scaryface', 'charm', 'confide'] },
		]]);
		const stats = ['spd', 'def', 'spe', 'atk', 'spa'];
		for (const [index, stat] of stats.entries()) {
			battle.makeChoices('move recover', 'move ' + (index + 1));
			assert.statStage(battle.p1.active[0], stat, 0);
		}
		for (const stat of stats) {
			assert.statStage(battle.p1.active[0], stat, 0);
		}
	});
	it('should not negate stat drops from the user\'s moves', () => {
		battle = common.createBattle([[
			{ species: 'Tentacruel', ability: 'clearbody', moves: ['superpower'] },
		], [
			{ species: 'Arbok', ability: 'unnerve', moves: ['coil'] },
		]]);
		battle.makeChoices('move Superpower', 'move Coil');
		assert.statStage(battle.p1.active[0], 'atk', -1);
		assert.statStage(battle.p1.active[0], 'def', -1);
	});
	it('should not negate stat boosts from opposing moves', () => {
		battle = common.createBattle([[
			{ species: 'Tentacruel', ability: 'clearbody', moves: ['shadowsneak'] },
		], [
			{ species: 'Arbok', ability: 'unnerve', moves: ['swagger'] },
		]]);
		battle.makeChoices('move Shadowsneak', 'move Swagger');
		assert.statStage(battle.p1.active[0], 'atk', 2);
	});
	it('should not negate absolute stat changes', () => {
		battle = common.createBattle([[
			{ species: 'Tentacruel', ability: 'clearbody', moves: ['coil'] },
		], [
			{ species: 'Arbok', ability: 'unnerve', moves: ['topsyturvy'] },
		]]);
		battle.makeChoices('move Coil', 'move Topsyturvy');
		assert.statStage(battle.p1.active[0], 'atk', -1);
		assert.statStage(battle.p1.active[0], 'def', -1);
		assert.statStage(battle.p1.active[0], 'accuracy', -1);
	});
	it('should be suppressed by Mold Breaker', () => {
		battle = common.createBattle([[
			{ species: 'Tentacruel', ability: 'clearbody', moves: ['recover'] },
		], [
			{ species: 'Haxorus', ability: 'moldbreaker', moves: ['growl'] },
		]]);
		battle.makeChoices('move Recover', 'move Growl');
		assert.statStage(battle.p1.active[0], 'atk', -1);
	});
	it('should be suppressed by Mold Breaker if it is forced out by a move', () => {
		battle = common.createBattle([[
			{ species: 'Metagross', ability: 'clearbody', moves: ['sleeptalk'] },
			{ species: 'Metagross', ability: 'clearbody', moves: ['sleeptalk'] },
		], [
			{ species: 'Haxorus', ability: 'moldbreaker', moves: ['roar', 'stickyweb'] },
		]]);
		battle.makeChoices('move Sleeptalk', 'move Stickyweb');
		battle.makeChoices('move Sleeptalk', 'move Roar');
		battle.makeChoices('switch 2', 'default');
		assert.statStage(battle.p1.active[0], 'spe', -1);
	});
	it('should not take priority over a stat being at -6', () => {
		battle = common.createBattle([[
			{ species: 'Dragapult', ability: 'clearbody', moves: ['bellydrum', 'sleeptalk'] },
		], [
			{ species: 'Malamar', moves: ['topsyturvy', 'growl'] },
		]]);
		battle.makeChoices();
		battle.makeChoices('move sleeptalk', 'move growl');
		assert.statStage(battle.p1.active[0], 'atk', -6);
		assert(battle.log.includes('|-unboost|p1a: Dragapult|atk|0'));
	});
});
 |