@pkmn/sim 0.5.11 → 0.5.14

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 (68) hide show
  1. package/README.md +5 -0
  2. package/build/config/formats.js +356 -288
  3. package/build/config/formats.js.map +1 -1
  4. package/build/data/abilities.js +9 -9
  5. package/build/data/abilities.js.map +1 -1
  6. package/build/data/aliases.js +2 -0
  7. package/build/data/aliases.js.map +1 -1
  8. package/build/data/conditions.js +8 -12
  9. package/build/data/conditions.js.map +1 -1
  10. package/build/data/formats-data.js +33 -32
  11. package/build/data/formats-data.js.map +1 -1
  12. package/build/data/items.js +1 -1
  13. package/build/data/items.js.map +1 -1
  14. package/build/data/mods/gen1/formats-data.js +38 -36
  15. package/build/data/mods/gen1/formats-data.js.map +1 -1
  16. package/build/data/mods/gen1/moves.js +2 -4
  17. package/build/data/mods/gen1/moves.js.map +1 -1
  18. package/build/data/mods/gen3/formats-data.js +1 -1
  19. package/build/data/mods/gen3/formats-data.js.map +1 -1
  20. package/build/data/mods/gen6/formats-data.js +3 -3
  21. package/build/data/mods/gen6/formats-data.js.map +1 -1
  22. package/build/data/moves.js +34 -19
  23. package/build/data/moves.js.map +1 -1
  24. package/build/data/pokedex.js +2 -2
  25. package/build/data/pokedex.js.map +1 -1
  26. package/build/data/rulesets.js +1 -1
  27. package/build/data/rulesets.js.map +1 -1
  28. package/build/data/text/moves.js +1 -0
  29. package/build/data/text/moves.js.map +1 -1
  30. package/build/sim/battle.js +13 -11
  31. package/build/sim/battle.js.map +1 -1
  32. package/build/sim/dex-conditions.js +11 -3
  33. package/build/sim/dex-conditions.js.map +1 -1
  34. package/build/sim/dex-data.js +1 -0
  35. package/build/sim/dex-data.js.map +1 -1
  36. package/build/sim/dex-formats.js +1 -0
  37. package/build/sim/dex-formats.js.map +1 -1
  38. package/build/sim/dex-items.js +1 -0
  39. package/build/sim/dex-items.js.map +1 -1
  40. package/build/sim/dex-moves.js +1 -0
  41. package/build/sim/dex-moves.js.map +1 -1
  42. package/build/sim/dex-species.js +1 -0
  43. package/build/sim/dex-species.js.map +1 -1
  44. package/build/sim/team-validator.js +1 -1
  45. package/build/sim/team-validator.js.map +1 -1
  46. package/config/formats.ts +343 -272
  47. package/data/abilities.ts +9 -9
  48. package/data/aliases.ts +2 -0
  49. package/data/conditions.ts +8 -10
  50. package/data/formats-data.ts +33 -32
  51. package/data/items.ts +1 -1
  52. package/data/mods/gen1/formats-data.ts +38 -36
  53. package/data/mods/gen1/moves.ts +2 -4
  54. package/data/mods/gen3/formats-data.ts +1 -1
  55. package/data/mods/gen6/formats-data.ts +3 -3
  56. package/data/moves.ts +33 -19
  57. package/data/pokedex.ts +2 -2
  58. package/data/rulesets.ts +1 -1
  59. package/data/text/moves.ts +2 -0
  60. package/package.json +2 -2
  61. package/sim/battle.ts +4 -1
  62. package/sim/dex-conditions.ts +10 -3
  63. package/sim/dex-data.ts +1 -0
  64. package/sim/dex-formats.ts +1 -0
  65. package/sim/dex-items.ts +1 -0
  66. package/sim/dex-moves.ts +1 -0
  67. package/sim/dex-species.ts +1 -0
  68. package/sim/team-validator.ts +1 -1
@@ -676,10 +676,10 @@ exports.Moves = {
676
676
  this.debug('Attract event failed');
677
677
  return false;
678
678
  }
