@pkmn/sim 0.9.31 → 0.9.33

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 (97) hide show
  1. package/build/cjs/config/formats.js +170 -187
  2. package/build/cjs/config/formats.js.map +1 -1
  3. package/build/cjs/data/abilities.js +7 -0
  4. package/build/cjs/data/abilities.js.map +1 -1
  5. package/build/cjs/data/aliases.js +2 -2
  6. package/build/cjs/data/aliases.js.map +1 -1
  7. package/build/cjs/data/formats-data.js +73 -71
  8. package/build/cjs/data/formats-data.js.map +1 -1
  9. package/build/cjs/data/learnsets.js +0 -1
  10. package/build/cjs/data/learnsets.js.map +1 -1
  11. package/build/cjs/data/legality.js +32 -3
  12. package/build/cjs/data/legality.js.map +1 -1
  13. package/build/cjs/data/mods/gen1/conditions.js +61 -10
  14. package/build/cjs/data/mods/gen1/conditions.js.map +1 -1
  15. package/build/cjs/data/mods/gen1/formats-data.js +5 -5
  16. package/build/cjs/data/mods/gen1/formats-data.js.map +1 -1
  17. package/build/cjs/data/mods/gen1/moves.js +0 -56
  18. package/build/cjs/data/mods/gen1/moves.js.map +1 -1
  19. package/build/cjs/data/mods/gen1/scripts.js +22 -31
  20. package/build/cjs/data/mods/gen1/scripts.js.map +1 -1
  21. package/build/cjs/data/mods/gen6/moves.js +1 -0
  22. package/build/cjs/data/mods/gen6/moves.js.map +1 -1
  23. package/build/cjs/data/mods/gen7/moves.js +3 -0
  24. package/build/cjs/data/mods/gen7/moves.js.map +1 -1
  25. package/build/cjs/data/mods/gen8/abilities.js +0 -7
  26. package/build/cjs/data/mods/gen8/abilities.js.map +1 -1
  27. package/build/cjs/data/moves.js +26 -11
  28. package/build/cjs/data/moves.js.map +1 -1
  29. package/build/cjs/data/pokedex.js +1 -1
  30. package/build/cjs/data/rulesets.js +81 -63
  31. package/build/cjs/data/rulesets.js.map +1 -1
  32. package/build/cjs/data/text/moves.js +2 -3
  33. package/build/cjs/data/text/moves.js.map +1 -1
  34. package/build/cjs/sim/battle-actions.js +7 -4
  35. package/build/cjs/sim/battle-actions.js.map +1 -1
  36. package/build/cjs/sim/battle.js +40 -0
  37. package/build/cjs/sim/battle.js.map +1 -1
  38. package/build/cjs/sim/dex-conditions.d.ts +2 -2
  39. package/build/cjs/sim/dex-conditions.js +1 -1
  40. package/build/cjs/sim/dex-conditions.js.map +1 -1
  41. package/build/cjs/sim/exported-global-types.d.ts +1 -2
  42. package/build/cjs/sim/global-types.d.ts +1 -2
  43. package/build/cjs/sim/pokemon.d.ts +2 -0
  44. package/build/cjs/sim/pokemon.js +8 -7
  45. package/build/cjs/sim/pokemon.js.map +1 -1
  46. package/build/cjs/sim/side.d.ts +7 -2
  47. package/build/cjs/sim/side.js +55 -39
  48. package/build/cjs/sim/side.js.map +1 -1
  49. package/build/esm/config/formats.mjs +170 -187
  50. package/build/esm/config/formats.mjs.map +1 -1
  51. package/build/esm/data/abilities.mjs +7 -0
  52. package/build/esm/data/abilities.mjs.map +1 -1
  53. package/build/esm/data/aliases.mjs +2 -2
  54. package/build/esm/data/aliases.mjs.map +1 -1
  55. package/build/esm/data/formats-data.mjs +73 -71
  56. package/build/esm/data/formats-data.mjs.map +1 -1
  57. package/build/esm/data/learnsets.mjs +0 -1
  58. package/build/esm/data/learnsets.mjs.map +1 -1
  59. package/build/esm/data/legality.mjs +32 -3
  60. package/build/esm/data/legality.mjs.map +1 -1
  61. package/build/esm/data/mods/gen1/conditions.mjs +61 -10
  62. package/build/esm/data/mods/gen1/conditions.mjs.map +1 -1
  63. package/build/esm/data/mods/gen1/formats-data.mjs +5 -5
  64. package/build/esm/data/mods/gen1/formats-data.mjs.map +1 -1
  65. package/build/esm/data/mods/gen1/moves.mjs +0 -56
  66. package/build/esm/data/mods/gen1/moves.mjs.map +1 -1
  67. package/build/esm/data/mods/gen1/scripts.mjs +22 -31
  68. package/build/esm/data/mods/gen1/scripts.mjs.map +1 -1
  69. package/build/esm/data/mods/gen6/moves.mjs +1 -0
  70. package/build/esm/data/mods/gen6/moves.mjs.map +1 -1
  71. package/build/esm/data/mods/gen7/moves.mjs +3 -0
  72. package/build/esm/data/mods/gen7/moves.mjs.map +1 -1
  73. package/build/esm/data/mods/gen8/abilities.mjs +0 -7
  74. package/build/esm/data/mods/gen8/abilities.mjs.map +1 -1
  75. package/build/esm/data/moves.mjs +26 -11
  76. package/build/esm/data/moves.mjs.map +1 -1
  77. package/build/esm/data/pokedex.mjs +1 -1
  78. package/build/esm/data/rulesets.mjs +81 -63
  79. package/build/esm/data/rulesets.mjs.map +1 -1
  80. package/build/esm/data/text/moves.mjs +2 -3
  81. package/build/esm/data/text/moves.mjs.map +1 -1
  82. package/build/esm/sim/battle-actions.mjs +7 -4
  83. package/build/esm/sim/battle-actions.mjs.map +1 -1
  84. package/build/esm/sim/battle.mjs +40 -0
  85. package/build/esm/sim/battle.mjs.map +1 -1
  86. package/build/esm/sim/dex-conditions.d.mts +2 -2
  87. package/build/esm/sim/dex-conditions.mjs +1 -1
  88. package/build/esm/sim/dex-conditions.mjs.map +1 -1
  89. package/build/esm/sim/exported-global-types.d.mts +1 -2
  90. package/build/esm/sim/global-types.d.mts +1 -2
  91. package/build/esm/sim/pokemon.d.mts +2 -0
  92. package/build/esm/sim/pokemon.mjs +8 -7
  93. package/build/esm/sim/pokemon.mjs.map +1 -1
  94. package/build/esm/sim/side.d.mts +7 -2
  95. package/build/esm/sim/side.mjs +55 -39
  96. package/build/esm/sim/side.mjs.map +1 -1
  97. package/package.json +1 -1
