@pkmn/sim 0.4.20 → 0.4.24

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 (88) hide show
  1. package/build/config/formats.js +415 -688
  2. package/build/config/formats.js.map +1 -1
  3. package/build/data/aliases.js +7 -5
  4. package/build/data/aliases.js.map +1 -1
  5. package/build/data/conditions.js +4 -1
  6. package/build/data/conditions.js.map +1 -1
  7. package/build/data/formats-data.js +18 -18
  8. package/build/data/formats-data.js.map +1 -1
  9. package/build/data/learnsets.js +10 -8
  10. package/build/data/learnsets.js.map +1 -1
  11. package/build/data/mods/gen1/moves.js +1 -1
  12. package/build/data/mods/gen1/moves.js.map +1 -1
  13. package/build/data/mods/gen1/scripts.js +18 -22
  14. package/build/data/mods/gen1/scripts.js.map +1 -1
  15. package/build/data/mods/gen2/scripts.js +16 -23
  16. package/build/data/mods/gen2/scripts.js.map +1 -1
  17. package/build/data/mods/gen3/moves.js +2 -1
  18. package/build/data/mods/gen3/moves.js.map +1 -1
  19. package/build/data/mods/gen4/conditions.js +6 -0
  20. package/build/data/mods/gen4/conditions.js.map +1 -1
  21. package/build/data/mods/gen4/moves.js +2 -1
  22. package/build/data/mods/gen4/moves.js.map +1 -1
  23. package/build/data/mods/gen4/scripts.js +2 -1
  24. package/build/data/mods/gen4/scripts.js.map +1 -1
  25. package/build/data/mods/gen6/conditions.js +4 -1
  26. package/build/data/mods/gen6/conditions.js.map +1 -1
  27. package/build/data/mods/gen7/formats-data.js +2 -2
  28. package/build/data/mods/gen7/formats-data.js.map +1 -1
  29. package/build/data/mods/gen7/moves.js +8 -0
  30. package/build/data/mods/gen7/moves.js.map +1 -1
  31. package/build/data/moves.js +25 -13
  32. package/build/data/moves.js.map +1 -1
  33. package/build/data/rulesets.js +221 -1
  34. package/build/data/rulesets.js.map +1 -1
  35. package/build/data/tags.js +2 -2
  36. package/build/data/tags.js.map +1 -1
  37. package/build/lib/streams.d.ts +1 -199
  38. package/build/lib/streams.js +11 -772
  39. package/build/lib/streams.js.map +1 -1
  40. package/build/sim/battle-actions.d.ts +1 -1
  41. package/build/sim/battle-actions.js +18 -42
  42. package/build/sim/battle-actions.js.map +1 -1
  43. package/build/sim/battle.d.ts +1 -0
  44. package/build/sim/battle.js +5 -0
  45. package/build/sim/battle.js.map +1 -1
  46. package/build/sim/dex-moves.d.ts +31 -11
  47. package/build/sim/dex-moves.js +4 -3
  48. package/build/sim/dex-moves.js.map +1 -1
  49. package/build/sim/dex-species.js +11 -1
  50. package/build/sim/dex-species.js.map +1 -1
  51. package/build/sim/exported-global-types.d.ts +1 -0
  52. package/build/sim/global-types.d.ts +1 -0
  53. package/build/sim/side.js +2 -2
  54. package/build/sim/side.js.map +1 -1
  55. package/build/sim/team-validator.js +2 -2
  56. package/build/sim/team-validator.js.map +1 -1
  57. package/build/sim/tools/runner.d.ts +1 -6
  58. package/build/sim/tools/runner.js +6 -6
  59. package/build/sim/tools/runner.js.map +1 -1
  60. package/config/formats.ts +393 -643
  61. package/data/aliases.ts +7 -5
  62. package/data/conditions.ts +4 -1
  63. package/data/formats-data.ts +18 -18
  64. package/data/learnsets.ts +10 -8
  65. package/data/mods/gen1/moves.ts +1 -1
  66. package/data/mods/gen1/scripts.ts +23 -19
  67. package/data/mods/gen2/scripts.ts +20 -19
  68. package/data/mods/gen3/moves.ts +2 -1
  69. package/data/mods/gen4/conditions.ts +6 -0
  70. package/data/mods/gen4/moves.ts +2 -1
  71. package/data/mods/gen4/scripts.ts +1 -1
  72. package/data/mods/gen6/conditions.ts +4 -1
  73. package/data/mods/gen7/formats-data.ts +2 -2
  74. package/data/mods/gen7/moves.ts +8 -0
  75. package/data/moves.ts +22 -13
  76. package/data/rulesets.ts +199 -1
  77. package/data/tags.ts +2 -2
  78. package/lib/streams.ts +1 -874
  79. package/package.json +3 -2
  80. package/sim/battle-actions.ts +19 -40
  81. package/sim/battle.ts +6 -0
  82. package/sim/dex-moves.ts +35 -13
  83. package/sim/dex-species.ts +10 -1
  84. package/sim/exported-global-types.ts +1 -0
  85. package/sim/global-types.ts +1 -0
  86. package/sim/side.ts +2 -2
  87. package/sim/team-validator.ts +2 -2
  88. package/sim/tools/runner.ts +2 -0
