@pkmn/sim 0.4.21 → 0.4.25

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 (70) hide show
  1. package/build/config/formats.js +198 -136
  2. package/build/config/formats.js.map +1 -1
  3. package/build/data/aliases.js +5 -3
  4. package/build/data/aliases.js.map +1 -1
  5. package/build/data/conditions.js +5 -1
  6. package/build/data/conditions.js.map +1 -1
  7. package/build/data/formats-data.js +16 -16
  8. package/build/data/formats-data.js.map +1 -1
  9. package/build/data/mods/gen1/scripts.js +17 -20
  10. package/build/data/mods/gen1/scripts.js.map +1 -1
  11. package/build/data/mods/gen2/scripts.js +15 -21
  12. package/build/data/mods/gen2/scripts.js.map +1 -1
  13. package/build/data/mods/gen4/conditions.js +6 -0
  14. package/build/data/mods/gen4/conditions.js.map +1 -1
  15. package/build/data/mods/gen6/conditions.js +4 -1
  16. package/build/data/mods/gen6/conditions.js.map +1 -1
  17. package/build/data/mods/gen6/pokedex.js +17 -17
  18. package/build/data/mods/gen6/pokedex.js.map +1 -1
  19. package/build/data/mods/gen7/formats-data.js +2 -2
  20. package/build/data/mods/gen7/formats-data.js.map +1 -1
  21. package/build/data/moves.js +22 -9
  22. package/build/data/moves.js.map +1 -1
  23. package/build/data/rulesets.js +3 -1
  24. package/build/data/rulesets.js.map +1 -1
  25. package/build/lib/streams.d.ts +1 -199
  26. package/build/lib/streams.js +11 -772
  27. package/build/lib/streams.js.map +1 -1
  28. package/build/sim/battle-actions.d.ts +1 -1
  29. package/build/sim/battle-actions.js +19 -43
  30. package/build/sim/battle-actions.js.map +1 -1
  31. package/build/sim/battle.d.ts +1 -0
  32. package/build/sim/battle.js +5 -0
  33. package/build/sim/battle.js.map +1 -1
  34. package/build/sim/dex-moves.d.ts +31 -11
  35. package/build/sim/dex-moves.js +4 -3
  36. package/build/sim/dex-moves.js.map +1 -1
  37. package/build/sim/dex-species.js +11 -1
  38. package/build/sim/dex-species.js.map +1 -1
  39. package/build/sim/exported-global-types.d.ts +1 -0
  40. package/build/sim/global-types.d.ts +1 -0
  41. package/build/sim/side.js +2 -2
  42. package/build/sim/side.js.map +1 -1
  43. package/build/sim/team-validator.js +1 -1
  44. package/build/sim/team-validator.js.map +1 -1
  45. package/build/sim/tools/runner.d.ts +1 -6
  46. package/build/sim/tools/runner.js +6 -6
  47. package/build/sim/tools/runner.js.map +1 -1
  48. package/config/formats.ts +210 -141
  49. package/data/aliases.ts +5 -3
  50. package/data/conditions.ts +5 -1
  51. package/data/formats-data.ts +16 -16
  52. package/data/mods/gen1/scripts.ts +22 -18
  53. package/data/mods/gen2/scripts.ts +19 -18
  54. package/data/mods/gen4/conditions.ts +6 -0
  55. package/data/mods/gen6/conditions.ts +4 -1
  56. package/data/mods/gen6/pokedex.ts +17 -17
  57. package/data/mods/gen7/formats-data.ts +2 -2
  58. package/data/moves.ts +19 -9
  59. package/data/rulesets.ts +3 -1
  60. package/lib/streams.ts +1 -874
  61. package/package.json +3 -2
  62. package/sim/battle-actions.ts +20 -41
  63. package/sim/battle.ts +6 -0
  64. package/sim/dex-moves.ts +35 -13
  65. package/sim/dex-species.ts +10 -1
  66. package/sim/exported-global-types.ts +1 -0
  67. package/sim/global-types.ts +1 -0
  68. package/sim/side.ts +2 -2
  69. package/sim/team-validator.ts +1 -1
  70. package/sim/tools/runner.ts +2 -0