@@ -18659,7 +18659,7 @@ export const Pokedex = {
18659
18659
  num: -14,
18660
18660
  name: "Kitsunoh",
18661
18661
  types: ["Ghost", "Steel"],
18662
- baseStats: { hp: 80, atk: 117, def: 85, spa: 55, spd: 80, spe: 128 },
18662
+ baseStats: { hp: 80, atk: 103, def: 85, spa: 55, spd: 80, spe: 120 },
18663
18663
  abilities: { 0: "Frisk", 1: "Limber", H: "Trace" },
18664
18664
  heightm: 1.1,
18665
18665
  weightkg: 51,
@@ -3,13 +3,21 @@
3
3
  export const Rulesets = {
4
4
  // Rulesets
5
5
  ///////////////////////////////////////////////////////////////////
6
+ standardag: {
7
+ effectType: 'ValidatorRule',
8
+ name: 'Standard AG',
9
+ desc: "The minimal ruleset for Anything Goes",
10
+ ruleset: [
11
+ 'Obtainable', 'Team Preview', 'HP Percentage Mod', 'Cancel Mod', 'Endless Battle Clause',
12
+ ],
13
+ },
6
14
  standard: {
7
15
  effectType: 'ValidatorRule',
8
16
  name: 'Standard',
9
17
  desc: "The standard ruleset for all offical Smogon singles tiers (Ubers, OU, etc.)",
10
18
  ruleset: [
11
- 'Obtainable', 'Team Preview', 'Sleep Clause Mod', 'Species Clause', 'Nickname Clause', 'OHKO Clause', 'Evasion Items Clause', 'Evasion Moves Clause', 'Endless Battle Clause', 'HP Percentage Mod', 'Cancel Mod',
12
- 'Min Source Gen = 9',
19
+ 'Standard AG',
20
+ 'Sleep Clause Mod', 'Species Clause', 'Nickname Clause', 'OHKO Clause', 'Evasion Items Clause', 'Evasion Moves Clause',
13
21
  ],
14
22
  },
15
23
  flatrules: {
@@ -56,8 +64,8 @@ export const Rulesets = {
56
64
  name: 'Standard Doubles',
57
65
  desc: "The standard ruleset for all official Smogon doubles tiers",
58
66
  ruleset: [
59
- 'Obtainable', 'Team Preview', 'Species Clause', 'Nickname Clause', 'OHKO Clause', 'Evasion Moves Clause', 'Gravity Sleep Clause', 'Endless Battle Clause', 'HP Percentage Mod', 'Cancel Mod',
60
- 'Min Source Gen = 9',
67
+ 'Standard AG',
68
+ 'Species Clause', 'Nickname Clause', 'OHKO Clause', 'Evasion Moves Clause', 'Gravity Sleep Clause',
61
69
  ],
62
70
  },
63
71
  standardnatdex: {
@@ -65,9 +73,17 @@ export const Rulesets = {
65
73
  name: 'Standard NatDex',
66
74
  desc: "The standard ruleset for all National Dex tiers",
67
75
  ruleset: [
68
- 'Obtainable', '+Unobtainable', '+Past', 'Sketch Post-Gen 7 Moves', 'Team Preview', 'Nickname Clause', 'HP Percentage Mod', 'Cancel Mod', 'Endless Battle Clause',
76
+ 'Standard AG', 'NatDex Mod',
77
+ 'Species Clause', 'Nickname Clause', 'OHKO Clause', 'Evasion Clause', 'Sleep Clause Mod',
78
+ ],
79
+ },
80
+ natdexmod: {
81
+ effectType: 'ValidatorRule',
82
+ name: 'NatDex Mod',
83
+ desc: "Mechanics for National Dex formats",
84
+ ruleset: [
85
+ '+Unobtainable', '+Past', 'Sketch Post-Gen 7 Moves',
69
86
  ],
70
- unbanlist: ['Bleakwind Storm', 'Lunar Blessing', 'Mystical Power', 'Sandsear Storm', 'Wildbolt Storm'],
71
87
  onValidateSet(set) {
72
88
  const species = this.dex.species.get(set.species);
73
89
  if (species.natDexTier === 'Illegal') {
@@ -99,19 +115,28 @@ export const Rulesets = {
99
115
  }
100
116
  }
101
117
  }
102
- // Items other than Z-Crystals and Pokémon-specific items should be illegal
118
+ // Any item that was legal in Gen 7 (Normal Gem for example) should be usable
103
119
  if (!set.item)
104
120
  return;
105
- const item = this.dex.items.get(set.item);
106
- if (!item.isNonstandard)
107
- return;
108
- if ((item.isNonstandard === 'Past' || requireObtainable && item.isNonstandard === 'Unobtainable') &&
109
- !item.zMove && !item.itemUser && !item.forcedForme && !item.isBerry) {
121
+ let item = this.dex.items.get(set.item);
122
+ let gen = this.dex.gen;
123
+ while (item.isNonstandard && gen >= 7) {
124
+ item = this.dex.forGen(gen).items.get(item.id);
125
+ gen--;
126
+ }
127
+ if (requireObtainable && item.isNonstandard) {
110
128
  if (this.ruleTable.has(`+item:${item.id}`))
111
129
  return;
112
130
  return [`${set.name}'s item ${item.name} does not exist in Gen ${this.dex.gen}.`];
113
131
  }
114
132
  },
133
+ onBegin() {
134
+ for (const pokemon of this.getAllPokemon()) {
135
+ if (pokemon.species.isMega || pokemon.species.isPrimal || pokemon.species.forme === "Ultra") {
136
+ pokemon.canTerastallize = null;
137
+ }
138
+ }
139
+ },
115
140
  },
116
141
  obtainable: {
117
142
  effectType: 'ValidatorRule',
@@ -385,7 +410,7 @@ export const Rulesets = {
385
410
  name: 'PotD',
386
411
  desc: "Forces the Pokemon of the Day onto every random team.",
387
412
  onBegin() {
388
- if (global.Config && global.Config.potd) {
413
+ if (global.Config?.potd) {
389
414
  this.add('rule', "Pokemon of the Day: " + this.dex.species.get(Config.potd).name);
390
415
  }
391
416
  },
@@ -394,6 +419,11 @@ export const Rulesets = {
394
419
  effectType: 'Rule',
395
420
  name: 'Team Preview',
396
421
  desc: "Allows each player to see the Pokémon on their opponent's team before they choose their lead Pokémon",
422
+ onBegin() {
423
+ if (this.ruleTable.has(`teratypepreview`)) {
424
+ this.add('rule', 'Tera Type Preview: Tera Types are shown at Team Preview');
425
+ }
426
+ },
397
427
  onTeamPreview() {
398
428
  this.add('clearpoke');
399
429
  for (const pokemon of this.getAllPokemon()) {
@@ -406,6 +436,16 @@ export const Rulesets = {
406
436
  this.add('poke', pokemon.side.id, details, '');
407
437
  }
408
438
  this.makeRequest('teampreview');
439
+ if (this.ruleTable.has(`teratypepreview`)) {
440
+ for (const side of this.sides) {
441
+ let buf = ``;
442
+ for (const pokemon of side.pokemon) {
443
+ buf += buf ? ` / ` : `raw|${side.name}'s Tera Types:<br />`;
444
+ buf += `<psicon pokemon="${pokemon.species.id}" /><psicon type="${pokemon.teraType}" />`;
445
+ }
446
+ this.add(`${buf}`);
447
+ }
448
+ }
409
449
  },
410
450
  },
411
451
  littlecup: {
@@ -651,7 +691,7 @@ export const Rulesets = {
651
691
  desc: "Bans all moves that induce sleep, such as Hypnosis",
652
692
  banlist: ['Yawn'],
653
693
  onBegin() {
654
- this.add('rule', 'Sleep Clause: Sleep-inducing moves are banned');
694
+ this.add('rule', 'Sleep Moves Clause: Sleep-inducing moves are banned');
655
695
  },
656
696
  onValidateSet(set) {
657
697
  const problems = [];
@@ -687,8 +727,9 @@ export const Rulesets = {
687
727
  // this variable is true if the move never misses (even with lowered acc) or has a chance to miss,
688
728
  // but false if the move's accuracy is 100% (yet can be lowered).
689
729
  const hasMissChanceOrNeverMisses = move.accuracy === true || move.accuracy < 100;
690
- if (move.status === 'slp' && hasMissChanceOrNeverMisses)
730
+ if (move.status === 'slp' && hasMissChanceOrNeverMisses) {
691
731
  hasSleepMove = true;
732
+ }
692
733
  }
693
734
  }
694
735
  if (hasOrbeetle && hasSleepMove) {
@@ -743,7 +784,7 @@ export const Rulesets = {
743
784
  let nonSpeedBoosted = false;
744
785
  for (const moveId of set.moves) {
745
786
  const move = this.dex.moves.get(moveId);
746
- if (move.id === 'flamecharge' || (move.boosts && move.boosts.spe && move.boosts.spe > 0)) {
787
+ if (move.id === 'flamecharge' || (move.boosts?.spe && move.boosts.spe > 0)) {
747
788
  speedBoosted = true;
748
789
  }
749
790
  const nonSpeedBoostedMoves = [
@@ -761,8 +802,8 @@ export const Rulesets = {
761
802
  if (!speedBoosted)
762
803
  speedBoosted = move.name;
763
804
  }
764
- if (((boosts.atk && boosts.atk > 0) || (boosts.def && boosts.def > 0) ||
765
- (boosts.spa && boosts.spa > 0) || (boosts.spd && boosts.spd > 0))) {
805
+ if ((boosts.atk && boosts.atk > 0) || (boosts.def && boosts.def > 0) ||
806
+ (boosts.spa && boosts.spa > 0) || (boosts.spd && boosts.spd > 0)) {
766
807
  if (!nonSpeedBoosted || move.name === speedBoosted)
767
808
  nonSpeedBoosted = move.name;
768
809
  }
@@ -857,9 +898,9 @@ export const Rulesets = {
857
898
  onValidateTeam(team) {
858
899
  const boostingEffects = [
859
900
  'absorbbulb', 'acidarmor', 'acupressure', 'agility', 'amnesia', 'ancientpower', 'angerpoint', 'apicotberry', 'autotomize',
860
- 'barrier', 'bellydrum', 'bulkup', 'calmmind', 'cellbattery', 'chargebeam', 'coil', 'cosmicpower', 'cottonguard', 'curse',
861
- 'defendorder', 'defiant', 'download', 'dragondance', 'fierydance', 'flamecharge', 'focusenergy', 'ganlonberry', 'growth',
862
- 'harden', 'honeclaws', 'howl', 'irondefense', 'justified', 'liechiberry', 'lightningrod', 'meditate', 'metalclaw',
901
+ 'barrier', 'bellydrum', 'bulkup', 'calmmind', 'cellbattery', 'charge', 'chargebeam', 'coil', 'cosmicpower', 'cottonguard', 'curse',
902
+ 'defensecurl', 'defendorder', 'defiant', 'download', 'dragondance', 'fierydance', 'flamecharge', 'focusenergy', 'ganlonberry', 'growth',
903
+ 'harden', 'honeclaws', 'howl', 'irondefense', 'justified', 'lansatberry', 'liechiberry', 'lightningrod', 'meditate', 'metalclaw',
863
904
  'meteormash', 'motordrive', 'moxie', 'nastyplot', 'ominouswind', 'petayaberry', 'quiverdance', 'rage', 'rattled',
864
905
  'rockpolish', 'salacberry', 'sapsipper', 'sharpen', 'shellsmash', 'shiftgear', 'silverwind', 'skullbash', 'speedboost',
865
906
  'starfberry', 'steadfast', 'steelwing', 'stockpile', 'stormdrain', 'swordsdance', 'tailglow', 'weakarmor', 'withdraw',
@@ -957,14 +998,15 @@ export const Rulesets = {
957
998
  this.add('rule', 'Sleep Clause Mod: Limit one foe put to sleep');
958
999
  },
959
1000
  onSetStatus(status, target, source) {
960
- if (source && source.isAlly(target)) {
1001
+ if (source?.isAlly(target)) {
961
1002
  return;
962
1003
  }
963
1004
  if (status.id === 'slp') {
964
1005
  for (const pokemon of target.side.pokemon) {
965
1006
  if (pokemon.hp && pokemon.status === 'slp') {
966
- if (!pokemon.statusState.source || !pokemon.statusState.source.isAlly(pokemon)) {
1007
+ if (!pokemon.statusState.source?.isAlly(pokemon)) {
967
1008
  this.add('-message', 'Sleep Clause Mod activated.');
1009
+ this.hint("Sleep Clause Mod prevents players from putting more than one of their opponent's Pokémon to sleep at a time");
968
1010
  return false;
969
1011
  }
970
1012
  }
@@ -980,7 +1022,7 @@ export const Rulesets = {
980
1022
  this.add('rule', 'Stadium Sleep Clause: Limit one foe put to sleep');
981
1023
  },
982
1024
  onSetStatus(status, target, source) {
983
- if (source && source.isAlly(target)) {
1025
+ if (source?.isAlly(target)) {
984
1026
  return;
985
1027
  }
986
1028
  if (status.id === 'slp') {
@@ -1028,7 +1070,7 @@ export const Rulesets = {
1028
1070
  this.add('rule', 'Freeze Clause Mod: Limit one foe frozen');
1029
1071
  },
1030
1072
  onSetStatus(status, target, source) {
1031
- if (source && source.isAlly(target)) {
1073
+ if (source?.isAlly(target)) {
1032
1074
  return;
1033
1075
  }
1034
1076
  if (status.id === 'frz') {
@@ -1087,8 +1129,13 @@ export const Rulesets = {
1087
1129
  onBegin() {
1088
1130
  this.add('rule', 'Mega Rayquaza Clause: You cannot mega evolve Rayquaza');
1089
1131
  for (const pokemon of this.getAllPokemon()) {
1090
- if (pokemon.species.id === 'rayquaza')
1132
+ if (pokemon.species.id === 'rayquaza') {
1091
1133
  pokemon.canMegaEvo = null;
1134
+ // ability to terastal was determined before the clause activated, causing incorrect behavior
1135
+ if (!this.ruleTable.has('terastalclause')) {
1136
+ pokemon.canTerastallize = this.actions.canTerastallize(pokemon);
1137
+ }
1138
+ }
1092
1139
  }
1093
1140
  },
1094
1141
  },
@@ -1192,7 +1239,7 @@ export const Rulesets = {
1192
1239
  'sketchpostgen7moves': {
1193
1240
  effectType: 'ValidatorRule',
1194
1241
  name: 'Sketch Post-Gen 7 Moves',
1195
- desc: "Allows Pokémon who learn Sketch to learn any Gen 8+ move (normally, Sketch is not usable in Gen 8+).",
1242
+ desc: "Allows Pokémon who learn Sketch to learn any Gen 8+ move (normally, Sketch is not usable in Gen 8 or Gen 9 Pre-DLC2).",
1196
1243
  // Implemented in sim/team-validator.ts
1197
1244
  },
1198
1245
  overflowstatmod: {
@@ -1237,35 +1284,6 @@ export const Rulesets = {
1237
1284
  this.showOpenTeamSheets();
1238
1285
  },
1239
1286
  },
1240
- eventmovesclause: {
1241
- effectType: 'ValidatorRule',
1242
- name: 'Event Moves Clause',
1243
- desc: "Bans moves only obtainable through events.",
1244
- onBegin() {
1245
- this.add('rule', 'Event Moves Clause: Event-only moves are banned');
1246
- },
1247
- onValidateSet(set) {
1248
- if (!set.moves)
1249
- return;
1250
- const moveSources = Object.fromEntries(set.moves.map((move) => [this.toID(move), []]));
1251
- const species = this.dex.species.get(set.species);
1252
- for (const { learnset } of this.dex.species.getFullLearnset(species.id)) {
1253
- for (const moveid in moveSources) {
1254
- moveSources[moveid].push(...(learnset[moveid] || []));
1255
- }
1256
- }
1257
- const problems = [];
1258
- for (const move of set.moves) {
1259
- const sources = moveSources[this.toID(move)];
1260
- if (sources?.length && sources.every((learned) => learned.includes('S'))) {
1261
- problems.push(`${species.name}'s move ${move} is obtainable only through events.`);
1262
- }
1263
- }
1264
- if (problems.length)
1265
- problems.push(`(Event-only moves are banned.)`);
1266
- return problems;
1267
- },
1268
- },
1269
1287
  pickedteamsize: {
1270
1288
  effectType: 'Rule',
1271
1289
  name: 'Picked Team Size',
@@ -1285,13 +1303,6 @@ export const Rulesets = {
1285
1303
  hasValue: 'positive-integer',
1286
1304
  // hardcoded in sim/team-validator
1287
1305
  },
1288
- evlimit: {
1289
- effectType: 'ValidatorRule',
1290
- name: "EV Limit",
1291
- desc: "Maximum total EVs on each pokemon.",
1292
- hasValue: 'integer',
1293
- // hardcoded in sim/team-validator
1294
- },
1295
1306
  maxteamsize: {
1296
1307
  effectType: 'ValidatorRule',
1297
1308
  name: "Max Team Size",
@@ -1299,6 +1310,13 @@ export const Rulesets = {
1299
1310
  hasValue: 'positive-integer',
1300
1311
  // hardcoded in sim/team-validator
1301
1312
  },
1313
+ evlimit: {
1314
+ effectType: 'ValidatorRule',
1315
+ name: "EV Limit",
1316
+ desc: "Maximum total EVs on each pokemon.",
1317
+ hasValue: 'integer',
1318
+ // hardcoded in sim/team-validator
1319
+ },
1302
1320
  maxmovecount: {
1303
1321
  effectType: 'ValidatorRule',
1304
1322
  name: "Max Move Count",