@pkmn/mods 0.5.27 → 0.5.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/build/gen8bdsp/formats-data.js +3 -3
  2. package/build/gen8bdsp/formats-data.js.map +1 -1
  3. package/package.json +4 -4
  4. package/src/gen8bdsp/formats-data.ts +3 -3
  5. package/build/letsgo/formats-data.d.ts +0 -4
  6. package/build/letsgo/formats-data.js +0 -982
  7. package/build/letsgo/formats-data.js.map +0 -1
  8. package/build/letsgo/index.d.ts +0 -5
  9. package/build/letsgo/index.js +0 -14
  10. package/build/letsgo/index.js.map +0 -1
  11. package/build/letsgo/learnsets.d.ts +0 -4
  12. package/build/letsgo/learnsets.js +0 -5403
  13. package/build/letsgo/learnsets.js.map +0 -1
  14. package/build/letsgo/moves.d.ts +0 -4
  15. package/build/letsgo/moves.js +0 -94
  16. package/build/letsgo/moves.js.map +0 -1
  17. package/build/letsgo/pokedex.d.ts +0 -4
  18. package/build/letsgo/pokedex.js +0 -179
  19. package/build/letsgo/pokedex.js.map +0 -1
  20. package/build/letsgo/scripts.d.ts +0 -2
  21. package/build/letsgo/scripts.js +0 -60
  22. package/build/letsgo/scripts.js.map +0 -1
  23. package/build/stadium/conditions.d.ts +0 -4
  24. package/build/stadium/conditions.js +0 -137
  25. package/build/stadium/conditions.js.map +0 -1
  26. package/build/stadium/index.d.ts +0 -4
  27. package/build/stadium/index.js +0 -12
  28. package/build/stadium/index.js.map +0 -1
  29. package/build/stadium/moves.d.ts +0 -4
  30. package/build/stadium/moves.js +0 -246
  31. package/build/stadium/moves.js.map +0 -1
  32. package/build/stadium/rulesets.d.ts +0 -4
  33. package/build/stadium/rulesets.js +0 -11
  34. package/build/stadium/rulesets.js.map +0 -1
  35. package/build/stadium/scripts.d.ts +0 -5
  36. package/build/stadium/scripts.js +0 -619
  37. package/build/stadium/scripts.js.map +0 -1
  38. package/build/vgc17/formats-data.d.ts +0 -4
  39. package/build/vgc17/formats-data.js +0 -58
  40. package/build/vgc17/formats-data.js.map +0 -1
  41. package/build/vgc17/index.d.ts +0 -6
  42. package/build/vgc17/index.js +0 -16
  43. package/build/vgc17/index.js.map +0 -1
  44. package/build/vgc17/items.d.ts +0 -4
  45. package/build/vgc17/items.js +0 -30
  46. package/build/vgc17/items.js.map +0 -1
  47. package/build/vgc17/learnsets.d.ts +0 -4
  48. package/build/vgc17/learnsets.js +0 -60478
  49. package/build/vgc17/learnsets.js.map +0 -1
  50. package/build/vgc17/pokedex.d.ts +0 -4
  51. package/build/vgc17/pokedex.js +0 -50
  52. package/build/vgc17/pokedex.js.map +0 -1
  53. package/build/vgc17/rulesets.d.ts +0 -4
  54. package/build/vgc17/rulesets.js +0 -22
  55. package/build/vgc17/rulesets.js.map +0 -1
  56. package/build/vgc17/scripts.d.ts +0 -2
  57. package/build/vgc17/scripts.js +0 -7
  58. package/build/vgc17/scripts.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"moves.js","sourceRoot":"","sources":["../../src/stadium/moves.ts"],"names":[],"mappings":";;;AAEa,QAAA,KAAK,GAAkC;IACnD,IAAI,EAAE;QACL,OAAO,EAAE,IAAI;KAEb;IACD,KAAK,EAAE;QACN,OAAO,EAAE,IAAI;KAEb;IACD,OAAO,EAAE;QACR,OAAO,EAAE,IAAI;QACb,cAAc,EAAE,IAAI;QACpB,QAAQ,EAAE,KAAK;QACf,SAAS,EAAE,CAAC;QACZ,cAAc,CAAC,OAAO,EAAE,MAAM;YAC7B,kCAAkC;YAClC,uGAAuG;YACvG,6EAA6E;YAE7E,MAAM,gBAAgB,GAAG,MAAM,CAAC,IAAI,CAAC,QAAQ,IAAI,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,KAAK,MAAM,CAAC,IAAI,CAAC,gBAAgB;gBACxG,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;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gBAC9D,0BAA0B;gBAC1B,MAAM,cAAc,GAAG,MAAM,CAAC,iBAAiB,EAAE,CAAC;gBAClD,IAAI,CAAC,cAAc,EAAE;oBACpB,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,EAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAC,CAAC,CAAC;iBACxF;qBAAM;oBACN,cAAc,CAAC,IAAI,GAAG,IAAI,CAAC,EAAE,CAAC;oBAC9B,cAAc,CAAC,MAAM,GAAG,MAAM,CAAC;iBAC/B;gBACD,OAAO,CAAC,CAAC;YACV,CAAC;YACD,KAAK,CAAC,MAAM;gBACX,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,YAAY,CAAC,CAAC;YACxC,CAAC;SACD;QACD,SAAS,EAAE,IAAI;QACf,MAAM,EAAE,MAAM;QACd,IAAI,EAAE,QAAQ;KACd;IACD,QAAQ,EAAE;QACT,OAAO,EAAE,IAAI;QACb,cAAc,EAAE,EAAC,QAAQ,EAAE,IAAI,EAAC;KAChC;IACD,IAAI,EAAE;QACL,OAAO,EAAE,IAAI;KAEb;CACD,CAAC"}
