@pkmn/sim 0.5.2 → 0.5.6

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 (86) hide show
  1. package/build/config/formats.js +410 -311
  2. package/build/config/formats.js.map +1 -1
  3. package/build/data/aliases.js +4 -4
  4. package/build/data/aliases.js.map +1 -1
  5. package/build/data/formats-data.js +205 -93
  6. package/build/data/formats-data.js.map +1 -1
  7. package/build/data/learnsets.js +1 -1
  8. package/build/data/learnsets.js.map +1 -1
  9. package/build/data/mods/gen1/formats-data.js +190 -190
  10. package/build/data/mods/gen1/formats-data.js.map +1 -1
  11. package/build/data/mods/gen1/moves.js +1 -2
  12. package/build/data/mods/gen1/moves.js.map +1 -1
  13. package/build/data/mods/gen1/scripts.js +12 -0
  14. package/build/data/mods/gen1/scripts.js.map +1 -1
  15. package/build/data/mods/gen2/formats-data.js +1 -1
  16. package/build/data/mods/gen2/formats-data.js.map +1 -1
  17. package/build/data/mods/gen3/formats-data.js +13 -13
  18. package/build/data/mods/gen3/formats-data.js.map +1 -1
  19. package/build/data/mods/gen4/moves.js +22 -0
  20. package/build/data/mods/gen4/moves.js.map +1 -1
  21. package/build/data/mods/gen5/formats-data.js +173 -156
  22. package/build/data/mods/gen5/formats-data.js.map +1 -1
  23. package/build/data/mods/gen6/formats-data.js +4 -3
  24. package/build/data/mods/gen6/formats-data.js.map +1 -1
  25. package/build/data/mods/gen7/formats-data.js +3 -2
  26. package/build/data/mods/gen7/formats-data.js.map +1 -1
  27. package/build/data/mods/gen7/moves.js +154 -0
  28. package/build/data/mods/gen7/moves.js.map +1 -1
  29. package/build/data/moves.js +44 -19
  30. package/build/data/moves.js.map +1 -1
  31. package/build/data/pokedex.js +480 -11
  32. package/build/data/pokedex.js.map +1 -1
  33. package/build/data/rulesets.js +12 -1
  34. package/build/data/rulesets.js.map +1 -1
  35. package/build/data/tags.d.ts +1 -0
  36. package/build/data/tags.js +4 -3
  37. package/build/data/tags.js.map +1 -1
  38. package/build/data/text/abilities.js +4 -4
  39. package/build/data/text/abilities.js.map +1 -1
  40. package/build/data/text/moves.js +18 -18
  41. package/build/data/text/moves.js.map +1 -1
  42. package/build/sim/battle-actions.js +12 -4
  43. package/build/sim/battle-actions.js.map +1 -1
  44. package/build/sim/battle.js +23 -22
  45. package/build/sim/battle.js.map +1 -1
  46. package/build/sim/dex-formats.d.ts +1 -0
  47. package/build/sim/dex-formats.js +3 -2
  48. package/build/sim/dex-formats.js.map +1 -1
  49. package/build/sim/dex-species.js +5 -2
  50. package/build/sim/dex-species.js.map +1 -1
  51. package/build/sim/exported-global-types.d.ts +2 -0
  52. package/build/sim/global-types.d.ts +2 -0
  53. package/build/sim/index.d.ts +1 -0
  54. package/build/sim/index.js +3 -1
  55. package/build/sim/index.js.map +1 -1
  56. package/build/sim/team-validator.js +13 -0
  57. package/build/sim/team-validator.js.map +1 -1
  58. package/config/formats.ts +418 -316
  59. package/data/aliases.ts +4 -4
  60. package/data/formats-data.ts +205 -93
  61. package/data/learnsets.ts +1 -1
  62. package/data/mods/gen1/formats-data.ts +190 -190
  63. package/data/mods/gen1/moves.ts +1 -2
  64. package/data/mods/gen1/scripts.ts +11 -0
  65. package/data/mods/gen2/formats-data.ts +1 -1
  66. package/data/mods/gen3/formats-data.ts +13 -13
  67. package/data/mods/gen4/moves.ts +21 -0
  68. package/data/mods/gen5/formats-data.ts +173 -156
  69. package/data/mods/gen6/formats-data.ts +4 -3
  70. package/data/mods/gen7/formats-data.ts +3 -2
  71. package/data/mods/gen7/moves.ts +150 -0
  72. package/data/moves.ts +43 -19
  73. package/data/pokedex.ts +480 -11
  74. package/data/rulesets.ts +11 -1
  75. package/data/tags.ts +6 -3
  76. package/data/text/abilities.ts +4 -4
  77. package/data/text/moves.ts +18 -18
  78. package/package.json +2 -2
  79. package/sim/battle-actions.ts +12 -4
  80. package/sim/battle.ts +24 -23
  81. package/sim/dex-formats.ts +4 -1
  82. package/sim/dex-species.ts +5 -2
  83. package/sim/exported-global-types.ts +2 -0
  84. package/sim/global-types.ts +2 -0
  85. package/sim/index.ts +1 -0
  86. package/sim/team-validator.ts +12 -0
