@pkmn/sim 0.7.5 → 0.7.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 (102) hide show
  1. package/build/cjs/config/formats.js +36 -18
  2. package/build/cjs/config/formats.js.map +1 -1
  3. package/build/cjs/data/abilities.js +24 -5
  4. package/build/cjs/data/abilities.js.map +1 -1
  5. package/build/cjs/data/aliases.js +5 -5
  6. package/build/cjs/data/formats-data.js +4 -4
  7. package/build/cjs/data/formats-data.js.map +1 -1
  8. package/build/cjs/data/items.js +203 -45
  9. package/build/cjs/data/items.js.map +1 -1
  10. package/build/cjs/data/learnsets.js +115 -2
  11. package/build/cjs/data/learnsets.js.map +1 -1
  12. package/build/cjs/data/mods/gen1/moves.js +2 -2
  13. package/build/cjs/data/mods/gen1/moves.js.map +1 -1
  14. package/build/cjs/data/mods/gen1/scripts.js +14 -16
  15. package/build/cjs/data/mods/gen1/scripts.js.map +1 -1
  16. package/build/cjs/data/mods/gen2/moves.js +2 -20
  17. package/build/cjs/data/mods/gen2/moves.js.map +1 -1
  18. package/build/cjs/data/mods/gen3/moves.js +17 -51
  19. package/build/cjs/data/mods/gen3/moves.js.map +1 -1
  20. package/build/cjs/data/mods/gen8/index.js +3 -1
  21. package/build/cjs/data/mods/gen8/index.js.map +1 -1
  22. package/build/cjs/data/mods/gen8/items.js +654 -0
  23. package/build/cjs/data/mods/gen8/items.js.map +1 -0
  24. package/build/cjs/data/moves.js +5 -1
  25. package/build/cjs/data/moves.js.map +1 -1
  26. package/build/cjs/data/rulesets.js +59 -17
  27. package/build/cjs/data/rulesets.js.map +1 -1
  28. package/build/cjs/data/text/moves.js +5 -2
  29. package/build/cjs/data/text/moves.js.map +1 -1
  30. package/build/cjs/sim/battle-actions.js +24 -12
  31. package/build/cjs/sim/battle-actions.js.map +1 -1
  32. package/build/cjs/sim/battle.js +15 -10
  33. package/build/cjs/sim/battle.js.map +1 -1
  34. package/build/cjs/sim/dex-conditions.js.map +1 -1
  35. package/build/cjs/sim/dex-formats.js.map +1 -1
  36. package/build/cjs/sim/dex-items.js.map +1 -1
  37. package/build/cjs/sim/dex.js +2 -1
  38. package/build/cjs/sim/dex.js.map +1 -1
  39. package/build/cjs/sim/index.js +2 -1
  40. package/build/cjs/sim/index.js.map +1 -1
  41. package/build/cjs/sim/pokemon.js +6 -0
  42. package/build/cjs/sim/pokemon.js.map +1 -1
  43. package/build/cjs/sim/team-validator.js +2 -2
  44. package/build/cjs/sim/team-validator.js.map +1 -1
  45. package/build/esm/config/formats.mjs +62 -18
  46. package/build/esm/config/formats.mjs.map +1 -1
  47. package/build/esm/data/abilities.mjs +24 -5
  48. package/build/esm/data/abilities.mjs.map +1 -1
  49. package/build/esm/data/aliases.mjs +7 -7
  50. package/build/esm/data/formats-data.mjs +4 -4
  51. package/build/esm/data/formats-data.mjs.map +1 -1
  52. package/build/esm/data/items.mjs +203 -45
  53. package/build/esm/data/items.mjs.map +1 -1
  54. package/build/esm/data/learnsets.mjs +115 -2
  55. package/build/esm/data/learnsets.mjs.map +1 -1
  56. package/build/esm/data/mods/gen1/moves.mjs +2 -2
  57. package/build/esm/data/mods/gen1/moves.mjs.map +1 -1
  58. package/build/esm/data/mods/gen1/scripts.mjs +14 -16
  59. package/build/esm/data/mods/gen1/scripts.mjs.map +1 -1
  60. package/build/esm/data/mods/gen2/moves.mjs +2 -20
  61. package/build/esm/data/mods/gen2/moves.mjs.map +1 -1
  62. package/build/esm/data/mods/gen3/moves.mjs +17 -51
  63. package/build/esm/data/mods/gen3/moves.mjs.map +1 -1
  64. package/build/esm/data/mods/gen8/index.mjs +1 -0
  65. package/build/esm/data/mods/gen8/index.mjs.map +1 -1
  66. package/build/esm/data/mods/gen8/items.mjs +651 -0
  67. package/build/esm/data/mods/gen8/items.mjs.map +1 -0
  68. package/build/esm/data/moves.mjs +5 -1
  69. package/build/esm/data/moves.mjs.map +1 -1
  70. package/build/esm/data/rulesets.mjs +59 -17
  71. package/build/esm/data/rulesets.mjs.map +1 -1
  72. package/build/esm/data/text/moves.mjs +5 -2
  73. package/build/esm/data/text/moves.mjs.map +1 -1
  74. package/build/esm/sim/battle-actions.mjs +24 -12
  75. package/build/esm/sim/battle-actions.mjs.map +1 -1
  76. package/build/esm/sim/battle.mjs +15 -10
  77. package/build/esm/sim/battle.mjs.map +1 -1
  78. package/build/esm/sim/dex-conditions.mjs.map +1 -1
  79. package/build/esm/sim/dex-formats.mjs.map +1 -1
  80. package/build/esm/sim/dex-items.mjs.map +1 -1
  81. package/build/esm/sim/dex.mjs +2 -1
  82. package/build/esm/sim/dex.mjs.map +1 -1
  83. package/build/esm/sim/index.mjs +1 -1
  84. package/build/esm/sim/index.mjs.map +1 -1
  85. package/build/esm/sim/pokemon.mjs +6 -0
  86. package/build/esm/sim/pokemon.mjs.map +1 -1
  87. package/build/esm/sim/team-validator.mjs +2 -2
  88. package/build/esm/sim/team-validator.mjs.map +1 -1
  89. package/build/esm/sim/tools/exhaustive-runner.mjs +4 -2
  90. package/build/esm/sim/tools/exhaustive-runner.mjs.map +1 -1
  91. package/build/esm/sim/tools/runner.mjs +4 -2
  92. package/build/esm/sim/tools/runner.mjs.map +1 -1
  93. package/build/types/data/mods/gen8/index.d.ts +1 -0
  94. package/build/types/data/mods/gen8/items.d.ts +3 -0
  95. package/build/types/sim/dex-conditions.d.ts +0 -12
  96. package/build/types/sim/dex-formats.d.ts +0 -1
  97. package/build/types/sim/dex-items.d.ts +1 -0
  98. package/build/types/sim/dex.d.ts +2 -2
  99. package/build/types/sim/exported-global-types.d.ts +2 -0
  100. package/build/types/sim/global-types.d.ts +2 -0
  101. package/build/types/sim/index.d.ts +1 -1
  102. package/package.json +2 -1