package/data/aliases.ts CHANGED
@@ -14,8 +14,8 @@ export const Aliases: {[alias: string]: string} = {
14
14
  mono: "[Gen 8] Monotype",
15
15
  ag: "[Gen 8] Anything Goes",
16
16
  bss: "[Gen 8] Battle Stadium Singles",
17
- vgc: "[Gen 8] VGC 2021 Series 10",
18
- bsd: "[Gen 8] VGC 2021 Series 10",
17
+ vgc: "[Gen 8] VGC 2021 Series 11",
18
+ bsd: "[Gen 8] VGC 2021 Series 11",
19
19
  randdubs: "[Gen 8] Random Doubles Battle",
20
20
  doubles: "[Gen 8] Doubles OU",
21
21
  dou: "[Gen 8] Doubles OU",
@@ -35,7 +35,8 @@ export const Aliases: {[alias: string]: string} = {
35
35
  camo: "[Gen 8] Camomons",
36
36
  ffa: "[Gen 8] Free-For-All",
37
37
  ts: "[Gen 8] Tier Shift",
38
- ph: "[Gen 8] Pure Hackmons",
38
+ ph: "[Gen 8 BDSP] Pure Hackmons",
39
+ purehackmons: "[Gen 8 BDSP] Pure Hackmons",
39
40
  gen7bh: "[Gen 7] Balanced Hackmons",
40
41
  gen7mnm: "[Gen 7] Mix and Mega",
41
42
  gen7stab: "[Gen 7] STABmons",
@@ -56,6 +57,7 @@ export const Aliases: {[alias: string]: string} = {
56
57
  gen7mono: "[Gen 7] Monotype",
57
58
  gen7ag: "[Gen 7] Anything Goes",
58
59
  gen7bss: "[Gen 7] Battle Spot Singles",
60
+ bfd: "[Gen 8 BDSP] Battle Festival Doubles",
59
61
  lgou: "[Gen 7] Let's Go OU",
60
62
  vgc20: "[Gen 8] VGC 2020",
61
63
  vgc19: "[Gen 7] VGC 2019",
@@ -65,8 +67,8 @@ export const Aliases: {[alias: string]: string} = {
65
67
  gen6mono: "[Gen 6] Monotype",
66
68
  gen6ag: "[Gen 6] Anything Goes",
67
69
  crossevo: "[Gen 8] Cross Evolution",
68
- omotm: "[Gen 8] Multibility",
69
- lcotm: "[Gen 8] 350 Cup",
70
+ omotm: "[Gen 8] Sketchmons",
71
+ lcotm: "[Gen 8] AAA Doubles",
70
72
 
71
73
  // mega evos
72
74
  fabio: "Ampharos-Mega",
@@ -28,9 +28,12 @@ export const Conditions: {[k: string]: ConditionData} = {
28
28
  }
29
29
  },
30
30
  onModifySpe(spe, pokemon) {
31
+ // Paralysis occurs after all other Speed modifiers, so evaluate all modifiers up to this point first
32
+ spe = this.finalModify(spe);
31
33
  if (!pokemon.hasAbility('quickfeet')) {
32
- return this.chainModify(0.5);
34
+ spe = Math.floor(spe * 50 / 100);
33
35
  }
36
+ return spe;
34
37
  },
35
38
  onBeforeMovePriority: 1,
36
39
  onBeforeMove(pokemon) {
@@ -276,7 +276,7 @@ export const FormatsData: {[k: string]: SpeciesFormatsData} = {
276
276
  randomBattleMoves: ["earthquake", "knockoff", "rapidspin", "stealthrock", "swordsdance", "toxic", "spikes", "stoneedge"],
277
277
  randomBattleLevel: 86,
278
278
  randomDoubleBattleMoves: ["drillrun", "knockoff", "protect", "stealthrock", "stoneedge", "swordsdance"],
279
- randomDoubleBattleLevel: 88,
279
+ randomDoubleBattleLevel: 89,
280
280
  tier: "PU",
281
281
  doublesTier: "(DUU)",
282
282
  },
@@ -467,7 +467,7 @@ export const FormatsData: {[k: string]: SpeciesFormatsData} = {
467
467
  },
468
468
  persianalola: {
469
469
  randomBattleMoves: ["darkpulse", "hypnosis", "nastyplot", "thunderbolt"],
470
- randomBattleLevel: 83,
470
+ randomBattleLevel: 82,
471
471
  randomDoubleBattleMoves: ["fakeout", "foulplay", "icywind", "partingshot", "protect", "snarl", "taunt"],
472
472
  randomDoubleBattleLevel: 88,
473
473
  tier: "(PU)",
@@ -847,7 +847,7 @@ export const FormatsData: {[k: string]: SpeciesFormatsData} = {
847
847
  },
848
848
  exeggutoralola: {
849
849
  randomBattleMoves: ["dracometeor", "flamethrower", "gigadrain", "leafstorm", "trickroom"],
850
- randomBattleLevel: 86,
850
+ randomBattleLevel: 87,
851
851
  randomDoubleBattleMoves: ["dragonpulse", "energyball", "flamethrower", "protect", "trickroom"],
852
852
  randomDoubleBattleLevel: 88,
853
853
  tier: "PUBL",
@@ -1139,7 +1139,7 @@ export const FormatsData: {[k: string]: SpeciesFormatsData} = {
1139
1139
  randomBattleMoves: ["bounce", "dragondance", "earthquake", "powerwhip", "waterfall"],
1140
1140
  randomBattleLevel: 76,
1141
1141
  randomDoubleBattleMoves: ["bounce", "dragondance", "icefang", "powerwhip", "protect", "waterfall"],
1142
- randomDoubleBattleLevel: 82,
1142
+ randomDoubleBattleLevel: 81,
1143
1143
  tier: "UU",
1144
1144
  doublesTier: "(DUU)",
1145
1145
  },
@@ -1304,7 +1304,7 @@ export const FormatsData: {[k: string]: SpeciesFormatsData} = {
1304
1304
  snorlax: {
1305
1305
  randomBattleMoves: ["darkestlariat", "doubleedge", "earthquake", "facade", "heatcrash"],
1306
1306
  randomBattleLevel: 82,
1307
- tier: "NUBL",
1307
+ tier: "NU",
1308
1308
  doublesTier: "(DUU)",
1309
1309
  },
1310
1310
  snorlaxgmax: {
@@ -1703,7 +1703,7 @@ export const FormatsData: {[k: string]: SpeciesFormatsData} = {
1703
1703
  tier: "NFE",
1704
1704
  },
1705
1705
  weavile: {
1706
- randomBattleMoves: ["iceshard", "iciclecrash", "knockoff", "lowkick", "swordsdance"],
1706
+ randomBattleMoves: ["iceshard", "knockoff", "lowkick", "swordsdance", "tripleaxel"],
1707
1707
  randomBattleLevel: 79,
1708
1708
  randomDoubleBattleMoves: ["fakeout", "iceshard", "knockoff", "swordsdance", "tripleaxel"],
1709
1709
  randomDoubleBattleLevel: 84,
@@ -1742,7 +1742,7 @@ export const FormatsData: {[k: string]: SpeciesFormatsData} = {
1742
1742
  },
1743
1743
  corsola: {
1744
1744
  randomBattleMoves: ["powergem", "recover", "scald", "stealthrock", "toxic"],
1745
- randomBattleLevel: 92,
1745
+ randomBattleLevel: 93,
1746
1746
  randomDoubleBattleMoves: ["icywind", "lifedew", "recover", "scald", "toxic"],
1747
1747
  randomDoubleBattleLevel: 95,
1748
1748
  tier: "(PU)",
@@ -2662,7 +2662,7 @@ export const FormatsData: {[k: string]: SpeciesFormatsData} = {
2662
2662
  randomBattleLevel: 80,
2663
2663
  randomDoubleBattleMoves: ["calmmind", "dracometeor", "healpulse", "mysticalfire", "psyshock", "roost", "tailwind"],
2664
2664
  randomDoubleBattleLevel: 82,
2665
- tier: "UU",
2665
+ tier: "UUBL",
2666
2666
  doublesTier: "(DUU)",
2667
2667
  },
2668
2668
  latiasmega: {
@@ -2707,7 +2707,7 @@ export const FormatsData: {[k: string]: SpeciesFormatsData} = {
2707
2707
  tier: "Illegal",
2708
2708
  },
2709
2709
  rayquaza: {
2710
- randomBattleMoves: ["dracometeor", "dragonascent", "extremespeed", "swordsdance", "vcreate", "earthquake"],
2710
+ randomBattleMoves: ["dracometeor", "dragonascent", "dragondance", "extremespeed", "swordsdance", "vcreate", "earthquake"],
2711
2711
  randomBattleLevel: 74,
2712
2712
  randomDoubleBattleMoves: ["dracometeor", "dragonascent", "dragonclaw", "dragondance", "earthpower", "extremespeed", "vcreate"],
2713
2713
  randomDoubleBattleLevel: 74,
@@ -2885,7 +2885,7 @@ export const FormatsData: {[k: string]: SpeciesFormatsData} = {
2885
2885
  },
2886
2886
  cherrim: {
2887
2887
  randomBattleMoves: ["dazzlinggleam", "energyball", "healingwish", "petaldance", "pollenpuff"],
2888
- randomBattleLevel: 92,
2888
+ randomBattleLevel: 93,
2889
2889
  randomDoubleBattleMoves: ["aromatherapy", "energyball", "helpinghand", "pollenpuff", "protect"],
2890
2890
  randomDoubleBattleLevel: 92,
2891
2891
  tier: "(PU)",
@@ -3445,7 +3445,7 @@ export const FormatsData: {[k: string]: SpeciesFormatsData} = {
3445
3445
  randomBattleMoves: ["healbell", "knockoff", "protect", "toxic", "wish"],
3446
3446
  randomBattleLevel: 88,
3447
3447
  randomDoubleBattleMoves: ["bodyslam", "healpulse", "helpinghand", "knockoff", "protect", "thunderwave"],
3448
- randomDoubleBattleLevel: 88,
3448
+ randomDoubleBattleLevel: 89,
3449
3449
  tier: "PU",
3450
3450
  doublesTier: "(DUU)",
3451
3451
  },
@@ -3608,7 +3608,7 @@ export const FormatsData: {[k: string]: SpeciesFormatsData} = {
3608
3608
  randomBattleMoves: ["energyball", "knockoff", "leechseed", "spikes", "spikyshield", "toxic"],
3609
3609
  randomBattleLevel: 94,
3610
3610
  randomDoubleBattleMoves: ["acupressure", "drainpunch", "helpinghand", "leafstorm", "spikyshield", "suckerpunch"],
3611
- randomDoubleBattleLevel: 95,
3611
+ randomDoubleBattleLevel: 96, // buffed twice in the last 6 months as of Nov 2021
3612
3612
  tier: "(PU)",
3613
3613
  doublesTier: "(DUU)",
3614
3614
  },
@@ -5110,7 +5110,7 @@ export const FormatsData: {[k: string]: SpeciesFormatsData} = {
5110
5110
  randomBattleMoves: ["defog", "flamethrower", "icebeam", "multiattack", "partingshot", "toxic"],
5111
5111
  randomBattleLevel: 84,
5112
5112
  randomDoubleBattleMoves: ["multiattack", "rockslide", "swordsdance", "tailwind"],
5113
- randomDoubleBattleLevel: 90,
5113
+ randomDoubleBattleLevel: 89,
5114
5114
  tier: "(PU)",
5115
5115
  doublesTier: "(DUU)",
5116
5116
  },
@@ -5218,7 +5218,7 @@ export const FormatsData: {[k: string]: SpeciesFormatsData} = {
5218
5218
  randomBattleLevel: 86,
5219
5219
  randomDoubleBattleMoves: ["dracometeor", "dragonpulse", "glare", "heatwave", "hurricane", "hypervoice", "protect", "roost"],
5220
5220
  randomDoubleBattleLevel: 88,
5221
- tier: "PU",
5221
+ tier: "PUBL",
5222
5222
  doublesTier: "(DUU)",
5223
5223
  },
5224
5224
  dhelmise: {
@@ -5240,7 +5240,7 @@ export const FormatsData: {[k: string]: SpeciesFormatsData} = {
5240
5240
  randomBattleLevel: 80,
5241
5241
  randomDoubleBattleMoves: ["bodypress", "dracometeor", "irondefense", "protect"],
5242
5242
  randomDoubleBattleLevel: 80,
5243
- tier: "UU",
5243
+ tier: "UUBL",
5244
5244
  doublesTier: "(DUU)",
5245
5245
  },
5246
5246
  kommoototem: {
@@ -5337,7 +5337,7 @@ export const FormatsData: {[k: string]: SpeciesFormatsData} = {
5337
5337
  celesteela: {
5338
5338
  randomBattleMoves: ["airslash", "earthquake", "fireblast", "flashcannon", "leechseed", "protect"],
5339
5339
  randomBattleLevel: 77,
5340
- randomDoubleBattleMoves: ["airslash", "autotomize", "earthquake", "fireblast", "flashcannon"],
5340
+ randomDoubleBattleMoves: ["airslash", "fireblast", "flashcannon", "leechseed", "protect", "wideguard"],
5341
5341
  randomDoubleBattleLevel: 78,
5342
5342
  randomBattleNoDynamaxMoves: ["airslash", "earthquake", "fireblast", "heavyslam", "leechseed", "protect"],
5343
5343
  tier: "UU",
@@ -5964,7 +5964,7 @@ export const FormatsData: {[k: string]: SpeciesFormatsData} = {
5964
5964
  randomBattleLevel: 86,
5965
5965
  randomDoubleBattleMoves: ["blizzard", "fishiousrend", "iciclecrash", "protect", "superfang"],
5966
5966
  randomDoubleBattleLevel: 88,
5967
- tier: "(PU)",
5967
+ tier: "NUBL",
5968
5968
  doublesTier: "(DUU)",
5969
5969
  },
5970
5970
  duraludon: {
@@ -6108,7 +6108,7 @@ export const FormatsData: {[k: string]: SpeciesFormatsData} = {
6108
6108
  randomDoubleBattleMoves: ["closecombat", "highhorsepower", "iciclecrash", "protect"],
6109
6109
  randomDoubleBattleLevel: 82,
6110
6110
  tier: "NU",
6111
- doublesTier: "DUU",
6111
+ doublesTier: "(DUU)",
6112
6112
  },
6113
6113
  spectrier: {
6114
6114
  randomBattleMoves: ["darkpulse", "nastyplot", "shadowball", "substitute"],
package/data/learnsets.ts CHANGED
@@ -76667,12 +76667,12 @@ export const Learnsets: {[speciesid: string]: LearnsetData} = {
76667
76667
  hypervoice: ["8M"],
76668
76668
  icefang: ["8M"],
76669
76669
  imprison: ["8M"],
76670
- ironhead: ["8M", "8L33", "8S0"],
76670
+ ironhead: ["8M", "8L33", "8S0", "8S1"],
76671
76671
  irontail: ["8M"],
76672
76672
  laserfocus: ["8L44"],
76673
76673
  metalclaw: ["8L1"],
76674
76674
  moonblast: ["8L66"],
76675
- playrough: ["8M"],
76675
+ playrough: ["8M", "8S1"],
76676
76676
  protect: ["8M"],
76677
76677
  psychicfangs: ["8M"],
76678
76678
  psychocut: ["8M"],
@@ -76683,7 +76683,7 @@ export const Learnsets: {[speciesid: string]: LearnsetData} = {
76683
76683
  revenge: ["8M"],
76684
76684
  reversal: ["8M"],
76685
76685
  round: ["8M"],
76686
- sacredsword: ["8L1", "8S0"],
76686
+ sacredsword: ["8L1", "8S0", "8S1"],
76687
76687
  scaryface: ["8M"],
76688
76688
  slash: ["8L11"],
76689
76689
  sleeptalk: ["8M"],
@@ -76693,7 +76693,7 @@ export const Learnsets: {[speciesid: string]: LearnsetData} = {
76693
76693
  steelbeam: ["8T"],
76694
76694
  substitute: ["8M"],
76695
76695
  swift: ["8M"],
76696
- swordsdance: ["8M", "8L22", "8S0"],
76696
+ swordsdance: ["8M", "8L22", "8S0", "8S1"],
76697
76697
  tailslap: ["8M"],
76698
76698
  thunderfang: ["8M"],
76699
76699
  wildcharge: ["8M"],
@@ -76701,6 +76701,7 @@ export const Learnsets: {[speciesid: string]: LearnsetData} = {
76701
76701
  },
76702
76702
  eventData: [
76703
76703
  {generation: 8, level: 70, perfectIVs: 3, moves: ["sacredsword", "swordsdance", "ironhead", "crunch"]},
76704
+ {generation: 8, level: 100, shiny: true, nature: "Adamant", ivs: {hp: 31, atk: 31, def: 31, spa: 30, spd: 31, spe: 31}, moves: ["ironhead", "playrough", "swordsdance", "sacredsword"], pokeball: "cherishball"},
76704
76705
  ],
76705
76706
  eventOnly: true,
76706
76707
  },
@@ -76714,7 +76715,7 @@ export const Learnsets: {[speciesid: string]: LearnsetData} = {
76714
76715
  learnset: {
76715
76716
  agility: ["8M"],
76716
76717
  bite: ["8L1"],
76717
- closecombat: ["8M", "8L77"],
76718
+ closecombat: ["8M", "8L77", "8S1"],
76718
76719
  coaching: ["8T"],
76719
76720
  crunch: ["8M", "8L55", "8S0"],
76720
76721
  dazzlinggleam: ["8M"],
@@ -76733,8 +76734,8 @@ export const Learnsets: {[speciesid: string]: LearnsetData} = {
76733
76734
  hypervoice: ["8M"],
76734
76735
  icefang: ["8M"],
76735
76736
  imprison: ["8M"],
76736
- irondefense: ["8M", "8L22", "8S0"],
76737
- ironhead: ["8M", "8L33", "8S0"],
76737
+ irondefense: ["8M", "8L22", "8S0", "8S1"],
76738
+ ironhead: ["8M", "8L33", "8S0", "8S1"],
76738
76739
  irontail: ["8M"],
76739
76740
  laserfocus: ["8L44"],
76740
76741
  lightscreen: ["8M"],
@@ -76765,12 +76766,13 @@ export const Learnsets: {[speciesid: string]: LearnsetData} = {
76765
76766
  swift: ["8M"],
76766
76767
  tailslap: ["8M"],
76767
76768
  thunderfang: ["8M"],
76768
- wideguard: ["8L1"],
76769
+ wideguard: ["8L1", "8S1"],
76769
76770
  wildcharge: ["8M"],
76770
76771
  workup: ["8M"],
76771
76772
  },
76772
76773
  eventData: [
76773
76774
  {generation: 8, level: 70, perfectIVs: 3, moves: ["slash", "crunch", "ironhead", "irondefense"]},
76775
+ {generation: 8, level: 100, shiny: true, nature: "Adamant", ivs: {hp: 31, atk: 31, def: 31, spa: 30, spd: 31, spe: 31}, moves: ["ironhead", "closecombat", "irondefense", "wideguard"], pokeball: "cherishball"},
76774
76776
  ],
76775
76777
  eventOnly: true,
76776
76778
  },
@@ -82,7 +82,7 @@ export const Moves: {[k: string]: ModdedMoveData} = {
82
82
  if (this.effectState.duration === 1) {
83
83
  this.add('-end', pokemon, 'Bide');
84
84
  if (!this.effectState.totalDamage) {
85
- this.debug("Bide failed due to 0 damage taken");
85
+ this.debug("Bide failed because no damage was taken");
86
86
  this.add('-fail', pokemon);
87
87
  return false;
88
88
  }
@@ -236,7 +236,7 @@ export const Scripts: ModdedBattleScriptsData = {
236
236
  // First, check if the target is semi-invulnerable
237
237
  let hitResult = this.battle.runEvent('Invulnerability', target, pokemon, move);
238
238
  if (hitResult === false) {
239
- if (!move.spreadHit) this.battle.attrLastMove('[miss]');
239
+ this.battle.attrLastMove('[miss]');
240
240
  this.battle.add('-miss', pokemon);
241
241
  return false;
242
242
  }
@@ -579,7 +579,7 @@ export const Scripts: ModdedBattleScriptsData = {
579
579
  return damage;
580
580
  },
581
581
  // This calculates the damage pokemon does to target with move.
582
- getDamage(pokemon, target, move, suppressMessages) {
582
+ getDamage(source, target, move, suppressMessages) {
583
583
  // First of all, we get the move.
584
584
  if (typeof move === 'string') {
585
585
  move = this.battle.dex.getActiveMove(move);
@@ -607,12 +607,12 @@ export const Scripts: ModdedBattleScriptsData = {
607
607
 
608
608
  // We edit the damage through move's damage callback if necessary.
609
609
  if (move.damageCallback) {
610
- return move.damageCallback.call(this.battle, pokemon, target);
610
+ return move.damageCallback.call(this.battle, source, target);
611
611
  }
612
612
 
613
613
  // We take damage from damage=level moves (seismic toss).
614
614
  if (move.damage === 'level') {
615
- return pokemon.level;
615
+ return source.level;
616
616
  }
617
617
 
618
618
  // If there's a fix move damage, we return that.
@@ -626,13 +626,12 @@ export const Scripts: ModdedBattleScriptsData = {
626
626
  }
627
627
 
628
628
  // Let's check if we are in middle of a partial trap sequence to return the previous damage.
629
- if (pokemon.volatiles['partialtrappinglock'] && (target === pokemon.volatiles['partialtrappinglock'].locked)) {
630
- return pokemon.volatiles['partialtrappinglock'].damage;
629
+ if (source.volatiles['partialtrappinglock'] && (target === source.volatiles['partialtrappinglock'].locked)) {
630
+ return source.volatiles['partialtrappinglock'].damage;
631
631
  }
632
632
 
633
633
  // We check the category and typing to calculate later on the damage.
634
634
  if (!move.category) move.category = 'Physical';
635
- if (!move.defensiveCategory) move.defensiveCategory = move.category;
636
635
  // '???' is typeless damage: used for Struggle and Confusion etc
637
636
  if (!move.type) move.type = '???';
638
637
  const type = move.type;
@@ -640,7 +639,7 @@ export const Scripts: ModdedBattleScriptsData = {
640
639
  // We get the base power and apply basePowerCallback if necessary.
641
640
  let basePower: number | false | null = move.basePower;
642
641
  if (move.basePowerCallback) {
643
- basePower = move.basePowerCallback.call(this.battle, pokemon, target, move);
642
+ basePower = move.basePowerCallback.call(this.battle, source, target, move);
644
643
  }
645
644
  if (!basePower) {
646
645
  return basePower === 0 ? undefined : basePower;
@@ -652,10 +651,10 @@ export const Scripts: ModdedBattleScriptsData = {
652
651
  if (!isCrit) {
653
652
  // In gen 1, the critical chance is based on speed.
654
653
  // First, we get the base speed, divide it by 2 and floor it. This is our current crit chance.
655
- let critChance = Math.floor(pokemon.species.baseStats['spe'] / 2);
654
+ let critChance = Math.floor(source.species.baseStats['spe'] / 2);
656
655
 
657
656
  // Now we check for focus energy volatile.
658
- if (pokemon.volatiles['focusenergy']) {
657
+ if (source.volatiles['focusenergy']) {
659
658
  // If it exists, crit chance is divided by 2 again and floored.
660
659
  critChance = Math.floor(critChance / 2);
661
660
  } else {
@@ -683,7 +682,7 @@ export const Scripts: ModdedBattleScriptsData = {
683
682
 
684
683
  // Happens after crit calculation.
685
684
  if (basePower) {
686
- basePower = this.battle.runEvent('BasePower', pokemon, target, move, basePower);
685
+ basePower = this.battle.runEvent('BasePower', source, target, move, basePower);
687
686
  if (basePower && move.basePowerModifier) {
688
687
  basePower *= move.basePowerModifier;
689
688
  }
@@ -692,14 +691,17 @@ export const Scripts: ModdedBattleScriptsData = {
692
691
  basePower = this.battle.clampIntRange(basePower, 1);
693
692
 
694
693
  // We now check attacker's and defender's stats.
695
- let level = pokemon.level;
696
- let attacker = pokemon;
697
- const defender = target;
698
- if (move.useTargetOffensive) attacker = target;
699
- const atkType: StatIDExceptHP = (move.category === 'Physical') ? 'atk' : 'spa';
700
- const defType: StatIDExceptHP = (move.defensiveCategory === 'Physical') ? 'def' : 'spd';
701
- let attack = attacker.getStat(move.useSourceDefensiveAsOffensive ? defType : atkType);
694
+ let level = source.level;
695
+ const attacker = move.overrideOffensivePokemon === 'target' ? target : source;
696
+ const defender = move.overrideDefensivePokemon === 'source' ? source : target;
697
+
698
+ const isPhysical = move.category === 'Physical';
699
+ const atkType: StatIDExceptHP = move.overrideOffensiveStat || (isPhysical ? 'atk' : 'spa');
700
+ const defType: StatIDExceptHP = move.overrideDefensiveStat || (isPhysical ? 'def' : 'spd');
701
+
702
+ let attack = attacker.getStat(atkType);
702
703
  let defense = defender.getStat(defType);
704
+
703
705
  // In gen 1, screen effect is applied here.
704
706
  if ((defType === 'def' && defender.volatiles['reflect']) || (defType === 'spd' && defender.volatiles['lightscreen'])) {
705
707
  this.battle.debug('Screen doubling (Sp)Def');
@@ -716,10 +718,12 @@ export const Scripts: ModdedBattleScriptsData = {
716
718
  level *= 2;
717
719
  if (!suppressMessages) this.battle.add('-crit', target);
718
720
  }
721
+
719
722
  if (move.ignoreOffensive) {
720
723
  this.battle.debug('Negating (sp)atk boost/penalty.');
721
724
  attack = attacker.getStat(atkType, true);
722
725
  }
726
+
723
727
  if (move.ignoreDefensive) {
724
728
  this.battle.debug('Negating (sp)def boost/penalty.');
725
729
  // No screens
@@ -751,7 +755,7 @@ export const Scripts: ModdedBattleScriptsData = {
751
755
  damage += 2;
752
756
 
753
757
  // STAB damage bonus, the "???" type never gets STAB
754
- if (type !== '???' && pokemon.hasType(type)) {
758
+ if (type !== '???' && source.hasType(type)) {
755
759
  damage += Math.floor(damage / 2);
756
760
  }
757
761
 
@@ -162,7 +162,7 @@ export const Scripts: ModdedBattleScriptsData = {
162
162
 
163
163
  hitResult = this.battle.runEvent('Invulnerability', target, pokemon, move);
164
164
  if (hitResult === false) {
165
- if (!move.spreadHit) this.battle.attrLastMove('[miss]');
165
+ this.battle.attrLastMove('[miss]');
166
166
  this.battle.add('-miss', pokemon);
167
167
  return false;
168
168
  }
@@ -466,7 +466,7 @@ export const Scripts: ModdedBattleScriptsData = {
466
466
  }
467
467
  return damage;
468
468
  },
469
- getDamage(pokemon, target, move, suppressMessages) {
469
+ getDamage(source, target, move, suppressMessages) {
470
470
  // First of all, we get the move.
471
471
  if (typeof move === 'string') {
472
472
  move = this.dex.getActiveMove(move);
@@ -494,12 +494,12 @@ export const Scripts: ModdedBattleScriptsData = {
494
494
 
495
495
  // We edit the damage through move's damage callback
496
496
  if (move.damageCallback) {
497
- return move.damageCallback.call(this.battle, pokemon, target);
497
+ return move.damageCallback.call(this.battle, source, target);
498
498
  }
499
499
 
500
500
  // We take damage from damage=level moves
501
501
  if (move.damage === 'level') {
502
- return pokemon.level;
502
+ return source.level;
503
503
  }
504
504
 
505
505
  // If there's a fix move damage, we run it
@@ -509,7 +509,6 @@ export const Scripts: ModdedBattleScriptsData = {
509
509
 
510
510
  // We check the category and typing to calculate later on the damage
511
511
  move.category = this.battle.getCategory(move);
512
- if (!move.defensiveCategory) move.defensiveCategory = move.category;
513
512
  // '???' is typeless damage: used for Struggle and Confusion etc
514
513
  if (!move.type) move.type = '???';
515
514
  const type = move.type;
@@ -517,7 +516,7 @@ export const Scripts: ModdedBattleScriptsData = {
517
516
  // We get the base power and apply basePowerCallback if necessary
518
517
  let basePower: number | false | null | undefined = move.basePower;
519
518
  if (move.basePowerCallback) {
520
- basePower = move.basePowerCallback.call(this.battle, pokemon, target, move);
519
+ basePower = move.basePowerCallback.call(this.battle, source, target, move);
521
520
  }
522
521
 
523
522
  // We check for Base Power
@@ -528,7 +527,7 @@ export const Scripts: ModdedBattleScriptsData = {
528
527
  basePower = this.battle.clampIntRange(basePower, 1);
529
528
 
530
529
  // Checking for the move's Critical Hit ratio
531
- let critRatio = this.battle.runEvent('ModifyCritRatio', pokemon, target, move, move.critRatio || 0);
530
+ let critRatio = this.battle.runEvent('ModifyCritRatio', source, target, move, move.critRatio || 0);
532
531
  critRatio = this.battle.clampIntRange(critRatio, 0, 5);
533
532
  const critMult = [0, 16, 8, 4, 3, 2];
534
533
  let isCrit = move.willCrit || false;
@@ -547,10 +546,10 @@ export const Scripts: ModdedBattleScriptsData = {
547
546
  // confusion damage
548
547
  if (move.isConfusionSelfHit) {
549
548
  move.type = move.baseMoveType!;
550
- basePower = this.battle.runEvent('BasePower', pokemon, target, move, basePower, true);
549
+ basePower = this.battle.runEvent('BasePower', source, target, move, basePower, true);
551
550
  move.type = '???';
552
551
  } else {
553
- basePower = this.battle.runEvent('BasePower', pokemon, target, move, basePower, true);
552
+ basePower = this.battle.runEvent('BasePower', source, target, move, basePower, true);
554
553
  }
555
554
  if (basePower && move.basePowerModifier) {
556
555
  basePower *= move.basePowerModifier;
@@ -560,20 +559,21 @@ export const Scripts: ModdedBattleScriptsData = {
560
559
  basePower = this.battle.clampIntRange(basePower, 1);
561
560
 
562
561
  // We now check for attacker and defender
563
- let level = pokemon.level;
562
+ let level = source.level;
564
563
 
565
564
  // Using Beat Up
566
565
  if (move.allies) {
567
- this.battle.add('-activate', pokemon, 'move: Beat Up', '[of] ' + move.allies[0].name);
566
+ this.battle.add('-activate', source, 'move: Beat Up', '[of] ' + move.allies[0].name);
568
567
  level = move.allies[0].level;
569
568
  }
570
569
 
571
- let attacker = pokemon;
572
- const defender = target;
573
- if (move.useTargetOffensive) attacker = target;
574
- let atkType: StatIDExceptHP = (move.category === 'Physical') ? 'atk' : 'spa';
575
- const defType: StatIDExceptHP = (move.defensiveCategory === 'Physical') ? 'def' : 'spd';
576
- if (move.useSourceDefensiveAsOffensive) atkType = defType;
570
+ const attacker = move.overrideOffensivePokemon === 'target' ? target : source;
571
+ const defender = move.overrideDefensivePokemon === 'source' ? source : target;
572
+
573
+ const isPhysical = move.category === 'Physical';
574
+ const atkType: StatIDExceptHP = move.overrideOffensiveStat || (isPhysical ? 'atk' : 'spa');
575
+ const defType: StatIDExceptHP = move.overrideDefensiveStat || (isPhysical ? 'def' : 'spd');
576
+
577
577
  let unboosted = false;
578
578
  let noburndrop = false;
579
579
 
@@ -586,7 +586,7 @@ export const Scripts: ModdedBattleScriptsData = {
586
586
  noburndrop = true;
587
587
  }
588
588
  }
589
- // Get stats now.
589
+
590
590
  let attack = attacker.getStat(atkType, unboosted, noburndrop);
591
591
  let defense = defender.getStat(defType, unboosted);
592
592
 
@@ -603,6 +603,7 @@ export const Scripts: ModdedBattleScriptsData = {
603
603
  // The attack drop from the burn is only applied when attacker's attack level is higher than defender's defense level.
604
604
  attack = attacker.getStat(atkType, true, true);
605
605
  }
606
+
606
607
  if (move.ignoreDefensive) {
607
608
  this.battle.debug('Negating (sp)def boost/penalty.');
608
609
  defense = target.getStat(defType, true, true);
@@ -666,7 +667,7 @@ export const Scripts: ModdedBattleScriptsData = {
666
667
  }
667
668
 
668
669
  // STAB damage bonus, the "???" type never gets STAB
669
- if (type !== '???' && pokemon.hasType(type)) {
670
+ if (type !== '???' && source.hasType(type)) {
670
671
  damage += Math.floor(damage / 2);
671
672
  }
672
673
 
@@ -40,7 +40,8 @@ export const Moves: {[k: string]: ModdedMoveData} = {
40
40
  duration: 1,
41
41
  onModifySpAPriority: -101,
42
42
  onModifySpA(atk, pokemon, defender, move) {
43
- this.add('-activate', pokemon, 'move: Beat Up', '[of] ' + move.allies![0].name);
43
+ // https://www.smogon.com/forums/posts/8992145/
44
+ // this.add('-activate', pokemon, 'move: Beat Up', '[of] ' + move.allies![0].name);
44
45
  this.event.modifier = 1;
45
46
  return move.allies!.shift()!.species.baseStats.atk;
46
47
  },
@@ -6,6 +6,12 @@ export const Conditions: {[k: string]: ModdedConditionData} = {
6
6
  },
7
7
  par: {
8
8
  inherit: true,
9
+ onModifySpe(spe, pokemon) {
10
+ if (!pokemon.hasAbility('quickfeet')) {
11
+ return this.chainModify(0.25);
12
+ }
13
+ return spe;
14
+ },
9
15
  onBeforeMove(pokemon) {
10
16
  if (!pokemon.hasAbility('magicguard') && this.randomChance(1, 4)) {
11
17
  this.add('cant', pokemon, 'par');
@@ -87,7 +87,8 @@ export const Moves: {[k: string]: ModdedMoveData} = {
87
87
  duration: 1,
88
88
  onModifyAtkPriority: -101,
89
89
  onModifyAtk(atk, pokemon, defender, move) {
90
- this.add('-activate', pokemon, 'move: Beat Up', '[of] ' + move.allies![0].name);
90
+ // https://www.smogon.com/forums/posts/8992145/
91
+ // this.add('-activate', pokemon, 'move: Beat Up', '[of] ' + move.allies![0].name);
91
92
  this.event.modifier = 1;
92
93
  return move.allies!.shift()!.species.baseStats.atk;
93
94
  },
@@ -88,7 +88,7 @@ export const Scripts: ModdedBattleScriptsData = {
88
88
  const hitResults = this.battle.runEvent('Invulnerability', targets, pokemon, move);
89
89
  for (const [i, target] of targets.entries()) {
90
90
  if (hitResults[i] === false) {
91
- this.battle.attrLastMove('[miss]');
91
+ if (!move.spreadHit) this.battle.attrLastMove('[miss]');
92
92
  this.battle.add('-miss', pokemon, target);
93
93
  }
94
94
  }
@@ -8,9 +8,12 @@ export const Conditions: {[k: string]: ModdedConditionData} = {
8
8
  par: {
9
9
  inherit: true,
10
10
  onModifySpe(spe, pokemon) {
11
+ // Paralysis occurs after all other Speed modifiers, so evaluate all modifiers up to this point first
12
+ spe = this.finalModify(spe);
11
13
  if (!pokemon.hasAbility('quickfeet')) {
12
- return this.chainModify(0.25);
14
+ spe = Math.floor(spe * 25 / 100);
13
15
  }
16
+ return spe;
14
17
  },
15
18
  },
16
19
  confusion: {
@@ -529,7 +529,7 @@ export const FormatsData: {[k: string]: ModdedSpeciesFormatsData} = {
529
529
  doublesTier: "(DUU)",
530
530
  },
531
531
  farfetchd: {
532
- randomBattleMoves: ["bravebird", "knockoff", "leafblade", "return", "roost", "swordsdance"],
532
+ randomBattleMoves: ["bravebird", "knockoff", "leafblade", "return", "swordsdance"],
533
533
  randomDoubleBattleMoves: ["bravebird", "knockoff", "leafblade", "protect", "return", "swordsdance"],
534
534
  tier: "(PU)",
535
535
  doublesTier: "(DUU)",
@@ -2486,7 +2486,7 @@ export const FormatsData: {[k: string]: ModdedSpeciesFormatsData} = {
2486
2486
  tier: "LC",
2487
2487
  },
2488
2488
  gastrodon: {
2489
- randomBattleMoves: ["clearsmog", "earthquake", "icebeam", "recover", "scald", "toxic"],
2489
+ randomBattleMoves: ["earthquake", "icebeam", "recover", "scald", "toxic"],
2490
2490
  randomDoubleBattleMoves: ["earthpower", "icywind", "muddywater", "protect", "recover", "scald"],
2491
2491
  tier: "PU",
2492
2492
  doublesTier: "DOU",
@@ -151,6 +151,10 @@ export const Moves: {[k: string]: ModdedMoveData} = {
151
151
  inherit: true,
152
152
  isNonstandard: null,
153
153
  },
154
+ dive: {
155
+ inherit: true,
156
+ flags: {contact: 1, charge: 1, protect: 1, mirror: 1, nonsky: 1},
157
+ },
154
158
  dizzypunch: {
155
159
  inherit: true,
156
160
  isNonstandard: null,
@@ -644,6 +648,10 @@ export const Moves: {[k: string]: ModdedMoveData} = {
644
648
  inherit: true,
645
649
  isNonstandard: null,
646
650
  },
651
+ pollenpuff: {
652
+ inherit: true,
653
+ flags: {bullet: 1, protect: 1, mirror: 1},
654
+ },
647
655
  powder: {
648
656
  inherit: true,
649
657
  isNonstandard: null,