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

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

let battle;

describe(`Memento`, () => {
	afterEach(() => {
		battle.destroy();
	});

	it(`should cause the user to faint even if the target has Clear Body`, () => {
		battle = common.createBattle([[
			{ species: 'whimsicott', moves: ['memento'] },
			{ species: 'landorus', moves: ['sleeptalk'] },
		], [
			{ species: 'wynaut', ability: 'clearbody', moves: ['sleeptalk'] },
		]]);
		battle.makeChoices();
		assert.equal(battle.requestState, 'switch');
	});

	it(`should not cause the user to faint if used into Substitute`, () => {
		battle = common.createBattle([[
			{ species: 'whimsicott', moves: ['memento'] },
			{ species: 'landorus', moves: ['sleeptalk'] },
		], [
			{ species: 'wynaut', ability: 'prankster', moves: ['substitute'] },
		]]);
		battle.makeChoices();
		assert.equal(battle.requestState, 'move');
	});

	it(`should cause the user to faint after stat drops from Mirror Armor`, () => {
		battle = common.createBattle([[
			{ species: 'whimsicott', moves: ['memento'] },
			{ species: 'landorus', moves: ['sleeptalk'] },
		], [
			{ species: 'corviknight', ability: 'mirrorarmor', moves: ['sleeptalk'] },
		]]);
		battle.makeChoices();
		const atkDrop = battle.log.includes('|-unboost|p1a: Whimsicott|atk|2');
		const spaDrop = battle.log.includes('|-unboost|p1a: Whimsicott|spa|2');
		assert(atkDrop && spaDrop, "Whimsicott's stats should have been lowered.");
		assert.equal(battle.requestState, 'switch');
	});

	it(`should set the Z-Memento healing flag even if the Memento itself was not successful`, () => {
		battle = common.createBattle([[
			{ species: 'landorus', moves: ['sleeptalk'] },
			{ species: 'whimsicott', item: 'darkiniumz', moves: ['memento'] },
		], [
			{ species: 'wynaut', ability: 'noguard', moves: ['circlethrow', 'substitute'] },
		]]);
		battle.makeChoices('auto', 'move substitute');
		battle.makeChoices();
		battle.makeChoices('move memento zmove', 'auto');
		const landorus = battle.p1.active[0];
		assert.fullHP(landorus);
	});
});