@pkmn/sim 0.7.17 → 0.7.18

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 (94) hide show
  1. package/build/cjs/data/abilities.js +21 -21
  2. package/build/cjs/data/abilities.js.map +1 -1
  3. package/build/cjs/data/aliases.js +3 -0
  4. package/build/cjs/data/aliases.js.map +1 -1
  5. package/build/cjs/data/formats-data.js +3 -3
  6. package/build/cjs/data/formats-data.js.map +1 -1
  7. package/build/cjs/data/items.js +6 -8
  8. package/build/cjs/data/items.js.map +1 -1
  9. package/build/cjs/data/learnsets.js +3 -3
  10. package/build/cjs/data/learnsets.js.map +1 -1
  11. package/build/cjs/data/mods/gen1/moves.js +1 -1
  12. package/build/cjs/data/mods/gen1/moves.js.map +1 -1
  13. package/build/cjs/data/mods/gen1/scripts.js +1 -1
  14. package/build/cjs/data/mods/gen1/scripts.js.map +1 -1
  15. package/build/cjs/data/mods/gen2/moves.js +1 -1
  16. package/build/cjs/data/mods/gen2/moves.js.map +1 -1
  17. package/build/cjs/data/mods/gen4/moves.js +1 -1
  18. package/build/cjs/data/mods/gen4/moves.js.map +1 -1
  19. package/build/cjs/data/mods/gen7/abilities.js +4 -4
  20. package/build/cjs/data/mods/gen7/abilities.js.map +1 -1
  21. package/build/cjs/data/moves.js +4 -4
  22. package/build/cjs/data/moves.js.map +1 -1
  23. package/build/cjs/data/pokedex.js +11 -11
  24. package/build/cjs/data/pokedex.js.map +1 -1
  25. package/build/cjs/sim/battle.js +4 -2
  26. package/build/cjs/sim/battle.js.map +1 -1
  27. package/build/cjs/sim/dex-conditions.js.map +1 -1
  28. package/build/cjs/sim/dex.js +0 -1
  29. package/build/cjs/sim/dex.js.map +1 -1
  30. package/build/cjs/sim/pokemon.js +12 -8
  31. package/build/cjs/sim/pokemon.js.map +1 -1
  32. package/build/esm/data/abilities.mjs +21 -21
  33. package/build/esm/data/abilities.mjs.map +1 -1
  34. package/build/esm/data/aliases.mjs +3 -0
  35. package/build/esm/data/aliases.mjs.map +1 -1
  36. package/build/esm/data/formats-data.mjs +3 -3
  37. package/build/esm/data/formats-data.mjs.map +1 -1
  38. package/build/esm/data/index.mjs +11 -11
  39. package/build/esm/data/items.mjs +6 -8
  40. package/build/esm/data/items.mjs.map +1 -1
  41. package/build/esm/data/learnsets.mjs +3 -3
  42. package/build/esm/data/learnsets.mjs.map +1 -1
  43. package/build/esm/data/mods/gen1/index.mjs +7 -7
  44. package/build/esm/data/mods/gen1/moves.mjs +1 -1
  45. package/build/esm/data/mods/gen1/moves.mjs.map +1 -1
  46. package/build/esm/data/mods/gen1/scripts.mjs +1 -1
  47. package/build/esm/data/mods/gen1/scripts.mjs.map +1 -1
  48. package/build/esm/data/mods/gen2/index.mjs +8 -8
  49. package/build/esm/data/mods/gen2/moves.mjs +1 -1
  50. package/build/esm/data/mods/gen2/moves.mjs.map +1 -1
  51. package/build/esm/data/mods/gen3/index.mjs +7 -7
  52. package/build/esm/data/mods/gen4/index.mjs +8 -8
  53. package/build/esm/data/mods/gen4/moves.mjs +1 -1
  54. package/build/esm/data/mods/gen4/moves.mjs.map +1 -1
  55. package/build/esm/data/mods/gen5/index.mjs +9 -9
  56. package/build/esm/data/mods/gen6/index.mjs +8 -8
  57. package/build/esm/data/mods/gen7/abilities.mjs +4 -4
  58. package/build/esm/data/mods/gen7/abilities.mjs.map +1 -1
  59. package/build/esm/data/mods/gen7/index.mjs +7 -7
  60. package/build/esm/data/mods/gen8/index.mjs +7 -7
  61. package/build/esm/data/moves.mjs +4 -4
  62. package/build/esm/data/moves.mjs.map +1 -1
  63. package/build/esm/data/pokedex.mjs +11 -11
  64. package/build/esm/data/pokedex.mjs.map +1 -1
  65. package/build/esm/lib/index.mjs +2 -2
  66. package/build/esm/sim/battle-actions.mjs +1 -1
  67. package/build/esm/sim/battle-stream.mjs +3 -3
  68. package/build/esm/sim/battle.mjs +14 -12
  69. package/build/esm/sim/battle.mjs.map +1 -1
  70. package/build/esm/sim/dex-abilities.mjs +1 -1
  71. package/build/esm/sim/dex-conditions.mjs +1 -1
  72. package/build/esm/sim/dex-conditions.mjs.map +1 -1
  73. package/build/esm/sim/dex-data.mjs +1 -1
  74. package/build/esm/sim/dex-formats.mjs +4 -4
  75. package/build/esm/sim/dex-items.mjs +1 -1
  76. package/build/esm/sim/dex-moves.mjs +2 -2
  77. package/build/esm/sim/dex-species.mjs +1 -1
  78. package/build/esm/sim/dex.mjs +30 -31
  79. package/build/esm/sim/dex.mjs.map +1 -1
  80. package/build/esm/sim/field.mjs +2 -2
  81. package/build/esm/sim/index.mjs +13 -13
  82. package/build/esm/sim/pokemon.mjs +14 -10
  83. package/build/esm/sim/pokemon.mjs.map +1 -1
  84. package/build/esm/sim/side.mjs +4 -4
  85. package/build/esm/sim/state.mjs +6 -6
  86. package/build/esm/sim/team-validator.mjs +5 -5
  87. package/build/esm/sim/teams.mjs +1 -1
  88. package/build/esm/sim/tools/exhaustive-runner.mjs +4 -4
  89. package/build/esm/sim/tools/index.mjs +2 -2
  90. package/build/esm/sim/tools/random-player-ai.mjs +2 -2
  91. package/build/esm/sim/tools/runner.mjs +6 -6
  92. package/build/types/sim/dex-conditions.d.ts +7 -6
  93. package/build/types/sim/pokemon.d.ts +1 -0
  94. package/package.json +1 -1