@@ -112,7 +112,6 @@ export interface EventMethods {
112
112
  onFoeBeforeMove?: CommonHandlers['VoidSourceMove'];
113
113
  onFoeBeforeSwitchIn?: (this: Battle, pokemon: Pokemon) => void;
114
114
  onFoeBeforeSwitchOut?: (this: Battle, pokemon: Pokemon) => void;
115
- onFoeBeforeTurn?: (this: Battle, pokemon: Pokemon) => void;
116
115
  onFoeBoost?: (this: Battle, boost: SparseBoostsTable, target: Pokemon, source: Pokemon, effect: Effect) => void;
117
116
  onFoeChargeMove?: CommonHandlers['VoidSourceMove'];
118
117
  onFoeCriticalHit?: ((this: Battle, pokemon: Pokemon, source: null, move: ActiveMove) => boolean | void) | boolean;
@@ -168,8 +167,6 @@ export interface EventMethods {
168
167
  onFoeTryMove?: MoveEventMethods['onTryMove'];
169
168
  onFoeTryPrimaryHit?: (this: Battle, target: Pokemon, source: Pokemon, move: ActiveMove) => boolean | null | number | void;
170
169
  onFoeType?: (this: Battle, types: string[], pokemon: Pokemon) => string[] | void;
171
- onFoeUpdate?: (this: Battle, pokemon: Pokemon) => void;
172
- onFoeWeather?: (this: Battle, target: Pokemon, source: null, effect: Condition) => void;
173
170
  onFoeWeatherModifyDamage?: CommonHandlers['ModifierSourceMove'];
174
171
  onFoeModifyDamagePhase1?: CommonHandlers['ModifierSourceMove'];
175
172
  onFoeModifyDamagePhase2?: CommonHandlers['ModifierSourceMove'];
@@ -193,7 +190,6 @@ export interface EventMethods {
193
190
  onSourceBeforeMove?: CommonHandlers['VoidSourceMove'];
194
191
  onSourceBeforeSwitchIn?: (this: Battle, pokemon: Pokemon) => void;
195
192
  onSourceBeforeSwitchOut?: (this: Battle, pokemon: Pokemon) => void;
196
- onSourceBeforeTurn?: (this: Battle, pokemon: Pokemon) => void;
197
193
  onSourceBoost?: (this: Battle, boost: SparseBoostsTable, target: Pokemon, source: Pokemon, effect: Effect) => void;
198
194
  onSourceChargeMove?: CommonHandlers['VoidSourceMove'];
199
195
  onSourceCriticalHit?: ((this: Battle, pokemon: Pokemon, source: null, move: ActiveMove) => boolean | void) | boolean;
@@ -249,8 +245,6 @@ export interface EventMethods {
249
245
  onSourceTryMove?: MoveEventMethods['onTryMove'];
250
246
  onSourceTryPrimaryHit?: (this: Battle, target: Pokemon, source: Pokemon, move: ActiveMove) => boolean | null | number | void;
251
247
  onSourceType?: (this: Battle, types: string[], pokemon: Pokemon) => string[] | void;
252
- onSourceUpdate?: (this: Battle, pokemon: Pokemon) => void;
253
- onSourceWeather?: (this: Battle, target: Pokemon, source: null, effect: Condition) => void;
254
248
  onSourceWeatherModifyDamage?: CommonHandlers['ModifierSourceMove'];
255
249
  onSourceModifyDamagePhase1?: CommonHandlers['ModifierSourceMove'];
256
250
  onSourceModifyDamagePhase2?: CommonHandlers['ModifierSourceMove'];
@@ -274,7 +268,6 @@ export interface EventMethods {
274
268
  onAnyBeforeMove?: CommonHandlers['VoidSourceMove'];
275
269
  onAnyBeforeSwitchIn?: (this: Battle, pokemon: Pokemon) => void;
276
270
  onAnyBeforeSwitchOut?: (this: Battle, pokemon: Pokemon) => void;
277
- onAnyBeforeTurn?: (this: Battle, pokemon: Pokemon) => void;
278
271
  onAnyBoost?: (this: Battle, boost: SparseBoostsTable, target: Pokemon, source: Pokemon, effect: Effect) => void;
279
272
  onAnyChargeMove?: CommonHandlers['VoidSourceMove'];
280
273
  onAnyCriticalHit?: ((this: Battle, pokemon: Pokemon, source: null, move: ActiveMove) => boolean | void) | boolean;
@@ -331,8 +324,6 @@ export interface EventMethods {
331
324
  onAnyTryMove?: MoveEventMethods['onTryMove'];
332
325
  onAnyTryPrimaryHit?: (this: Battle, target: Pokemon, source: Pokemon, move: ActiveMove) => boolean | null | number | void;
333
326
  onAnyType?: (this: Battle, types: string[], pokemon: Pokemon) => string[] | void;
334
- onAnyUpdate?: (this: Battle, pokemon: Pokemon) => void;
335
- onAnyWeather?: (this: Battle, target: Pokemon, source: null, effect: Condition) => void;
336
327
  onAnyWeatherModifyDamage?: CommonHandlers['ModifierSourceMove'];
337
328
  onAnyModifyDamagePhase1?: CommonHandlers['ModifierSourceMove'];
338
329
  onAnyModifyDamagePhase2?: CommonHandlers['ModifierSourceMove'];
@@ -419,7 +410,6 @@ export interface PokemonEventMethods extends EventMethods {
419
410
  onAllyBeforeMove?: CommonHandlers['VoidSourceMove'];
420
411
  onAllyBeforeSwitchIn?: (this: Battle, pokemon: Pokemon) => void;
421
412
  onAllyBeforeSwitchOut?: (this: Battle, pokemon: Pokemon) => void;
422
- onAllyBeforeTurn?: (this: Battle, pokemon: Pokemon) => void;
423
413
  onAllyBoost?: (this: Battle, boost: SparseBoostsTable, target: Pokemon, source: Pokemon, effect: Effect) => void;
424
414
  onAllyChargeMove?: CommonHandlers['VoidSourceMove'];
425
415
  onAllyCriticalHit?: ((this: Battle, pokemon: Pokemon, source: null, move: ActiveMove) => boolean | void) | boolean;
@@ -476,8 +466,6 @@ export interface PokemonEventMethods extends EventMethods {
476
466
  onAllyTryMove?: MoveEventMethods['onTryMove'];
477
467
  onAllyTryPrimaryHit?: (this: Battle, target: Pokemon, source: Pokemon, move: ActiveMove) => boolean | null | number | void;
478
468
  onAllyType?: (this: Battle, types: string[], pokemon: Pokemon) => string[] | void;
479
- onAllyUpdate?: (this: Battle, pokemon: Pokemon) => void;
480
- onAllyWeather?: (this: Battle, target: Pokemon, source: null, effect: Condition) => void;
481
469
  onAllyWeatherModifyDamage?: CommonHandlers['ModifierSourceMove'];
482
470
  onAllyModifyDamagePhase1?: CommonHandlers['ModifierSourceMove'];
483
471
  onAllyModifyDamagePhase2?: CommonHandlers['ModifierSourceMove'];
@@ -120,7 +120,6 @@ export declare class Format extends BasicEffect implements Readonly<BasicEffect>
120
120
  readonly queue?: ModdedBattleQueue;
121
121
  readonly field?: ModdedField;
122
122
  readonly actions?: ModdedBattleActions;
123
- readonly cannotMega?: string[];
124
123
  readonly challengeShow?: boolean;
125
124
  readonly searchShow?: boolean;
126
125
  readonly threads?: string[];
@@ -95,6 +95,7 @@ export declare class Item extends BasicEffect implements Readonly<BasicEffect> {
95
95
  readonly onEat?: ((this: Battle, pokemon: Pokemon) => void) | false;
96
96
  readonly onPrimal?: (this: Battle, pokemon: Pokemon) => void;
97
97
  readonly onStart?: (this: Battle, target: Pokemon) => void;
98
+ readonly onEnd?: (this: Battle, target: Pokemon) => void;
98
99
  constructor(data: AnyObject);
99
100
  }
100
101
  export declare class DexItems {
@@ -3,7 +3,7 @@ import { DataMove, DexMoves } from './dex-moves';
3
3
  import { Item, DexItems } from './dex-items';
4
4
  import { Ability, DexAbilities } from './dex-abilities';
5
5
  import { Species, DexSpecies, DexLearnsets } from './dex-species';
6
- import { Format, DexFormats } from './dex-formats';
6
+ import { Format, DexFormats, RuleTable } from './dex-formats';
7
7
  import { AbilityData, AbilityText, ActiveMove, AnyObject, EffectData, FormatData, ID, ItemData, ItemText, LearnsetData, ModdedBattleScriptsData, Move, MoveData, MoveText, NatureData, SpeciesData, TypeData } from './exported-global-types';
8
8
  import * as Data from './dex-data';
9
9
  type DataType = 'Abilities' | 'Rulesets' | 'FormatsData' | 'Items' | 'Learnsets' | 'Moves' | 'Natures' | 'Pokedex' | 'Scripts' | 'Conditions' | 'TypeChart';
@@ -158,4 +158,4 @@ export declare namespace Dex {
158
158
  type SecondaryEffect = import('./dex-moves').SecondaryEffect;
159
159
  type RuleTable = import('./dex-formats').RuleTable;
160
160
  }
161
- export {};
161
+ export { RuleTable };
@@ -217,6 +217,7 @@ export interface ModdedBattleActions {
217
217
  runMegaEvo?: (this: BattleActions, pokemon: Pokemon) => boolean;
218
218
  runMove?: (this: BattleActions, moveOrMoveName: Move | string, pokemon: Pokemon, targetLoc: number, sourceEffect?: Effect | null, zMove?: string, externalMove?: boolean, maxMove?: string, originalTarget?: Pokemon) => void;
219
219
  runMoveEffects?: (this: BattleActions, damage: SpreadMoveDamage, targets: SpreadMoveTargets, source: Pokemon, move: ActiveMove, moveData: ActiveMove, isSecondary?: boolean, isSelf?: boolean) => SpreadMoveDamage;
220
+ runSwitch?: (this: BattleActions, pokemon: Pokemon) => boolean;
220
221
  runZPower?: (this: BattleActions, move: ActiveMove, pokemon: Pokemon) => void;
221
222
  secondaries?: (this: BattleActions, targets: SpreadMoveTargets, source: Pokemon, move: ActiveMove, moveData: ActiveMove, isSelf?: boolean) => void;
222
223
  selfDrops?: (this: BattleActions, targets: SpreadMoveTargets, source: Pokemon, move: ActiveMove, moveData: ActiveMove, isSecondary?: boolean) => void;
@@ -248,6 +249,7 @@ export interface ModdedBattlePokemon {
248
249
  clearBoosts?: (this: Pokemon) => void;
249
250
  calculateStat?: (this: Pokemon, statName: StatIDExceptHP, boost: number, modifier?: number) => number;
250
251
  cureStatus?: (this: Pokemon, silent?: boolean) => boolean;
252
+ deductPP?: (this: Pokemon, move: string | Move, amount?: number | null, target?: Pokemon | null | false) => number;
251
253
  eatItem?: (this: Pokemon, force?: boolean, source?: Pokemon, sourceEffect?: Effect) => boolean;
252
254
  formeChange?: (this: Pokemon, speciesId: string | Species, source: Effect, isPermanent?: boolean, message?: string) => boolean;
253
255
  getAbility?: (this: Pokemon) => Ability;
@@ -217,6 +217,7 @@ interface ModdedBattleActions {
217
217
  runMegaEvo?: (this: BattleActions, pokemon: Pokemon) => boolean;
218
218
  runMove?: (this: BattleActions, moveOrMoveName: Move | string, pokemon: Pokemon, targetLoc: number, sourceEffect?: Effect | null, zMove?: string, externalMove?: boolean, maxMove?: string, originalTarget?: Pokemon) => void;
219
219
  runMoveEffects?: (this: BattleActions, damage: SpreadMoveDamage, targets: SpreadMoveTargets, source: Pokemon, move: ActiveMove, moveData: ActiveMove, isSecondary?: boolean, isSelf?: boolean) => SpreadMoveDamage;
220
+ runSwitch?: (this: BattleActions, pokemon: Pokemon) => boolean;
220
221
  runZPower?: (this: BattleActions, move: ActiveMove, pokemon: Pokemon) => void;
221
222
  secondaries?: (this: BattleActions, targets: SpreadMoveTargets, source: Pokemon, move: ActiveMove, moveData: ActiveMove, isSelf?: boolean) => void;
222
223
  selfDrops?: (this: BattleActions, targets: SpreadMoveTargets, source: Pokemon, move: ActiveMove, moveData: ActiveMove, isSecondary?: boolean) => void;
@@ -248,6 +249,7 @@ interface ModdedBattlePokemon {
248
249
  clearBoosts?: (this: Pokemon) => void;
249
250
  calculateStat?: (this: Pokemon, statName: StatIDExceptHP, boost: number, modifier?: number) => number;
250
251
  cureStatus?: (this: Pokemon, silent?: boolean) => boolean;
252
+ deductPP?: (this: Pokemon, move: string | Move, amount?: number | null, target?: Pokemon | null | false) => number;
251
253
  eatItem?: (this: Pokemon, force?: boolean, source?: Pokemon, sourceEffect?: Effect) => boolean;
252
254
  formeChange?: (this: Pokemon, speciesId: string | Species, source: Effect, isPermanent?: boolean, message?: string) => boolean;
253
255
  getAbility?: (this: Pokemon) => Ability;
@@ -2,7 +2,7 @@ export { Battle } from './battle';
2
2
  export * as BattleStreams from './battle-stream';
3
3
  export * as Streams from '../lib/streams';
4
4
  export * from './state';
5
- export { Dex, toID, ModData } from './dex';
5
+ export { Dex, toID, ModData, RuleTable } from './dex';
6
6
  export { Pokemon } from './pokemon';
7
7
  export { PRNG } from './prng';
8
8
  export { RandomPlayerAI } from './tools/random-player-ai';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pkmn/sim",
3
- "version": "0.7.5",
3
+ "version": "0.7.6",
4
4
  "description": "An automatically generated extraction of just the simulator portion of Pokémon Showdown",
5
5
  "repository": "github:pkmn/ps",
6
6
  "homepage": "https://psim.us",
@@ -32,6 +32,7 @@
32
32
  "build": "node ../build",
33
33
  "test": "mocha test/main.js test/sim/*.js test/sim/**/*.js -R dot -u bdd --exit",
34
34
  "lint": "eslint . --cache --ext .js,.ts",
35
+ "prepare": "npm run build",
35
36
  "pretest": "npm run build -- --cjs",
36
37
  "posttest": "npm run lint"
37
38
  }