@@ -623,11 +623,12 @@ export const FormatsData: {[k: string]: ModdedSpeciesFormatsData} = {
623
623
  tier: "LC",
624
624
  },
625
625
  rhydon: {
626
+ randomBattleMoves: ["earthquake", "megahorn", "rockblast", "stealthrock", "stoneedge", "toxic"],
626
627
  tier: "NU",
627
628
  doublesTier: "NFE",
628
629
  },
629
630
  rhyperior: {
630
- randomBattleMoves: ["dragontail", "earthquake", "icepunch", "megahorn", "rockblast", "rockpolish", "stealthrock", "stoneedge"],
631
+ randomBattleMoves: ["dragontail", "earthquake", "icepunch", "megahorn", "rockblast", "rockpolish", "stoneedge"],
631
632
  randomDoubleBattleMoves: ["earthquake", "hammerarm", "megahorn", "protect", "rockslide", "stealthrock", "stoneedge"],
632
633
  tier: "RU",
633
634
  doublesTier: "DUU",
@@ -664,7 +665,7 @@ export const FormatsData: {[k: string]: ModdedSpeciesFormatsData} = {
664
665
  doublesTier: "(DUU)",
665
666
  },
666
667
  kangaskhanmega: {
667
- randomBattleMoves: ["crunch", "earthquake", "fakeout", "poweruppunch", "return", "suckerpunch", "seismictoss"],
668
+ randomBattleMoves: ["crunch", "earthquake", "fakeout", "poweruppunch", "return", "seismictoss", "suckerpunch"],
668
669
  randomDoubleBattleMoves: ["crunch", "doubleedge", "drainpunch", "earthquake", "fakeout", "poweruppunch", "protect", "return", "suckerpunch"],
669
670
  tier: "Uber",
670
671
  doublesTier: "DOU",
@@ -3860,7 +3861,7 @@ export const FormatsData: {[k: string]: ModdedSpeciesFormatsData} = {
3860
3861
  avalugg: {
3861
3862
  randomBattleMoves: ["avalanche", "earthquake", "rapidspin", "recover", "roar", "toxic"],
3862
3863
  randomDoubleBattleMoves: ["avalanche", "earthquake", "protect", "recover"],
3863
- tier: "(PU)",
3864
+ tier: "PU",
3864
3865
  doublesTier: "(DUU)",
3865
3866
  },
3866
3867
  noibat: {
@@ -717,11 +717,12 @@ export const FormatsData: {[k: string]: ModdedSpeciesFormatsData} = {
717
717
  tier: "LC",
718
718
  },
719
719
  rhydon: {
720
+ randomBattleMoves: ["earthquake", "megahorn", "rockblast", "stealthrock", "stoneedge", "toxic"],
720
721
  tier: "NU",
721
722
  doublesTier: "NFE",
722
723
  },
723
724
  rhyperior: {
724
- randomBattleMoves: ["dragontail", "earthquake", "icepunch", "megahorn", "rockblast", "rockpolish", "stealthrock", "stoneedge"],
725
+ randomBattleMoves: ["dragontail", "earthquake", "icepunch", "megahorn", "rockblast", "rockpolish", "stoneedge"],
725
726
  randomDoubleBattleMoves: ["earthquake", "icepunch", "megahorn", "protect", "rockslide", "stealthrock", "stoneedge"],
726
727
  tier: "RU",
727
728
  doublesTier: "(DUU)",
@@ -2300,7 +2301,7 @@ export const FormatsData: {[k: string]: ModdedSpeciesFormatsData} = {
2300
2301
  doublesTier: "DUber",
2301
2302
  },
2302
2303
  deoxys: {
2303
- randomBattleMoves: ["extremespeed", "icebeam", "firepunch", "knockoff", "psychoboost", "stealthrock", "superpower"],
2304
+ randomBattleMoves: ["extremespeed", "firepunch", "icebeam", "knockoff", "psychoboost", "stealthrock", "superpower"],
2304
2305
  randomDoubleBattleMoves: ["extremespeed", "firepunch", "icebeam", "knockoff", "protect", "psychoboost", "superpower"],
2305
2306
  tier: "Uber",
2306
2307
  doublesTier: "(DUU)",
@@ -240,6 +240,25 @@ export const Moves: {[k: string]: ModdedMoveData} = {
240
240
  inherit: true,
241
241
  isNonstandard: null,
242
242
  },
243
+ floralhealing: {
244
+ inherit: true,
245
+ onHit(target, source) {
246
+ let success = false;
247
+ if (this.field.isTerrain('grassyterrain')) {
248
+ success = !!this.heal(this.modify(target.baseMaxhp, 0.667));
249
+ } else {
250
+ success = !!this.heal(Math.ceil(target.baseMaxhp * 0.5));
251
+ }
252
+ if (success && !target.isAlly(source)) {
253
+ target.staleness = 'external';
254
+ }
255
+ if (!success) {
256
+ this.add('-fail', target, 'heal');
257
+ return null;
258
+ }
259
+ return success;
260
+ },
261
+ },
243
262
  foresight: {
244
263
  inherit: true,
245
264
  isNonstandard: null,
@@ -359,6 +378,25 @@ export const Moves: {[k: string]: ModdedMoveData} = {
359
378
  inherit: true,
360
379
  isNonstandard: null,
361
380
  },
381
+ healpulse: {
382
+ inherit: true,
383
+ onHit(target, source) {
384
+ let success = false;
385
+ if (source.hasAbility('megalauncher')) {
386
+ success = !!this.heal(this.modify(target.baseMaxhp, 0.75));
387
+ } else {
388
+ success = !!this.heal(Math.ceil(target.baseMaxhp * 0.5));
389
+ }
390
+ if (success && !target.isAlly(source)) {
391
+ target.staleness = 'external';
392
+ }
393
+ if (!success) {
394
+ this.add('-fail', target, 'heal');
395
+ return null;
396
+ }
397
+ return success;
398
+ },
399
+ },
362
400
  heartstamp: {
363
401
  inherit: true,
364
402
  isNonstandard: null,
@@ -608,6 +646,54 @@ export const Moves: {[k: string]: ModdedMoveData} = {
608
646
  inherit: true,
609
647
  isNonstandard: null,
610
648
  },
649
+ moonlight: {
650
+ inherit: true,
651
+ onHit(pokemon) {
652
+ let factor = 0.5;
653
+ switch (pokemon.effectiveWeather()) {
654
+ case 'sunnyday':
655
+ case 'desolateland':
656
+ factor = 0.667;
657
+ break;
658
+ case 'raindance':
659
+ case 'primordialsea':
660
+ case 'sandstorm':
661
+ case 'hail':
662
+ factor = 0.25;
663
+ break;
664
+ }
665
+ const success = !!this.heal(this.modify(pokemon.maxhp, factor));
666
+ if (!success) {
667
+ this.add('-fail', pokemon, 'heal');
668
+ return null;
669
+ }
670
+ return success;
671
+ },
672
+ },
673
+ morningsun: {
674
+ inherit: true,
675
+ onHit(pokemon) {
676
+ let factor = 0.5;
677
+ switch (pokemon.effectiveWeather()) {
678
+ case 'sunnyday':
679
+ case 'desolateland':
680
+ factor = 0.667;
681
+ break;
682
+ case 'raindance':
683
+ case 'primordialsea':
684
+ case 'sandstorm':
685
+ case 'hail':
686
+ factor = 0.25;
687
+ break;
688
+ }
689
+ const success = !!this.heal(this.modify(pokemon.maxhp, factor));
690
+ if (!success) {
691
+ this.add('-fail', pokemon, 'heal');
692
+ return null;
693
+ }
694
+ return success;
695
+ },
696
+ },
611
697
  mudbomb: {
612
698
  inherit: true,
613
699
  isNonstandard: null,
@@ -651,6 +737,14 @@ export const Moves: {[k: string]: ModdedMoveData} = {
651
737
  pollenpuff: {
652
738
  inherit: true,
653
739
  flags: {bullet: 1, protect: 1, mirror: 1},
740
+ onHit(target, source) {
741
+ if (source.isAlly(target)) {
742
+ if (!this.heal(Math.floor(target.baseMaxhp * 0.5))) {
743
+ this.add('-immune', target);
744
+ return null;
745
+ }
746
+ }
747
+ },
654
748
  },
655
749
  powder: {
656
750
  inherit: true,
@@ -722,6 +816,13 @@ export const Moves: {[k: string]: ModdedMoveData} = {
722
816
  inherit: true,
723
817
  isNonstandard: null,
724
818
  },
819
+ purify: {
820
+ inherit: true,
821
+ onHit(target, source) {
822
+ if (!target.cureStatus()) return false;
823
+ this.heal(Math.ceil(source.maxhp * 0.5), source);
824
+ },
825
+ },
725
826
  pursuit: {
726
827
  inherit: true,
727
828
  isNonstandard: null,
@@ -815,6 +916,21 @@ export const Moves: {[k: string]: ModdedMoveData} = {
815
916
  inherit: true,
816
917
  isNonstandard: null,
817
918
  },
919
+ shoreup: {
920
+ inherit: true,
921
+ onHit(pokemon) {
922
+ let factor = 0.5;
923
+ if (this.field.isWeather('sandstorm')) {
924
+ factor = 0.667;
925
+ }
926
+ const success = !!this.heal(this.modify(pokemon.maxhp, factor));
927
+ if (!success) {
928
+ this.add('-fail', pokemon, 'heal');
929
+ return null;
930
+ }
931
+ return success;
932
+ },
933
+ },
818
934
  signalbeam: {
819
935
  inherit: true,
820
936
  isNonstandard: null,
@@ -898,6 +1014,16 @@ export const Moves: {[k: string]: ModdedMoveData} = {
898
1014
  inherit: true,
899
1015
  isNonstandard: null,
900
1016
  },
1017
+ swallow: {
1018
+ inherit: true,
1019
+ onHit(pokemon) {
1020
+ const healAmount = [0.25, 0.5, 1];
1021
+ const success = !!this.heal(this.modify(pokemon.maxhp, healAmount[(pokemon.volatiles['stockpile'].layers - 1)]));
1022
+ if (!success) this.add('-fail', pokemon, 'heal');
1023
+ pokemon.removeVolatile('stockpile');
1024
+ return success || null;
1025
+ },
1026
+ },
901
1027
  switcheroo: {
902
1028
  inherit: true,
903
1029
  onHit(target, source, move) {
@@ -935,6 +1061,30 @@ export const Moves: {[k: string]: ModdedMoveData} = {
935
1061
  inherit: true,
936
1062
  isNonstandard: null,
937
1063
  },
1064
+ synthesis: {
1065
+ inherit: true,
1066
+ onHit(pokemon) {
1067
+ let factor = 0.5;
1068
+ switch (pokemon.effectiveWeather()) {
1069
+ case 'sunnyday':
1070
+ case 'desolateland':
1071
+ factor = 0.667;
1072
+ break;
1073
+ case 'raindance':
1074
+ case 'primordialsea':
1075
+ case 'sandstorm':
1076
+ case 'hail':
1077
+ factor = 0.25;
1078
+ break;
1079
+ }
1080
+ const success = !!this.heal(this.modify(pokemon.maxhp, factor));
1081
+ if (!success) {
1082
+ this.add('-fail', pokemon, 'heal');
1083
+ return null;
1084
+ }
1085
+ return success;
1086
+ },
1087
+ },
938
1088
  tailglow: {
939
1089
  inherit: true,
940
1090
  isNonstandard: null,
package/data/moves.ts CHANGED
@@ -4574,7 +4574,7 @@ export const Moves: {[moveid: string]: MoveData} = {
4574
4574
  pseudoWeather: 'fairylock',
4575
4575
  condition: {
4576
4576
  duration: 2,
4577
- onStart(target) {
4577
+ onFieldStart(target) {
4578
4578
  this.add('-fieldactivate', 'move: Fairy Lock');
4579
4579
  },
4580
4580
  onTrapPokemon(pokemon) {
@@ -5320,6 +5320,10 @@ export const Moves: {[moveid: string]: MoveData} = {
5320
5320
  if (success && !target.isAlly(source)) {
5321
5321
  target.staleness = 'external';
5322
5322
  }
5323
+ if (!success) {
5324
+ this.add('-fail', target, 'heal');
5325
+ return this.NOT_FAIL;
5326
+ }
5323
5327
  return success;
5324
5328
  },
5325
5329
  secondary: null,
@@ -7854,6 +7858,10 @@ export const Moves: {[moveid: string]: MoveData} = {
7854
7858
  if (success && !target.isAlly(source)) {
7855
7859
  target.staleness = 'external';
7856
7860
  }
7861
+ if (!success) {
7862
+ this.add('-fail', target, 'heal');
7863
+ return this.NOT_FAIL;
7864
+ }
7857
7865
  return success;
7858
7866
  },
7859
7867
  secondary: null,
@@ -9077,7 +9085,7 @@ export const Moves: {[moveid: string]: MoveData} = {
9077
9085
  pseudoWeather: 'iondeluge',
9078
9086
  condition: {
9079
9087
  duration: 1,
9080
- onStart(target, source, sourceEffect) {
9088
+ onFieldStart(target, source, sourceEffect) {
9081
9089
  this.add('-fieldactivate', 'move: Ion Deluge');
9082
9090
  this.hint(`Normal-type moves become Electric-type after using ${sourceEffect}.`);
9083
9091
  },
@@ -10420,16 +10428,10 @@ export const Moves: {[moveid: string]: MoveData} = {
10420
10428
  },
10421
10429
  onTryHitPriority: 3,
10422
10430
  onTryHit(target, source, move) {
10423
- if (['gmaxoneblow', 'gmaxrapidflow'].includes(move.id)) return;
10424
- /** moves blocked by Max Guard but not Protect */
10425
- const overrideBypassProtect = [
10426
- 'block', 'flowershield', 'gearup', 'magneticflux', 'phantomforce', 'psychup', 'shadowforce', 'teatime', 'transform', 'whirlwind',
10431
+ const bypassesMaxGuard = [
10432
+ 'acupressure', 'afteryou', 'allyswitch', 'aromatherapy', 'aromaticmist', 'coaching', 'confide', 'copycat', 'curse', 'decorate', 'doomdesire', 'feint', 'futuresight', 'gmaxoneblow', 'gmaxrapidflow', 'healbell', 'holdhands', 'howl', 'junglehealing', 'lifedew', 'meanlook', 'perishsong', 'playnice', 'powertrick', 'roar', 'roleplay', 'tearfullook',
10427
10433
  ];
10428
- const blockedByMaxGuard = (this.dex.moves.get(move.id).flags['protect'] ||
10429
- move.isZ || move.isMax || overrideBypassProtect.includes(move.id));
10430
- if (!blockedByMaxGuard) {
10431
- return;
10432
- }
10434
+ if (bypassesMaxGuard.includes(move.id)) return;
10433
10435
  if (move.smartTarget) {
10434
10436
  move.smartTarget = false;
10435
10437
  } else {
@@ -11520,7 +11522,12 @@ export const Moves: {[moveid: string]: MoveData} = {
11520
11522
  factor = 0.25;
11521
11523
  break;
11522
11524
  }
11523
- return !!this.heal(this.modify(pokemon.maxhp, factor));
11525
+ const success = !!this.heal(this.modify(pokemon.maxhp, factor));
11526
+ if (!success) {
11527
+ this.add('-fail', pokemon, 'heal');
11528
+ return this.NOT_FAIL;
11529
+ }
11530
+ return success;
11524
11531
  },
11525
11532
  secondary: null,
11526
11533
  target: "self",
@@ -11551,7 +11558,12 @@ export const Moves: {[moveid: string]: MoveData} = {
11551
11558
  factor = 0.25;
11552
11559
  break;
11553
11560
  }
11554
- return !!this.heal(this.modify(pokemon.maxhp, factor));
11561
+ const success = !!this.heal(this.modify(pokemon.maxhp, factor));
11562
+ if (!success) {
11563
+ this.add('-fail', pokemon, 'heal');
11564
+ return this.NOT_FAIL;
11565
+ }
11566
+ return success;
11555
11567
  },
11556
11568
  secondary: null,
11557
11569
  target: "self",
@@ -12740,6 +12752,7 @@ export const Moves: {[moveid: string]: MoveData} = {
12740
12752
  if (source.isAlly(target)) {
12741
12753
  if (!this.heal(Math.floor(target.baseMaxhp * 0.5))) {
12742
12754
  this.add('-immune', target);
12755
+ return this.NOT_FAIL;
12743
12756
  }
12744
12757
  }
12745
12758
  },
@@ -13402,7 +13415,7 @@ export const Moves: {[moveid: string]: MoveData} = {
13402
13415
  priority: 0,
13403
13416
  flags: {protect: 1, reflectable: 1, heal: 1},
13404
13417
  onHit(target, source) {
13405
- if (!target.cureStatus()) return false;
13418
+ if (!target.cureStatus()) return this.NOT_FAIL;
13406
13419
  this.heal(Math.ceil(source.maxhp * 0.5), source);
13407
13420
  },
13408
13421
  secondary: null,
@@ -15261,7 +15274,12 @@ export const Moves: {[moveid: string]: MoveData} = {
15261
15274
  if (this.field.isWeather('sandstorm')) {
15262
15275
  factor = 0.667;
15263
15276
  }
15264
- return !!this.heal(this.modify(pokemon.maxhp, factor));
15277
+ const success = !!this.heal(this.modify(pokemon.maxhp, factor));
15278
+ if (!success) {
15279
+ this.add('-fail', pokemon, 'heal');
15280
+ return this.NOT_FAIL;
15281
+ }
15282
+ return success;
15265
15283
  },
15266
15284
  secondary: null,
15267
15285
  target: "self",
@@ -15754,7 +15772,7 @@ export const Moves: {[moveid: string]: MoveData} = {
15754
15772
  const moveid = moveSlot.id;
15755
15773
  if (!moveid) continue;
15756
15774
  const move = this.dex.moves.get(moveid);
15757
- if (noSleepTalk.includes(moveid) || move.flags['charge'] || (move.isZ && move.basePower !== 1)) {
15775
+ if (noSleepTalk.includes(moveid) || move.flags['charge'] || (move.isZ && move.basePower !== 1) || move.isMax) {
15758
15776
  continue;
15759
15777
  }
15760
15778
  moves.push(moveid);
@@ -17391,9 +17409,10 @@ export const Moves: {[moveid: string]: MoveData} = {
17391
17409
  },
17392
17410
  onHit(pokemon) {
17393
17411
  const healAmount = [0.25, 0.5, 1];
17394
- const healedBy = this.heal(this.modify(pokemon.maxhp, healAmount[(pokemon.volatiles['stockpile'].layers - 1)]));
17412
+ const success = !!this.heal(this.modify(pokemon.maxhp, healAmount[(pokemon.volatiles['stockpile'].layers - 1)]));
17413
+ if (!success) this.add('-fail', pokemon, 'heal');
17395
17414
  pokemon.removeVolatile('stockpile');
17396
- return !!healedBy;
17415
+ return success || this.NOT_FAIL;
17397
17416
  },
17398
17417
  secondary: null,
17399
17418
  target: "self",
@@ -17556,7 +17575,12 @@ export const Moves: {[moveid: string]: MoveData} = {
17556
17575
  factor = 0.25;
17557
17576
  break;
17558
17577
  }
17559
- return !!this.heal(this.modify(pokemon.maxhp, factor));
17578
+ const success = !!this.heal(this.modify(pokemon.maxhp, factor));
17579
+ if (!success) {
17580
+ this.add('-fail', pokemon, 'heal');
17581
+ return this.NOT_FAIL;
17582
+ }
17583
+ return success;
17560
17584
  },
17561
17585
  secondary: null,
17562
17586
  target: "self",