File size: 10,024 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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
'use strict';

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

let battle;

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

	it(`should protect the holder's ability against ability-changing moves`, () => {
		battle = common.createBattle([[
			{ species: 'wynaut', ability: 'shadowtag', item: 'abilityshield', moves: ['splash'] },
		], [
			{ species: 'weezinggalar', ability: 'levitate', moves: ['worryseed'] },
		]]);

		battle.makeChoices();
		assert(battle.log.some(line => line.includes('Ability Shield')), `Ability Shield should trigger a block message`);
		assert.equal(battle.p1.active[0].ability, 'shadowtag', `Holder should retain ability`);
	});

	it(`should protect the holder's ability against ability-changing abilities`, () => {
		battle = common.createBattle([[
			{ species: 'wynaut', ability: 'shadowtag', item: 'abilityshield', moves: ['tackle'] },
		], [
			{ species: 'weezinggalar', ability: 'mummy', moves: ['splash'] },
		]]);

		battle.makeChoices();
		assert(battle.log.some(line => line.includes('Ability Shield')), `Ability Shield should trigger a block message`);
		assert.equal(battle.p1.active[0].ability, 'shadowtag', `Holder should retain ability`);
	});

	it(`should only protect the holder`, () => {
		battle = common.createBattle([[
			{ species: 'wynaut', ability: 'mummy', item: 'abilityshield', moves: ['splash'] },
		], [
			{ species: 'weezinggalar', ability: 'levitate', moves: ['tackle'] },
		]]);

		battle.makeChoices();
		assert(battle.log.every(line => !line.includes('Ability Shield')), `Ability Shield should not trigger a block message`);
		assert.equal(battle.p2.active[0].ability, 'mummy', `Attacker should lose its ability`);
	});

	// https://www.smogon.com/forums/threads/scarlet-violet-battle-mechanics-research.3709545/post-9411146
	it(`should protect the holder's ability against Neutralizing Gas`, () => {
		battle = common.createBattle([[
			{ species: 'wynaut', ability: 'sturdy', item: 'abilityshield', moves: ['splash'], level: 5 },
		], [
			{ species: 'weezinggalar', ability: 'neutralizinggas', moves: ['shadowball'] },
		]]);

		assert(battle.log.some(line => line.includes('Neutralizing Gas')), `Neutralizing Gas should trigger`);
		assert(battle.log.some(line => line.includes('Ability Shield')), `Ability Shield should trigger a block message`);

		battle.makeChoices();
		assert.equal(battle.p1.active[0].hp, 1, `Holder should survive due to Sturdy`);
	});

	// https://www.smogon.com/forums/threads/scarlet-violet-battle-mechanics-research.3709545/post-9412194
	it(`should protect the holder's ability against Mold Breaker`, () => {
		battle = common.createBattle([[
			{ species: 'wynaut', ability: 'sturdy', item: 'abilityshield', moves: ['splash'], level: 5 },
			{ species: 'gastly', ability: 'levitate', item: 'abilityshield', moves: ['sleeptalk'] },
		], [
			{ species: 'weezinggalar', ability: 'moldbreaker', moves: ['shadowball', 'earthpower'] },
		]]);

		assert(battle.log.every(line => !line.includes('Ability Shield')), `Ability Shield should not trigger a block message`);

		battle.makeChoices();
		assert.equal(battle.p1.active[0].hp, 1, `Holder should survive from sturdy`);
		battle.makeChoices('switch gastly', 'move earthpower');
		assert.fullHP(battle.p1.active[0], `Holder should be ungrounded through levitate`);
	});

	// https://www.smogon.com/forums/threads/scarlet-violet-battle-mechanics-research.3709545/post-9403448
	it(`should protect the holder's ability against Gastro Acid`, () => {
		battle = common.createBattle([[
			{ species: 'wynaut', ability: 'sturdy', item: 'abilityshield', moves: ['splash'], level: 5 },
		], [
			{ species: 'weezinggalar', ability: 'levitate', moves: ['gastroacid', 'shadowball'] },
		]]);

		battle.makeChoices('move splash', 'move gastroacid');
		assert(battle.log.some(line => line.includes('Ability Shield')), `Ability Shield should trigger a block message`);

		battle.makeChoices('move splash', 'move shadowball');
		assert.equal(battle.p1.active[0].hp, 1, `Holder should survive due to Sturdy`);
	});

	// https://www.smogon.com/forums/threads/scarlet-violet-battle-mechanics-research.3709545/post-9412999
	it(`should not unsuppress the holder's ability if Ability Shield is acquired after Gastro Acid has been used`, () => {
		battle = common.createBattle([[
			{ species: 'wynaut', ability: 'sturdy', moves: ['splash'], level: 5 },
		], [
			{ species: 'weezinggalar', ability: 'levitate', item: 'abilityshield', moves: ['gastroacid', 'trick', 'shadowball'] },
		]]);

		battle.makeChoices('move splash', 'move gastroacid');
		battle.makeChoices('move splash', 'move trick');
		battle.makeChoices('move splash', 'move shadowball');
		assert(battle.p1.active[0].fainted, `Holder should not survive attack`);
	});

	// https://www.smogon.com/forums/threads/scarlet-violet-battle-mechanics-research.3709545/post-9412999
	it(`should unsuppress the holder's ability if Ability Shield is acquired after Neutralizing Gas has come into effect`, () => {
		battle = common.createBattle([[
			{ species: 'wynaut', ability: 'sturdy', moves: ['splash'], level: 5 },
		], [
			{ species: 'weezinggalar', ability: 'neutralizinggas', item: 'abilityshield', moves: ['trick', 'shadowball'] },
		]]);

		battle.makeChoices('move splash', 'move trick');
		battle.makeChoices('move splash', 'move shadowball');

		assert.equal(battle.p1.active[0].hp, 1, `Holder should survive due to Sturdy`);
	});

	// https://www.smogon.com/forums/threads/scarlet-violet-battle-mechanics-research.3709545/post-9412999
	it(`should not be suppressed by Klutz`, () => {
		battle = common.createBattle([[
			{ species: 'wynaut', ability: 'klutz', item: 'abilityshield', moves: ['tackle'] },
		], [
			{ species: 'weezinggalar', ability: 'mummy', moves: ['splash'] },
		]]);

		battle.makeChoices();
		assert(battle.log.some(line => line.includes('Ability Shield')), `Ability Shield should trigger a block message`);
		assert.equal(battle.p1.active[0].ability, 'klutz', `Holder should retain ability`);
	});

	it(`should protect the holder's ability against Skill Swap`, () => {
		battle = common.createBattle([[
			{ species: 'wynaut', ability: 'shadowtag', item: 'abilityshield', moves: ['splash'] },
		], [
			{ species: 'weezinggalar', ability: 'levitate', moves: ['skillswap'] },
		]]);

		battle.makeChoices();

		// assert logs?

		assert.equal(battle.p1.active[0].ability, 'shadowtag', `Holder should retain ability`);
		assert.equal(battle.p2.active[0].ability, 'levitate', `Opponent should retain ability`);
	});

	it(`should protect the holder's ability against Skill Swap, even if used by the holder`, () => {
		battle = common.createBattle([[
			{ species: 'wynaut', ability: 'shadowtag', item: 'abilityshield', moves: ['skillswap'] },
		], [
			{ species: 'weezinggalar', ability: 'levitate', moves: ['splash'] },
		]]);

		battle.makeChoices();

		// assert logs?

		assert.equal(battle.p1.active[0].ability, 'shadowtag', `Holder should retain ability`);
		assert.equal(battle.p2.active[0].ability, 'levitate', `Opponent should retain ability`);
	});

	// https://www.smogon.com/forums/threads/scarlet-violet-battle-mechanics-research.3709545/post-9413916
	it(`should not trigger holder's Intimidate if Ability Shield is acquired after entrance, while Neutralizing Gas is in effect`, () => {
		battle = common.createBattle([[
			{ species: 'wynaut', ability: 'intimidate', moves: ['splash'] },
		], [
			{ species: 'weezinggalar', ability: 'neutralizinggas', item: 'abilityshield', moves: ['trick'] },
		]]);

		battle.makeChoices();
		assert.statStage(battle.p2.active[0], 'atk', 0);
	});

	// https://www.smogon.com/forums/threads/scarlet-violet-battle-mechanics-research.3709545/post-9414273
	it(`should not trigger holder's Trace`, () => {
		battle = common.createBattle([[
			{ species: 'wynaut', ability: 'trace', item: 'abilityshield', moves: ['splash'] },
		], [
			{ species: 'weezinggalar', ability: 'levitate', moves: ['splash'] },
		]]);

		assert.notEqual(battle.p1.active[0].ability, 'levitate', `Holder should not trace ability`);
	});

	// https://www.smogon.com/forums/threads/scarlet-violet-battle-mechanics-research.3709545/post-9414273
	it(`should not trigger holder's Trace even after losing the item`, () => {
		battle = common.createBattle([[
			{ species: 'wynaut', ability: 'trace', item: 'abilityshield', moves: ['splash'] },
		], [
			{ species: 'weezinggalar', ability: 'levitate', moves: ['trick'] },
		]]);

		battle.makeChoices();
		assert.notEqual(battle.p1.active[0].ability, 'levitate', `Holder should not trace ability`);
	});

	// https://www.smogon.com/forums/threads/scarlet-violet-battle-mechanics-research.3709545/post-9635572
	it(`should not prevent Imposter from changing the holder's ability`, () => {
		battle = common.createBattle([[
			{ species: 'ditto', ability: 'imposter', item: 'abilityshield', moves: ['transform'] },
		], [
			{ species: 'scorbunny', ability: 'libero', moves: ['agility'] },
		]]);

		battle.makeChoices();
		assert.equal(battle.p1.active[0].ability, 'libero', `Ditto should copy Libero`);
	});

	it(`should not prevent forme changes from changing the holder's ability`, () => {
		battle = common.gen(9).createBattle([[
			{ species: 'ogerpon', ability: 'defiant', item: 'abilityshield', moves: ['sleeptalk'] },
		], [
			{ species: 'scorbunny', ability: 'libero', moves: ['agility'] },
		]]);

		battle.makeChoices('move sleeptalk terastallize', 'auto');
		assert.equal(battle.p1.active[0].ability, 'embodyaspectteal', `Ogerpon's ability should change to Embody Aspect`);
	});

	// TODO Add future tests for losing Ability Shield vs Neutralizing Gas/Mold Breaker/Gastro Acid?
	//
	//      No confirmed research yet for these, but presumably Neutralizing Gas & Mold
	//      Breaker would start to apply again, whereas Gastro Acid or other "triggered-once"
	//      moves/abilities triggered before the loss would not automatically trigger unless
	//      used again.
});