@@ -1420,7 +1420,7 @@ exports.Moves = {
1420
1420
  pp: 10,
1421
1421
  priority: 0,
1422
1422
  flags: { contact: 1, protect: 1, mirror: 1 },
1423
- useSourceDefensiveAsOffensive: true,
1423
+ overrideOffensiveStat: 'def',
1424
1424
  secondary: null,
1425
1425
  target: "normal",
1426
1426
  type: "Fighting",
@@ -5703,7 +5703,7 @@ exports.Moves = {
5703
5703
  pp: 15,
5704
5704
  priority: 0,
5705
5705
  flags: { contact: 1, protect: 1, mirror: 1 },
5706
- useTargetOffensive: true,
5706
+ overrideOffensivePokemon: 'target',
5707
5707
  secondary: null,
5708
5708
  target: "normal",
5709
5709
  type: "Dark",
@@ -6598,10 +6598,10 @@ exports.Moves = {
6598
6598
  flags: {},
6599
6599
  isMax: "Melmetal",
6600
6600
  self: {
6601
- onHit(source) {
6601
+ onHit(source, target, effect) {
6602
6602
  for (const pokemon of source.foes()) {
6603
6603
  if (!pokemon.volatiles['dynamax'])
6604
- pokemon.addVolatile('torment');
6604
+ pokemon.addVolatile('torment', source, effect);
6605
6605
  }
6606
6606
  },
6607
6607
  },
@@ -13503,7 +13503,7 @@ exports.Moves = {
13503
13503
  accuracy: 100,
13504
13504
  basePower: 80,
13505
13505
  category: "Special",
13506
- defensiveCategory: "Physical",
13506
+ overrideDefensiveStat: 'def',
13507
13507
  name: "Psyshock",
13508
13508
  pp: 10,
13509
13509
  priority: 0,
@@ -13518,7 +13518,7 @@ exports.Moves = {
13518
13518
  accuracy: 100,
13519
13519
  basePower: 100,
13520
13520
  category: "Special",
13521
- defensiveCategory: "Physical",
13521
+ overrideDefensiveStat: 'def',
13522
13522
  name: "Psystrike",
13523
13523
  pp: 10,
13524
13524
  priority: 0,
@@ -15074,7 +15074,7 @@ exports.Moves = {
15074
15074
  accuracy: 100,
15075
15075
  basePower: 85,
15076
15076
  category: "Special",
15077
- defensiveCategory: "Physical",
15077
+ overrideDefensiveStat: 'def',
15078
15078
  name: "Secret Sword",
15079
15079
  pp: 10,
15080
15080
  priority: 0,
@@ -16095,6 +16095,7 @@ exports.Moves = {
16095
16095
  onRestart(pokemon) {
16096
16096
  if (pokemon.removeVolatile('fly') || pokemon.removeVolatile('bounce')) {
16097
16097
  this.queue.cancelMove(pokemon);
16098
+ pokemon.removeVolatile('twoturnmove');
16098
16099
  this.add('-start', pokemon, 'Smack Down');
16099
16100
  }
16100
16101
  },
@@ -18598,11 +18599,13 @@ exports.Moves = {
18598
18599
  volatileStatus: 'torment',
18599
18600
  condition: {
18600
18601
  noCopy: true,
18601
- onStart(pokemon) {
18602
+ onStart(pokemon, source, effect) {
18602
18603
  if (pokemon.volatiles['dynamax']) {
18603
18604
  delete pokemon.volatiles['torment'];
18604
18605
  return false;
18605
18606
  }
18607
+ if (effect?.id === 'gmaxmeltdown')
18608
+ this.effectState.duration = 3;
18606
18609
  this.add('-start', pokemon, 'Torment');
18607
18610
  },
18608
18611
  onEnd(pokemon) {
@@ -19744,13 +19747,23 @@ exports.Moves = {
19744
19747
  }
19745
19748
  return 5;
19746
19749
  },
19750
+ onModifyMove(move, source, target) {
19751
+ // This code is for moves that use defensive stats as the attacking stat; see below for most of the implementation
19752
+ if (!move.overrideOffensiveStat)
19753
+ return;
19754
+ const statAndBoosts = move.overrideOffensiveStat;
19755
+ if (!['def', 'spd'].includes(statAndBoosts))
19756
+ return;
19757
+ move.overrideOffensiveStat = statAndBoosts === 'def' ? 'spd' : 'def';
19758
+ this.hint(`${move.name} uses ${statAndBoosts === 'def' ? '' : 'Sp. '}Def boosts when Wonder Room is active.`);
19759
+ },
19747
19760
  onFieldStart(field, source) {
19748
19761
  this.add('-fieldstart', 'move: Wonder Room', '[of] ' + source);
19749
19762
  },
19750
19763
  onFieldRestart(target, source) {
19751
19764
  this.field.removePseudoWeather('wonderroom');
19752
19765
  },
19753
- // Swapping defenses implemented in sim/pokemon.js:Pokemon#calculateStat and Pokemon#getStat
19766
+ // Swapping defenses partially implemented in sim/pokemon.js:Pokemon#calculateStat and Pokemon#getStat
19754
19767
  onFieldResidualOrder: 27,
19755
19768
  onFieldResidualSubOrder: 5,
19756
19769
  onFieldEnd() {