@@ -1,4 +0,0 @@
1
- import type { ModdedFormatData } from '@pkmn/sim';
2
- export declare const Formats: {
3
- [k: string]: ModdedFormatData;
4
- };
@@ -1,11 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Formats = void 0;
4
- exports.Formats = {
5
- standard: {
6
- effectType: 'ValidatorRule',
7
- name: 'Standard',
8
- ruleset: ['Obtainable', 'Stadium Sleep Clause', 'Freeze Clause Mod', 'Species Clause', 'OHKO Clause', 'Evasion Moves Clause', 'Exact HP Mod', 'Cancel Mod'],
9
- },
10
- };
11
- //# sourceMappingURL=rulesets.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"rulesets.js","sourceRoot":"","sources":["../../src/stadium/rulesets.ts"],"names":[],"mappings":";;;AAEa,QAAA,OAAO,GAAoC;IACvD,QAAQ,EAAE;QACT,UAAU,EAAE,eAAe;QAC3B,IAAI,EAAE,UAAU;QAChB,OAAO,EAAE,CAAC,YAAY,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,aAAa,EAAE,sBAAsB,EAAE,cAAc,EAAE,YAAY,CAAC;KAC3J;CACD,CAAC"}
@@ -1,5 +0,0 @@
1
- import type { ModdedBattleScriptsData } from '@pkmn/sim';
2
- /**
3
- * Stadium mechanics inherit from gen 1 mechanics, but fixes some stuff.
4
- */
5
- export declare const Scripts: ModdedBattleScriptsData;
@@ -1,619 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Scripts = void 0;
4
- /**
5
- * Stadium mechanics inherit from gen 1 mechanics, but fixes some stuff.
6
- */
7
- exports.Scripts = {
8
- inherit: 'gen1',
9
- gen: 1,
10
- // BattlePokemon scripts. Stadium shares gen 1 code but it fixes some problems with it.
11
- pokemon: {
12
- inherit: true,
13
- // Gen 1 function to apply a stat modification that is only active until the stat is recalculated or mon switched.
14
- // Modified stats are declared in the Pokemon object in sim/pokemon.js in about line 681.
15
- modifyStat(statName, modifier) {
16
- if (!(statName in this.storedStats))
17
- throw new Error("Invalid `statName` passed to `modifyStat`");
18
- this.modifiedStats[statName] = this.battle.clampIntRange(Math.floor(this.modifiedStats[statName] * modifier), 1);
19
- },
20
- // This is run on Stadium after boosts and status changes.
21
- recalculateStats() {
22
- let statName;
23
- for (statName in this.storedStats) {
24
- let stat = this.species.baseStats[statName];
25
- stat = Math.floor(Math.floor(2 * stat + this.set.ivs[statName] + Math.floor(this.set.evs[statName] / 4)) * this.level / 100 + 5);
26
- this.baseStoredStats[statName] = this.storedStats[statName] = Math.floor(stat);
27
- this.modifiedStats[statName] = Math.floor(stat);
28
- // Re-apply drops, if necessary.
29
- if (this.status === 'par')
30
- this.modifyStat('spe', 0.25);
31
- if (this.status === 'brn')
32
- this.modifyStat('atk', 0.5);
33
- if (this.boosts[statName] !== 0) {
34
- if (this.boosts[statName] >= 0) {
35
- this.modifyStat(statName, [1, 1.5, 2, 2.5, 3, 3.5, 4][this.boosts[statName]]);
36
- }
37
- else {
38
- this.modifyStat(statName, [100, 66, 50, 40, 33, 28, 25][-this.boosts[statName]] / 100);
39
- }
40
- }
41
- }
42
- },
43
- // Stadium's fixed boosting function.
44
- boostBy(boost) {
45
- let changed = false;
46
- let i;
47
- for (i in boost) {
48
- let delta = boost[i];
49
- if (delta === undefined)
50
- continue;
51
- this.boosts[i] += delta;
52
- if (this.boosts[i] > 6) {
53
- delta -= this.boosts[i] - 6;
54
- this.boosts[i] = 6;
55
- }
56
- if (this.boosts[i] < -6) {
57
- delta -= this.boosts[i] - (-6);
58
- this.boosts[i] = -6;
59
- }
60
- if (delta)
61
- changed = true;
62
- }
63
- this.recalculateStats();
64
- return changed;
65
- },
66
- },
67
- // Battle scripts.
68
- runMove(moveOrMoveName, pokemon, targetLoc, sourceEffect) {
69
- const move = this.dex.getActiveMove(moveOrMoveName);
70
- const target = this.getTarget(pokemon, move, targetLoc);
71
- if (target === null || target === void 0 ? void 0 : target.subFainted)
72
- target.subFainted = null;
73
- this.setActiveMove(move, pokemon, target);
74
- if (pokemon.moveThisTurn || !this.runEvent('BeforeMove', pokemon, target, move)) {
75
- this.debug('' + pokemon.fullname + ' move interrupted; movedThisTurn: ' + pokemon.moveThisTurn);
76
- this.clearActiveMove(true);
77
- // This is only run for sleep
78
- this.runEvent('AfterMoveSelf', pokemon, target, move);
79
- return;
80
- }
81
- if (move.beforeMoveCallback) {
82
- if (move.beforeMoveCallback.call(this, pokemon, target, move)) {
83
- this.clearActiveMove(true);
84
- return;
85
- }
86
- }
87
- pokemon.lastDamage = 0;
88
- let lockedMove = this.runEvent('LockMove', pokemon);
89
- if (lockedMove === true)
90
- lockedMove = false;
91
- if (!lockedMove &&
92
- (!pokemon.volatiles['partialtrappinglock'] || pokemon.volatiles['partialtrappinglock'].locked !== target)) {
93
- pokemon.deductPP(move, null, target);
94
- pokemon.side.lastMove = move;
95
- pokemon.lastMove = move;
96
- }
97
- else {
98
- sourceEffect = move;
99
- }
100
- this.useMove(move, pokemon, target, sourceEffect);
101
- this.singleEvent('AfterMove', move, null, pokemon, target, move);
102
- // If target fainted
103
- if (target && target.hp <= 0) {
104
- // We remove screens
105
- target.side.removeSideCondition('reflect');
106
- target.side.removeSideCondition('lightscreen');
107
- }
108
- else {
109
- this.runEvent('AfterMoveSelf', pokemon, target, move);
110
- }
111
- if (pokemon.volatiles['mustrecharge'])
112
- this.add('-mustrecharge', pokemon);
113
- // For partial trapping moves, we are saving the target.
114
- if (move.volatileStatus === 'partiallytrapped' && target && target.hp > 0) {
115
- // It hit, so let's remove must recharge volatile. Yup, this happens on Stadium.
116
- target.removeVolatile('mustrecharge');
117
- // Let's check if the lock exists
118
- if (pokemon.volatiles['partialtrappinglock'] && target.volatiles['partiallytrapped']) {
119
- // Here the partialtrappinglock volatile has been already applied
120
- if (!pokemon.volatiles['partialtrappinglock'].locked) {
121
- // If it's the first hit, we save the target
122
- pokemon.volatiles['partialtrappinglock'].locked = target;
123
- }
124
- } // If we move to here, the move failed and there's no partial trapping lock
125
- }
126
- },
127
- tryMoveHit(target, pokemon, move) {
128
- let damage = 0;
129
- // First, check if the target is semi-invulnerable
130
- let hitResult = this.runEvent('Invulnerability', target, pokemon, move);
131
- if (hitResult === false) {
132
- if (!move.spreadHit)
133
- this.attrLastMove('[miss]');
134
- this.add('-miss', pokemon);
135
- return false;
136
- }
137
- // Then, check if the Pokemon is immune to this move.
138
- if ((!move.ignoreImmunity || (move.ignoreImmunity !== true && !move.ignoreImmunity[move.type])) &&
139
- !target.runImmunity(move.type, true)) {
140
- if (move.selfdestruct) {
141
- this.faint(pokemon, pokemon, move);
142
- }
143
- return false;
144
- }
145
- hitResult = this.singleEvent('TryImmunity', move, null, target, pokemon, move);
146
- if (hitResult === false) {
147
- this.add('-immune', target);
148
- return false;
149
- }
150
- // Now, let's calculate the accuracy.
151
- let accuracy = move.accuracy;
152
- // Partial trapping moves: true accuracy while it lasts
153
- if (pokemon.volatiles['partialtrappinglock']) {
154
- if (move.volatileStatus === 'partiallytrapped' && target === pokemon.volatiles['partialtrappinglock'].locked) {
155
- accuracy = true;
156
- }
157
- else if (pokemon.volatiles['partialtrappinglock'].locked !== target) {
158
- // The target switched, therefor, you fail using wrap.
159
- delete pokemon.volatiles['partialtrappinglock'];
160
- return false;
161
- }
162
- }
163
- // OHKO moves only have a chance to hit if the user is at least as fast as the target
164
- if (move.ohko) {
165
- if (target.speed > pokemon.speed) {
166
- this.add('-immune', target, '[ohko]');
167
- return false;
168
- }
169
- }
170
- // Calculate true accuracy for gen 1, which uses 0-255.
171
- // Stadium uses the Gen 2 boost table for accuracy and evasiveness, except for 1/3 instead of 0.33
172
- const boostTable = [1 / 3, 0.36, 0.43, 0.5, 0.66, 0.75, 1, 1.33, 1.66, 2, 2.33, 2.66, 3];
173
- if (accuracy !== true) {
174
- accuracy = Math.floor(accuracy * 255 / 100);
175
- // Check also for accuracy modifiers.
176
- if (!move.ignoreAccuracy) {
177
- accuracy = Math.floor(accuracy * boostTable[pokemon.boosts.accuracy + 6]);
178
- }
179
- if (!move.ignoreEvasion) {
180
- accuracy = Math.floor(accuracy * boostTable[-target.boosts.evasion + 6]);
181
- }
182
- accuracy = Math.min(accuracy, 255);
183
- }
184
- accuracy = this.runEvent('Accuracy', target, pokemon, move, accuracy);
185
- // Stadium fixes the 1/256 accuracy bug.
186
- if (accuracy !== true && !this.randomChance(accuracy + 1, 256)) {
187
- this.attrLastMove('[miss]');
188
- this.add('-miss', pokemon);
189
- damage = false;
190
- }
191
- // If damage is 0 and not false it means it didn't miss, let's calc.
192
- if (damage !== false) {
193
- pokemon.lastDamage = 0;
194
- if (move.multihit) {
195
- let hits = move.multihit;
196
- if (Array.isArray(hits)) {
197
- // Yes, it's hardcoded... meh
198
- if (hits[0] === 2 && hits[1] === 5) {
199
- hits = this.sample([2, 2, 3, 3, 4, 5]);
200
- }
201
- else {
202
- hits = this.random(hits[0], hits[1] + 1);
203
- }
204
- }
205
- hits = Math.floor(hits);
206
- // In gen 1, all the hits have the same damage for multihits move
207
- let moveDamage = 0;
208
- let i;
209
- for (i = 0; i < hits && target.hp && pokemon.hp; i++) {
210
- move.hit = i + 1;
211
- moveDamage = this.moveHit(target, pokemon, move);
212
- if (moveDamage === false)
213
- break;
214
- damage = (moveDamage || 0);
215
- // Move damage is fixed to be the first move's damage
216
- if (i === 0)
217
- move.damage = damage;
218
- if (target.subFainted) {
219
- i++;
220
- break;
221
- }
222
- }
223
- move.damage = null;
224
- if (i === 0)
225
- return 1;
226
- this.add('-hitcount', target, i);
227
- }
228
- else {
229
- damage = this.moveHit(target, pokemon, move);
230
- }
231
- }
232
- if (move.category !== 'Status')
233
- target.gotAttacked(move, damage, pokemon);
234
- if (move.selfdestruct) {
235
- this.faint(pokemon, pokemon, move);
236
- }
237
- // The move missed.
238
- if (damage === false) {
239
- // Delete the partial trap lock if necessary.
240
- delete pokemon.volatiles['partialtrappinglock'];
241
- return false;
242
- }
243
- if (move.ohko)
244
- this.add('-ohko');
245
- if (!move.negateSecondary) {
246
- this.singleEvent('AfterMoveSecondary', move, null, target, pokemon, move);
247
- this.runEvent('AfterMoveSecondary', target, pokemon, move);
248
- }
249
- return damage;
250
- },
251
- moveHit(target, pokemon, moveOrMoveName, moveData, isSecondary, isSelf) {
252
- let damage = 0;
253
- const move = this.dex.getActiveMove(moveOrMoveName);
254
- if (!isSecondary && !isSelf)
255
- this.setActiveMove(move, pokemon, target);
256
- let hitResult = true;
257
- if (!moveData)
258
- moveData = move;
259
- if (move.ignoreImmunity === undefined) {
260
- move.ignoreImmunity = (move.category === 'Status');
261
- }
262
- if (target) {
263
- hitResult = this.singleEvent('TryHit', moveData, {}, target, pokemon, move);
264
- // Partial trapping moves still apply their volatile to Pokémon behind a Sub
265
- const targetHadSub = !!target.volatiles['substitute'];
266
- if (targetHadSub && moveData.volatileStatus && moveData.volatileStatus === 'partiallytrapped') {
267
- target.addVolatile(moveData.volatileStatus, pokemon, move);
268
- }
269
- if (!hitResult) {
270
- if (hitResult === false)
271
- this.add('-fail', target);
272
- return false;
273
- }
274
- // Only run the hit events for the hit itself, not the secondary or self hits
275
- if (!isSelf && !isSecondary) {
276
- hitResult = this.runEvent('TryHit', target, pokemon, move);
277
- if (!hitResult) {
278
- if (hitResult === false)
279
- this.add('-fail', target);
280
- // Special Substitute hit flag
281
- if (hitResult !== 0) {
282
- return false;
283
- }
284
- }
285
- if (!this.runEvent('TryFieldHit', target, pokemon, move)) {
286
- return false;
287
- }
288
- }
289
- else if (isSecondary && !moveData.self) {
290
- hitResult = this.runEvent('TrySecondaryHit', target, pokemon, moveData);
291
- }
292
- if (hitResult === 0) {
293
- target = null;
294
- }
295
- else if (!hitResult) {
296
- if (hitResult === false)
297
- this.add('-fail', target);
298
- return false;
299
- }
300
- }
301
- if (target) {
302
- let didSomething = false;
303
- damage = this.getDamage(pokemon, target, moveData);
304
- if ((damage || damage === 0) && !target.fainted) {
305
- damage = this.damage(damage, target, pokemon, move);
306
- if (!(damage || damage === 0))
307
- return false;
308
- didSomething = true;
309
- }
310
- else if (damage === false && typeof hitResult === 'undefined') {
311
- this.add('-fail', target);
312
- }
313
- if (damage === false || damage === null) {
314
- return false;
315
- }
316
- if (moveData.boosts && !target.fainted) {
317
- this.boost(moveData.boosts, target, pokemon, move);
318
- }
319
- if (moveData.heal && !target.fainted) {
320
- const d = target.heal(Math.floor(target.maxhp * moveData.heal[0] / moveData.heal[1]));
321
- if (!d) {
322
- this.add('-fail', target);
323
- return false;
324
- }
325
- this.add('-heal', target, target.getHealth);
326
- didSomething = true;
327
- }
328
- if (moveData.status) {
329
- if (!target.status) {
330
- target.setStatus(moveData.status, pokemon, move);
331
- target.recalculateStats();
332
- }
333
- else if (!isSecondary) {
334
- if (target.status === moveData.status) {
335
- this.add('-fail', target, target.status);
336
- }
337
- else {
338
- this.add('-fail', target);
339
- }
340
- }
341
- didSomething = true;
342
- }
343
- if (moveData.forceStatus) {
344
- if (target.setStatus(moveData.forceStatus, pokemon, move)) {
345
- target.recalculateStats();
346
- didSomething = true;
347
- }
348
- }
349
- if (moveData.volatileStatus) {
350
- if (target.addVolatile(moveData.volatileStatus, pokemon, move)) {
351
- didSomething = true;
352
- }
353
- }
354
- if (moveData.sideCondition) {
355
- if (target.side.addSideCondition(moveData.sideCondition, pokemon, move)) {
356
- didSomething = true;
357
- }
358
- }
359
- if (moveData.pseudoWeather) {
360
- if (this.field.addPseudoWeather(moveData.pseudoWeather, pokemon, move)) {
361
- didSomething = true;
362
- }
363
- }
364
- // Hit events
365
- hitResult = this.singleEvent('Hit', moveData, {}, target, pokemon, move);
366
- if (!isSelf && !isSecondary) {
367
- this.runEvent('Hit', target, pokemon, move);
368
- }
369
- if (!hitResult && !didSomething) {
370
- if (hitResult === false)
371
- this.add('-fail', target);
372
- return false;
373
- }
374
- }
375
- // Here's where self effects are applied.
376
- if (moveData.self) {
377
- this.moveHit(pokemon, pokemon, move, moveData.self, isSecondary, true);
378
- }
379
- // Now we can save the partial trapping damage.
380
- if (pokemon.volatiles['partialtrappinglock']) {
381
- pokemon.volatiles['partialtrappinglock'].damage = pokemon.lastDamage;
382
- }
383
- // Apply move secondaries.
384
- if (moveData.secondaries) {
385
- for (const secondary of moveData.secondaries) {
386
- // We check here whether to negate the probable secondary status if it's para, burn, or freeze.
387
- // In the game, this is checked and if true, the random number generator is not called.
388
- // That means that a move that does not share the type of the target can status it.
389
- // If a move that was not fire-type would exist on Gen 1, it could burn a Pokémon.
390
- if (!(secondary.status && ['par', 'brn', 'frz'].includes(secondary.status) && target && target.hasType(move.type))) {
391
- const effectChance = Math.floor((secondary.chance || 100) * 255 / 100);
392
- if (typeof secondary.chance === 'undefined' || this.randomChance(effectChance + 1, 256)) {
393
- this.moveHit(target, pokemon, move, secondary, true, isSelf);
394
- }
395
- }
396
- }
397
- }
398
- if (move.selfSwitch && pokemon.hp) {
399
- pokemon.switchFlag = move.selfSwitch;
400
- }
401
- return damage;
402
- },
403
- getDamage(pokemon, target, move, suppressMessages) {
404
- // First of all, we get the move.
405
- if (typeof move === 'string') {
406
- move = this.dex.getActiveMove(move);
407
- }
408
- else if (typeof move === 'number') {
409
- move = {
410
- basePower: move,
411
- type: '???',
412
- category: 'Physical',
413
- willCrit: false,
414
- flags: {},
415
- };
416
- }
417
- // Let's see if the target is immune to the move.
418
- if (!move.ignoreImmunity || (move.ignoreImmunity !== true && !move.ignoreImmunity[move.type])) {
419
- if (!target.runImmunity(move.type, true)) {
420
- return false;
421
- }
422
- }
423
- // Is it an OHKO move?
424
- if (move.ohko) {
425
- return target.maxhp;
426
- }
427
- // We edit the damage through move's damage callback if necessary.
428
- if (move.damageCallback) {
429
- return move.damageCallback.call(this, pokemon, target);
430
- }
431
- // We take damage from damage=level moves (seismic toss).
432
- if (move.damage === 'level') {
433
- return pokemon.level;
434
- }
435
- // If there's a fix move damage, we return that.
436
- if (move.damage) {
437
- return move.damage;
438
- }
439
- // If it's the first hit on a Normal-type partially trap move, it hits Ghosts anyways but damage is 0.
440
- if (move.volatileStatus === 'partiallytrapped' && move.type === 'Normal' && target.hasType('Ghost')) {
441
- return 0;
442
- }
443
- // Let's check if we are in middle of a partial trap sequence to return the previous damage.
444
- if (pokemon.volatiles['partialtrappinglock'] && (target === pokemon.volatiles['partialtrappinglock'].locked)) {
445
- return pokemon.volatiles['partialtrappinglock'].damage;
446
- }
447
- // We check the category and typing to calculate later on the damage.
448
- if (!move.category)
449
- move.category = 'Physical';
450
- if (!move.defensiveCategory)
451
- move.defensiveCategory = move.category;
452
- // '???' is typeless damage: used for Struggle and Confusion etc
453
- if (!move.type)
454
- move.type = '???';
455
- const type = move.type;
456
- // We get the base power and apply basePowerCallback if necessary.
457
- let basePower = move.basePower;
458
- if (move.basePowerCallback) {
459
- basePower = move.basePowerCallback.call(this, pokemon, target, move);
460
- }
461
- if (!basePower) {
462
- return basePower === 0 ? undefined : basePower;
463
- }
464
- basePower = this.clampIntRange(basePower, 1);
465
- // Checking for the move's Critical Hit possibility. We check if it's a 100% crit move, otherwise we calculate the chance.
466
- let isCrit = move.willCrit || false;
467
- if (!isCrit) {
468
- // In Stadium, the critical chance is based on speed.
469
- // First, we get the base speed and store it. Then we add 76. This is our current crit chance.
470
- let critChance = pokemon.species.baseStats['spe'] + 76;
471
- // Now we right logical shift it two places, essentially dividing by 4 and flooring it.
472
- critChance = critChance >> 2;
473
- // Now we check for focus energy volatile.
474
- if (pokemon.volatiles['focusenergy']) {
475
- // If it exists, crit chance is multiplied by 4 and floored with a logical left shift.
476
- critChance = critChance << 2;
477
- // Then we add 160.
478
- critChance += 160;
479
- }
480
- else {
481
- // If it is not active, we left shift it by 1.
482
- critChance = critChance << 1;
483
- }
484
- // Now we check for the move's critical hit ratio.
485
- if (move.critRatio === 2) {
486
- // High crit ratio, we multiply the result so far by 4.
487
- critChance = critChance << 2;
488
- }
489
- else if (move.critRatio === 1) {
490
- // Normal hit ratio, we divide the crit chance by 2 and floor the result again.
491
- critChance = critChance >> 1;
492
- }
493
- // Now we make sure it's a number between 1 and 255.
494
- critChance = this.clampIntRange(critChance, 1, 255);
495
- // Last, we check deppending on ratio if the move critical hits or not.
496
- // We compare our critical hit chance against a random number between 0 and 255.
497
- // If the random number is lower, we get a critical hit. This means there is always a 1/255 chance of not hitting critically.
498
- if (critChance > 0) {
499
- isCrit = this.randomChance(critChance, 256);
500
- }
501
- }
502
- // There is a critical hit.
503
- if (isCrit && this.runEvent('CriticalHit', target, null, move)) {
504
- target.getMoveHitData(move).crit = true;
505
- }
506
- // Happens after crit calculation.
507
- if (basePower) {
508
- basePower = this.runEvent('BasePower', pokemon, target, move, basePower);
509
- if (basePower && move.basePowerModifier) {
510
- basePower *= move.basePowerModifier;
511
- }
512
- }
513
- if (!basePower)
514
- return 0;
515
- basePower = this.clampIntRange(basePower, 1);
516
- // We now check attacker's and defender's stats.
517
- let level = pokemon.level;
518
- let attacker = pokemon;
519
- const defender = target;
520
- if (move.useTargetOffensive)
521
- attacker = target;
522
- let atkType = (move.category === 'Physical') ? 'atk' : 'spa';
523
- const defType = (move.defensiveCategory === 'Physical') ? 'def' : 'spd';
524
- if (move.useSourceDefensiveAsOffensive)
525
- atkType = defType;
526
- let attack = attacker.getStat(atkType);
527
- let defense = defender.getStat(defType);
528
- // In gen 1, screen effect is applied here.
529
- if ((defType === 'def' && defender.volatiles['reflect']) || (defType === 'spd' && defender.volatiles['lightscreen'])) {
530
- this.debug('Screen doubling (Sp)Def');
531
- defense *= 2;
532
- defense = this.clampIntRange(defense, 1, 1998);
533
- }
534
- // In the event of a critical hit, the offense and defense changes are ignored.
535
- // This includes both boosts and screens.
536
- // Also, level is doubled in damage calculation.
537
- if (isCrit) {
538
- move.ignoreOffensive = true;
539
- move.ignoreDefensive = true;
540
- level *= 2;
541
- if (!suppressMessages)
542
- this.add('-crit', target);
543
- }
544
- if (move.ignoreOffensive) {
545
- this.debug('Negating (sp)atk boost/penalty.');
546
- attack = attacker.getStat(atkType, true);
547
- }
548
- if (move.ignoreDefensive) {
549
- this.debug('Negating (sp)def boost/penalty.');
550
- defense = target.getStat(defType, true);
551
- }
552
- // When either attack or defense are higher than 256, they are both divided by 4 and moded by 256.
553
- // This is what cuases the roll over bugs.
554
- if (attack >= 256 || defense >= 256) {
555
- attack = this.clampIntRange(Math.floor(attack / 4) % 256, 1);
556
- // Defense isn't checked on the cartridge, but we don't want those / 0 bugs on the sim.
557
- defense = this.clampIntRange(Math.floor(defense / 4) % 256, 1);
558
- }
559
- // Self destruct moves halve defense at this point.
560
- if (move.selfdestruct && defType === 'def') {
561
- defense = this.clampIntRange(Math.floor(defense / 2), 1);
562
- }
563
- // Let's go with the calculation now that we have what we need.
564
- // We do it step by step just like the game does.
565
- let damage = level * 2;
566
- damage = Math.floor(damage / 5);
567
- damage += 2;
568
- damage *= basePower;
569
- damage *= attack;
570
- damage = Math.floor(damage / defense);
571
- damage = this.clampIntRange(Math.floor(damage / 50), 1, 997);
572
- damage += 2;
573
- // STAB damage bonus, the "???" type never gets STAB
574
- if (type !== '???' && pokemon.hasType(type)) {
575
- damage += Math.floor(damage / 2);
576
- }
577
- // Type effectiveness.
578
- // The order here is not correct, must change to check the move versus each type.
579
- const totalTypeMod = this.dex.getEffectiveness(type, target);
580
- // Super effective attack
581
- if (totalTypeMod > 0) {
582
- if (!suppressMessages)
583
- this.add('-supereffective', target);
584
- damage *= 20;
585
- damage = Math.floor(damage / 10);
586
- if (totalTypeMod >= 2) {
587
- damage *= 20;
588
- damage = Math.floor(damage / 10);
589
- }
590
- }
591
- if (totalTypeMod < 0) {
592
- if (!suppressMessages)
593
- this.add('-resisted', target);
594
- damage *= 5;
595
- damage = Math.floor(damage / 10);
596
- if (totalTypeMod <= -2) {
597
- damage *= 5;
598
- damage = Math.floor(damage / 10);
599
- }
600
- }
601
- // If damage becomes 0, the move is made to miss.
602
- // This occurs when damage was either 2 or 3 prior to applying STAB/Type matchup, and target is 4x resistant to the move.
603
- if (damage === 0)
604
- return damage;
605
- // Apply random factor is damage is greater than 1
606
- if (damage > 1) {
607
- damage *= this.random(217, 256);
608
- damage = Math.floor(damage / 255);
609
- if (damage > target.hp && !target.volatiles['substitute'])
610
- damage = target.hp;
611
- if (target.volatiles['substitute'] && damage > target.volatiles['substitute'].hp) {
612
- damage = target.volatiles['substitute'].hp;
613
- }
614
- }
615
- // We are done, this is the final damage.
616
- return Math.floor(damage);
617
- },
618
- };
619
- //# sourceMappingURL=scripts.js.map