679
- if (effect.id === 'cutecharm') {
679
+ if (effect.name === 'Cute Charm') {
680
680
  this.add('-start', pokemon, 'Attract', '[from] ability: Cute Charm', '[of] ' + source);
681
681
  }
682
- else if (effect.id === 'destinyknot') {
682
+ else if (effect.name === 'Destiny Knot') {
683
683
  this.add('-start', pokemon, 'Attract', '[from] item: Destiny Knot', '[of] ' + source);
684
684
  }
685
685
  else {
@@ -1023,6 +1023,13 @@ exports.Moves = {
1023
1023
  pp: 40,
1024
1024
  priority: 0,
1025
1025
  flags: {},
1026
+ onHit(target) {
1027
+ if (!this.canSwitch(target.side)) {
1028
+ this.attrLastMove('[still]');
1029
+ this.add('-fail', target);
1030
+ return this.NOT_FAIL;
1031
+ }
1032
+ },
1026
1033
  self: {
1027
1034
  onHit(source) {
1028
1035
  source.skipBeforeSwitchOutEventFlag = true;
@@ -4163,7 +4170,7 @@ exports.Moves = {
4163
4170
  },
4164
4171
  onFieldStart(field, source, effect) {
4165
4172
  if (effect?.effectType === 'Ability') {
4166
- this.add('-fieldstart', 'move: Electric Terrain', '[from] ability: ' + effect, '[of] ' + source);
4173
+ this.add('-fieldstart', 'move: Electric Terrain', '[from] ability: ' + effect.name, '[of] ' + source);
4167
4174
  }
4168
4175
  else {
4169
4176
  this.add('-fieldstart', 'move: Electric Terrain');
@@ -7295,7 +7302,7 @@ exports.Moves = {
7295
7302
  },
7296
7303
  onFieldStart(field, source, effect) {
7297
7304
  if (effect?.effectType === 'Ability') {
7298
- this.add('-fieldstart', 'move: Grassy Terrain', '[from] ability: ' + effect, '[of] ' + source);
7305
+ this.add('-fieldstart', 'move: Grassy Terrain', '[from] ability: ' + effect.name, '[of] ' + source);
7299
7306
  }
7300
7307
  else {
7301
7308
  this.add('-fieldstart', 'move: Grassy Terrain');
@@ -7904,10 +7911,12 @@ exports.Moves = {
7904
7911
  pp: 10,
7905
7912
  priority: 0,
7906
7913
  flags: { snatch: 1, heal: 1 },
7907
- onTryHit(pokemon, target, move) {
7908
- if (!this.canSwitch(pokemon.side)) {
7914
+ onHit(target, source, move) {
7915
+ if (!this.canSwitch(target.side)) {
7909
7916
  delete move.selfdestruct;
7910
- return false;
7917
+ this.attrLastMove('[still]');
7918
+ this.add('-fail', target);
7919
+ return this.NOT_FAIL;
7911
7920
  }
7912
7921
  },
7913
7922
  selfdestruct: "ifHit",
@@ -10013,10 +10022,12 @@ exports.Moves = {
10013
10022
  pp: 10,
10014
10023
  priority: 0,
10015
10024
  flags: { snatch: 1, heal: 1, dance: 1 },
10016
- onTryHit(pokemon, target, move) {
10017
- if (!this.canSwitch(pokemon.side)) {
10025
+ onHit(target, source, move) {
10026
+ if (!this.canSwitch(target.side)) {
10018
10027
  delete move.selfdestruct;
10019
- return false;
10028
+ this.attrLastMove('[still]');
10029
+ this.add('-fail', target);
10030
+ return this.NOT_FAIL;
10020
10031
  }
10021
10032
  },
10022
10033
  selfdestruct: "ifHit",
@@ -11613,7 +11624,7 @@ exports.Moves = {
11613
11624
  },
11614
11625
  onFieldStart(field, source, effect) {
11615
11626
  if (effect?.effectType === 'Ability') {
11616
- this.add('-fieldstart', 'move: Misty Terrain', '[from] ability: ' + effect, '[of] ' + source);
11627
+ this.add('-fieldstart', 'move: Misty Terrain', '[from] ability: ' + effect.name, '[of] ' + source);
11617
11628
  }
11618
11629
  else {
11619
11630
  this.add('-fieldstart', 'move: Misty Terrain');
@@ -13436,7 +13447,7 @@ exports.Moves = {
13436
13447
  },
13437
13448
  onFieldStart(field, source, effect) {
13438
13449
  if (effect?.effectType === 'Ability') {
13439
- this.add('-fieldstart', 'move: Psychic Terrain', '[from] ability: ' + effect, '[of] ' + source);
13450
+ this.add('-fieldstart', 'move: Psychic Terrain', '[from] ability: ' + effect.name, '[of] ' + source);
13440
13451
  }
13441
13452
  else {
13442
13453
  this.add('-fieldstart', 'move: Psychic Terrain');
@@ -14331,17 +14342,19 @@ exports.Moves = {
14331
14342
  num: 804,
14332
14343
  accuracy: 100,
14333
14344
  basePower: 70,
14345
+ basePowerCallback(source, target, move) {
14346
+ if (this.field.isTerrain('electricterrain') && target.isGrounded()) {
14347
+ if (!source.isAlly(target))
14348
+ this.hint(`${move.name}'s BP doubled on grounded target.`);
14349
+ return move.basePower * 2;
14350
+ }
14351
+ return move.basePower;
14352
+ },
14334
14353
  category: "Special",
14335
14354
  name: "Rising Voltage",
14336
14355
  pp: 20,
14337
14356
  priority: 0,
14338
14357
  flags: { protect: 1, mirror: 1 },
14339
- onBasePower(basePower, pokemon, target) {
14340
- if (this.field.isTerrain('electricterrain') && target.isGrounded()) {
14341
- this.debug('terrain buff');
14342
- return this.chainModify(2);
14343
- }
14344
- },
14345
14358
  secondary: null,
14346
14359
  target: "normal",
14347
14360
  type: "Electric",
@@ -18224,8 +18237,10 @@ exports.Moves = {
18224
18237
  pp: 20,
18225
18238
  priority: -6,
18226
18239
  flags: {},
18240
+ onTry(source) {
18241
+ return !!this.canSwitch(source.side);
18242
+ },
18227
18243
  selfSwitch: true,
18228
- onTryHit: true,
18229
18244
  secondary: null,
18230
18245
  target: "self",
18231
18246
  type: "Psychic",