@@ -18,10 +18,10 @@
18
18
  *
19
19
  * @license MIT
20
20
  */
21
- import { Utils } from '../lib';
22
- import { Pokemon } from './pokemon';
23
- import { State } from './state';
24
- import { toID } from './dex';
21
+ import { Utils } from '../lib/index.mjs';
22
+ import { Pokemon } from './pokemon.mjs';
23
+ import { State } from './state.mjs';
24
+ import { toID } from './dex.mjs';
25
25
  export class Side {
26
26
  constructor(name, battle, sideNum, team) {
27
27
  this.foe = null; // set in battle.start()
@@ -8,12 +8,12 @@
8
8
  *
9
9
  * @license MIT
10
10
  */
11
- import { Battle } from './battle';
12
- import { Dex } from './dex';
13
- import { Field } from './field';
14
- import { Pokemon } from './pokemon';
15
- import { PRNG } from './prng';
16
- import { Side } from './side';
11
+ import { Battle } from './battle.mjs';
12
+ import { Dex } from './dex.mjs';
13
+ import { Field } from './field.mjs';
14
+ import { Pokemon } from './pokemon.mjs';
15
+ import { PRNG } from './prng.mjs';
16
+ import { Side } from './side.mjs';
17
17
  // The simulator supports up to 24 different Pokemon on a team. Serialization
18
18
  // uses letters instead of numbers to indicate indices/positions, but where
19
19
  // the simulator only gives a position to active Pokemon, serialization
@@ -6,11 +6,11 @@
6
6
  *
7
7
  * @license MIT
8
8
  */
9
- import { Dex, toID } from './dex';
10
- import { Utils } from '../lib';
11
- import { Tags } from '../data/tags';
12
- import { Teams } from './teams';
13
- import { PRNG } from './prng';
9
+ import { Dex, toID } from './dex.mjs';
10
+ import { Utils } from '../lib/index.mjs';
11
+ import { Tags } from '../data/tags.mjs';
12
+ import { Teams } from './teams.mjs';
13
+ import { PRNG } from './prng.mjs';
14
14
  /**
15
15
  * Represents a set of possible ways to get a Pokémon with a given
16
16
  * set.
@@ -1,5 +1,5 @@
1
1
  import * as pkmn from '@pkmn/sets';
2
- import { Dex } from './dex';
2
+ import { Dex } from './dex.mjs';
3
3
  // eslint-disable-next-line no-var
4
4
  var teamGeneratorFactory;
5
5
  export const Teams = new class Teams {
@@ -1,7 +1,7 @@
1
- import { Dex, toID } from '../dex';
2
- import { PRNG } from '../prng';
3
- import { RandomPlayerAI } from './random-player-ai';
4
- import { Runner } from './runner';
1
+ import { Dex, toID } from '../dex.mjs';
2
+ import { PRNG } from '../prng.mjs';
3
+ import { RandomPlayerAI } from './random-player-ai.mjs';
4
+ import { Runner } from './runner.mjs';
5
5
  export class ExhaustiveRunner {
6
6
  constructor(options) {
7
7
  this.format = options.format;
@@ -1,3 +1,3 @@
1
- export * from './exhaustive-runner';
2
- export * from './runner';
1
+ export * from './exhaustive-runner.mjs';
2
+ export * from './runner.mjs';
3
3
  //# sourceMappingURL=index.mjs.map
@@ -1,5 +1,5 @@
1
- import { BattlePlayer } from '../battle-stream';
2
- import { PRNG } from '../prng';
1
+ import { BattlePlayer } from '../battle-stream.mjs';
2
+ import { PRNG } from '../prng.mjs';
3
3
  export class RandomPlayerAI extends BattlePlayer {
4
4
  constructor(playerStream, options = {}, debug = false) {
5
5
  super(playerStream, debug);
@@ -6,12 +6,12 @@
6
6
  */
7
7
  import { strict as assert } from 'assert';
8
8
  import * as fs from 'fs';
9
- import { Dex } from '..';
10
- import { Battle } from '../battle';
11
- import * as BattleStreams from '../battle-stream';
12
- import { State } from '../state';
13
- import { PRNG } from '../prng';
14
- import { RandomPlayerAI } from './random-player-ai';
9
+ import { Dex } from '../index.mjs';
10
+ import { Battle } from '../battle.mjs';
11
+ import * as BattleStreams from '../battle-stream.mjs';
12
+ import { State } from '../state.mjs';
13
+ import { PRNG } from '../prng.mjs';
14
+ import { RandomPlayerAI } from './random-player-ai.mjs';
15
15
  export class Runner {
16
16
  constructor(options) {
17
17
  this.format = options.format;
@@ -27,7 +27,8 @@ export interface EventMethods {
27
27
  onBeforeSwitchIn?: (this: Battle, pokemon: Pokemon) => void;
28
28
  onBeforeSwitchOut?: (this: Battle, pokemon: Pokemon) => void;
29
29
  onBeforeTurn?: (this: Battle, pokemon: Pokemon) => void;
30
- onBoost?: (this: Battle, boost: SparseBoostsTable, target: Pokemon, source: Pokemon, effect: Effect) => void;
30
+ onChangeBoost?: (this: Battle, boost: SparseBoostsTable, target: Pokemon, source: Pokemon, effect: Effect) => void;
31
+ onTryBoost?: (this: Battle, boost: SparseBoostsTable, target: Pokemon, source: Pokemon, effect: Effect) => void;
31
32
  onChargeMove?: CommonHandlers['VoidSourceMove'];
32
33
  onCriticalHit?: ((this: Battle, pokemon: Pokemon, source: null, move: ActiveMove) => boolean | void) | boolean;
33
34
  onDamage?: (this: Battle, damage: number, target: Pokemon, source: Pokemon, effect: Effect) => number | boolean | null | void;
@@ -112,7 +113,7 @@ export interface EventMethods {
112
113
  onFoeBeforeMove?: CommonHandlers['VoidSourceMove'];
113
114
  onFoeBeforeSwitchIn?: (this: Battle, pokemon: Pokemon) => void;
114
115
  onFoeBeforeSwitchOut?: (this: Battle, pokemon: Pokemon) => void;
115
- onFoeBoost?: (this: Battle, boost: SparseBoostsTable, target: Pokemon, source: Pokemon, effect: Effect) => void;
116
+ onFoeTryBoost?: (this: Battle, boost: SparseBoostsTable, target: Pokemon, source: Pokemon, effect: Effect) => void;
116
117
  onFoeChargeMove?: CommonHandlers['VoidSourceMove'];
117
118
  onFoeCriticalHit?: ((this: Battle, pokemon: Pokemon, source: null, move: ActiveMove) => boolean | void) | boolean;
118
119
  onFoeDamage?: (this: Battle, damage: number, target: Pokemon, source: Pokemon, effect: Effect) => number | boolean | null | void;
@@ -190,7 +191,7 @@ export interface EventMethods {
190
191
  onSourceBeforeMove?: CommonHandlers['VoidSourceMove'];
191
192
  onSourceBeforeSwitchIn?: (this: Battle, pokemon: Pokemon) => void;
192
193
  onSourceBeforeSwitchOut?: (this: Battle, pokemon: Pokemon) => void;
193
- onSourceBoost?: (this: Battle, boost: SparseBoostsTable, target: Pokemon, source: Pokemon, effect: Effect) => void;
194
+ onSourceTryBoost?: (this: Battle, boost: SparseBoostsTable, target: Pokemon, source: Pokemon, effect: Effect) => void;
194
195
  onSourceChargeMove?: CommonHandlers['VoidSourceMove'];
195
196
  onSourceCriticalHit?: ((this: Battle, pokemon: Pokemon, source: null, move: ActiveMove) => boolean | void) | boolean;
196
197
  onSourceDamage?: (this: Battle, damage: number, target: Pokemon, source: Pokemon, effect: Effect) => number | boolean | null | void;
@@ -268,7 +269,7 @@ export interface EventMethods {
268
269
  onAnyBeforeMove?: CommonHandlers['VoidSourceMove'];
269
270
  onAnyBeforeSwitchIn?: (this: Battle, pokemon: Pokemon) => void;
270
271
  onAnyBeforeSwitchOut?: (this: Battle, pokemon: Pokemon) => void;
271
- onAnyBoost?: (this: Battle, boost: SparseBoostsTable, target: Pokemon, source: Pokemon, effect: Effect) => void;
272
+ onAnyTryBoost?: (this: Battle, boost: SparseBoostsTable, target: Pokemon, source: Pokemon, effect: Effect) => void;
272
273
  onAnyChargeMove?: CommonHandlers['VoidSourceMove'];
273
274
  onAnyCriticalHit?: ((this: Battle, pokemon: Pokemon, source: null, move: ActiveMove) => boolean | void) | boolean;
274
275
  onAnyDamage?: (this: Battle, damage: number, target: Pokemon, source: Pokemon, effect: Effect) => number | boolean | null | void;
@@ -346,7 +347,7 @@ export interface EventMethods {
346
347
  onBasePowerPriority?: number;
347
348
  onBeforeMovePriority?: number;
348
349
  onBeforeSwitchOutPriority?: number;
349
- onBoostPriority?: number;
350
+ onChangeBoostPriority?: number;
350
351
  onDamagePriority?: number;
351
352
  onDragOutPriority?: number;
352
353
  onEffectivenessPriority?: number;
@@ -410,7 +411,7 @@ export interface PokemonEventMethods extends EventMethods {
410
411
  onAllyBeforeMove?: CommonHandlers['VoidSourceMove'];
411
412
  onAllyBeforeSwitchIn?: (this: Battle, pokemon: Pokemon) => void;
412
413
  onAllyBeforeSwitchOut?: (this: Battle, pokemon: Pokemon) => void;
413
- onAllyBoost?: (this: Battle, boost: SparseBoostsTable, target: Pokemon, source: Pokemon, effect: Effect) => void;
414
+ onAllyTryBoost?: (this: Battle, boost: SparseBoostsTable, target: Pokemon, source: Pokemon, effect: Effect) => void;
414
415
  onAllyChargeMove?: CommonHandlers['VoidSourceMove'];
415
416
  onAllyCriticalHit?: ((this: Battle, pokemon: Pokemon, source: null, move: ActiveMove) => boolean | void) | boolean;
416
417
  onAllyDamage?: (this: Battle, damage: number, target: Pokemon, source: Pokemon, effect: Effect) => number | boolean | null | void;
@@ -327,6 +327,7 @@ export declare class Pokemon {
327
327
  getSwitchRequestData(forAlly?: boolean): AnyObject;
328
328
  isLastActive(): boolean;
329
329
  positiveBoosts(): number;
330
+ getCappedBoost(boosts: SparseBoostsTable): Partial<BoostsTable>;
330
331
  boostBy(boosts: SparseBoostsTable): number;
331
332
  clearBoosts(): void;
332
333
  setBoost(boosts: SparseBoostsTable): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pkmn/sim",
3
- "version": "0.7.17",
3
+ "version": "0.7.18",
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",