@pkmn/engine 0.1.0-dev.f918c3bd → 0.1.0-dev.fb6653d6
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.
- package/LICENSE +1 -3
- package/README.md +51 -23
- package/build/pkg/addon/browser.d.ts +3 -0
- package/build/pkg/addon/browser.js +44 -0
- package/build/pkg/addon/browser.js.map +1 -0
- package/build/pkg/addon/node.d.ts +3 -0
- package/build/pkg/addon/node.js +97 -0
- package/build/pkg/addon/node.js.map +1 -0
- package/build/pkg/addon/wasm.d.ts +2 -0
- package/build/pkg/addon/wasm.js +53 -0
- package/build/pkg/addon/wasm.js.map +1 -0
- package/build/pkg/addon.d.ts +25 -3
- package/build/pkg/addon.js +39 -71
- package/build/pkg/addon.js.map +1 -1
- package/build/pkg/data/ids.json +12 -12
- package/build/pkg/data/layout.json +17 -4
- package/build/pkg/data/protocol.json +23 -9
- package/build/pkg/data.d.ts +27 -5
- package/build/pkg/data.js.map +1 -1
- package/build/pkg/gen1.d.ts +13 -17
- package/build/pkg/gen1.js +8 -12
- package/build/pkg/gen1.js.map +1 -1
- package/build/pkg/index.d.ts +40 -91
- package/build/pkg/index.js +6 -63
- package/build/pkg/index.js.map +1 -1
- package/build/pkg/protocol.d.ts +20 -1
- package/build/pkg/protocol.js +109 -107
- package/build/pkg/protocol.js.map +1 -1
- package/build/tools/debug.js +36 -69
- package/build/tools/debug.js.map +1 -1
- package/build/tools/display/debug.jsx +141 -0
- package/build/tools/display/debug.jsx.map +1 -0
- package/build/tools/display/index.js +142 -0
- package/build/tools/display/index.js.map +1 -0
- package/build/tools/display/ui.jsx +349 -0
- package/build/tools/display/ui.jsx.map +1 -0
- package/build/tools/display/util.js +18 -0
- package/build/tools/display/util.js.map +1 -0
- package/build.zig +303 -101
- package/package.json +61 -132
- package/src/bin/install-pkmn-engine +30 -20
- package/src/bin/pkmn-debug +1 -1
- package/src/lib/{binding → bindings}/node.zig +8 -21
- package/src/lib/bindings/wasm.zig +58 -0
- package/src/lib/common/array.zig +77 -0
- package/src/lib/common/data.zig +8 -8
- package/src/lib/common/debug.zig +39 -8
- package/src/lib/common/js.zig +4 -2
- package/src/lib/common/optional.zig +21 -10
- package/src/lib/common/options.zig +6 -0
- package/src/lib/common/protocol.zig +421 -393
- package/src/lib/common/rational.zig +131 -35
- package/src/lib/common/rng.zig +16 -9
- package/src/lib/common/util.zig +50 -1
- package/src/lib/gen1/calc.zig +687 -160
- package/src/lib/gen1/chance.zig +434 -307
- package/src/lib/gen1/data/moves.zig +26 -14
- package/src/lib/gen1/data/species.zig +4 -6
- package/src/lib/gen1/data/types.zig +7 -8
- package/src/lib/gen1/data.zig +44 -47
- package/src/lib/gen1/helpers.zig +91 -562
- package/src/lib/gen1/mechanics.zig +641 -557
- package/src/lib/gen2/calc.zig +153 -0
- package/src/lib/gen2/chance.zig +902 -0
- package/src/lib/gen2/data/items.zig +13 -21
- package/src/lib/gen2/data/moves.zig +67 -47
- package/src/lib/gen2/data/species.zig +2 -4
- package/src/lib/gen2/data/types.zig +134 -32
- package/src/lib/gen2/data.zig +56 -54
- package/src/lib/gen2/generated.zig +801 -0
- package/src/lib/gen2/helpers.zig +46 -25
- package/src/lib/gen2/mechanics.zig +2778 -362
- package/src/lib/node.zig +18 -0
- package/src/lib/pkmn.zig +37 -15
- package/src/lib/wasm.zig +17 -0
- package/src/tools/display/dom.ts +96 -0
- package/src/tools/display/ui.css +354 -0
- package/build/test/display.js +0 -400
- package/build/test/display.js.map +0 -1
- package/src/lib/binding/wasm.zig +0 -12
- package/src/lib/gen1/README.md +0 -894
- package/src/lib/gen2/README.md +0 -328
- package/src/test/display/pkmn.html.tmpl +0 -368
package/build/pkg/index.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { BoostsTable, Generation, ID, PokemonSet, StatsTable, StatusName, TypeName } from '@pkmn/data';
|
|
2
|
-
|
|
3
|
-
export type Player = 'p1' | 'p2';
|
|
1
|
+
import { BoostID, BoostsTable, Generation, ID, PokemonSet, StatID, StatsTable, StatusName, TypeName } from '@pkmn/data';
|
|
2
|
+
import { Choice, Player, Result } from './common';
|
|
4
3
|
/** The one-indexed location of a player's Pokémon in battle. */
|
|
5
4
|
export type Slot = 1 | 2 | 3 | 4 | 5 | 6;
|
|
6
5
|
/** Representation of the entire state of a Pokémon battle. */
|
|
@@ -34,31 +33,25 @@ export interface API {
|
|
|
34
33
|
* soft-lock occurs).
|
|
35
34
|
*/
|
|
36
35
|
choices(player: Player, result: Result): Choice[];
|
|
37
|
-
/**
|
|
38
|
-
* Determines all possible choices for the `player` given the previous
|
|
39
|
-
* `result` of an {@link update} and calls a selection function `fn` with the
|
|
40
|
-
* number of possible choices `n`, returning the choice corresponding with the
|
|
41
|
-
* index it returns. `fn` must return an index in the range `[0, n)`.
|
|
42
|
-
*
|
|
43
|
-
* This function helps speed up MCTS-based agents which wish to avoid
|
|
44
|
-
* decoding/allocating `Choice` objects which they ignore. Most other use
|
|
45
|
-
* cases will likely be better served by the choices method.
|
|
46
|
-
*
|
|
47
|
-
* Note that the number of possible choices n passed to `fn` may be 0 as
|
|
48
|
-
* outlined above in {@link choices}.
|
|
49
|
-
*/
|
|
50
|
-
choose(player: Player, result: Result, fn: (n: number) => number): Choice;
|
|
51
36
|
/** Returns a copy of the Battle data. */
|
|
52
37
|
toJSON(): Data<Battle>;
|
|
53
38
|
}
|
|
54
|
-
/** Helper type removing
|
|
55
|
-
export type Data<T
|
|
39
|
+
/** Helper type removing function types from a data type `T`. */
|
|
40
|
+
export type Data<T> = T extends readonly any[] ? {
|
|
41
|
+
[K in keyof T]: Data<T[K]>;
|
|
42
|
+
} : T extends Iterable<infer U> ? (U extends object ? Iterable<Data<U>> : T) : T extends object ? {
|
|
43
|
+
[K in keyof T as T[K] extends Function ? never : K]: Data<T[K]>;
|
|
44
|
+
} : T;
|
|
56
45
|
/** Type definitions for Generation I Pokémon data relevant in a battle. */
|
|
57
46
|
export declare namespace Gen1 {
|
|
58
47
|
/** Representation of the entire state of a Generation I Pokémon battle. */
|
|
59
48
|
interface Battle extends API {
|
|
60
49
|
/** The sides involved in the battle. */
|
|
61
50
|
sides: Iterable<Side>;
|
|
51
|
+
/** Returns the side of the `player`. */
|
|
52
|
+
side(player: Player): Side;
|
|
53
|
+
/** Returns the opposing side to `player`. */
|
|
54
|
+
foe(player: Player): Side;
|
|
62
55
|
/** The battle's current turn number. */
|
|
63
56
|
turn: number;
|
|
64
57
|
/** The last damage dealt by either side. */
|
|
@@ -84,6 +77,16 @@ export declare namespace Gen1 {
|
|
|
84
77
|
* the effect switching would have on its original order).
|
|
85
78
|
*/
|
|
86
79
|
pokemon: Iterable<Pokemon>;
|
|
80
|
+
/**
|
|
81
|
+
* Returns the current slot of the Pokémon that started the battle at index
|
|
82
|
+
* `id`, or undefined if the index is invalid.
|
|
83
|
+
*/
|
|
84
|
+
slot(id: number): Slot | undefined;
|
|
85
|
+
/**
|
|
86
|
+
* Returns the Pokémon currently at the provided `slot`, or undefined if
|
|
87
|
+
* nothing occupies the slot.
|
|
88
|
+
*/
|
|
89
|
+
get(slot: Slot): Pokemon | undefined;
|
|
87
90
|
/** The last move the player used. */
|
|
88
91
|
lastUsedMove: ID | undefined;
|
|
89
92
|
/** The last move the player selected. */
|
|
@@ -127,13 +130,19 @@ export declare namespace Gen1 {
|
|
|
127
130
|
* boosts/status/etc (and which may differ from its original stored stats).
|
|
128
131
|
*/
|
|
129
132
|
stats: StatsTable;
|
|
133
|
+
/** Returns the value Pokémon's current `stat`. */
|
|
134
|
+
stat(stat: StatID | 'spc'): number;
|
|
130
135
|
/** The Pokémon's current boosts. */
|
|
131
136
|
boosts: BoostsTable;
|
|
137
|
+
/** Returns the value Pokémon's current `boost`. */
|
|
138
|
+
boost(boost: BoostID): number;
|
|
132
139
|
/**
|
|
133
140
|
* The Pokémon's move slots (which may differ from its original stored
|
|
134
141
|
* moves).
|
|
135
142
|
*/
|
|
136
143
|
moves: Iterable<MoveSlot>;
|
|
144
|
+
/** The Pokémon's current move at `slot`, or undefined if absent. */
|
|
145
|
+
move(slot: 1 | 2 | 3 | 4): MoveSlot | undefined;
|
|
137
146
|
/** The Pokémon's volatiles statuses. */
|
|
138
147
|
volatiles: Volatiles;
|
|
139
148
|
stored: {
|
|
@@ -143,8 +152,12 @@ export declare namespace Gen1 {
|
|
|
143
152
|
types: readonly [TypeName, TypeName];
|
|
144
153
|
/** The Pokémon original unmodified stats. */
|
|
145
154
|
stats: StatsTable;
|
|
155
|
+
/** Returns the value Pokémon's original `stat`. */
|
|
156
|
+
stat(stat: StatID | 'spc'): number;
|
|
146
157
|
/** The Pokémon's original move slots. */
|
|
147
158
|
moves: Iterable<Omit<MoveSlot, 'disabled'>>;
|
|
159
|
+
/** The Pokémon's original move at `slot`, or undefined if absent. */
|
|
160
|
+
move(slot: 1 | 2 | 3 | 4): Omit<MoveSlot, 'disabled'> | undefined;
|
|
148
161
|
};
|
|
149
162
|
/** The current one-indexed position of this Pokémon in the party. */
|
|
150
163
|
position: Slot;
|
|
@@ -242,6 +255,8 @@ export type CreateOptions = {
|
|
|
242
255
|
* that the engine be built in a specific compatibility mode).
|
|
243
256
|
*/
|
|
244
257
|
showdown?: boolean;
|
|
258
|
+
/** Whether the battle should be initialized without functionality afforded by native code. */
|
|
259
|
+
inert?: true;
|
|
245
260
|
} & ({
|
|
246
261
|
/** Player 1's options. */
|
|
247
262
|
p1: PlayerOptions;
|
|
@@ -302,40 +317,6 @@ export interface PlayerOptions {
|
|
|
302
317
|
/** The player's team. */
|
|
303
318
|
team: Partial<PokemonSet>[];
|
|
304
319
|
}
|
|
305
|
-
/** A choice made by a player during battle. */
|
|
306
|
-
export interface Choice {
|
|
307
|
-
/** The choice type. */
|
|
308
|
-
type: 'pass' | 'move' | 'switch';
|
|
309
|
-
/**
|
|
310
|
-
* The choice data:
|
|
311
|
-
*
|
|
312
|
-
* - 0 for 'pass'
|
|
313
|
-
* - 0-4 for 'move'
|
|
314
|
-
* - 2-6 for 'switch'
|
|
315
|
-
*/
|
|
316
|
-
data: number;
|
|
317
|
-
}
|
|
318
|
-
/**
|
|
319
|
-
* The result of the battle - all defined results should be considered terminal.
|
|
320
|
-
*/
|
|
321
|
-
export interface Result {
|
|
322
|
-
/**
|
|
323
|
-
* The type of result from the perspective of Player 1:
|
|
324
|
-
*
|
|
325
|
-
* - undefined: no result, battle is non-terminal
|
|
326
|
-
* - win: Player 1 wins
|
|
327
|
-
* - lose: Player 2 wins
|
|
328
|
-
* - tie: Player 1 & 2 tie
|
|
329
|
-
* - error: the battle has terminated in error (e.g. due to a desync)
|
|
330
|
-
*
|
|
331
|
-
* 'error' is not possible when in Pokémon Showdown compatibility mode.
|
|
332
|
-
*/
|
|
333
|
-
type: undefined | 'win' | 'lose' | 'tie' | 'error';
|
|
334
|
-
/** The choice type of the result for Player 1. */
|
|
335
|
-
p1: Choice['type'];
|
|
336
|
-
/** The choice type of the result for Player 2. */
|
|
337
|
-
p2: Choice['type'];
|
|
338
|
-
}
|
|
339
320
|
/** Factory for creating Battle objects. */
|
|
340
321
|
export declare const Battle: {
|
|
341
322
|
/** Create a `Battle` in the given generation with the provided options. */
|
|
@@ -344,43 +325,11 @@ export declare const Battle: {
|
|
|
344
325
|
* Restore a (possibly in-progress) `Battle` in the given generation with the
|
|
345
326
|
* provided options.
|
|
346
327
|
*/
|
|
347
|
-
restore(gen: Generation, battle: Battle
|
|
328
|
+
restore(gen: Generation, battle: Data<Battle>, options: RestoreOptions): Battle;
|
|
348
329
|
};
|
|
349
|
-
|
|
350
|
-
export
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
readonly type: "pass";
|
|
355
|
-
readonly data: 0;
|
|
356
|
-
};
|
|
357
|
-
protected static MATCH: RegExp;
|
|
358
|
-
private constructor();
|
|
359
|
-
/** Decode a choice from its binary representation. */
|
|
360
|
-
static decode(byte: number): Choice;
|
|
361
|
-
/** Encode a choice to its binary representation. */
|
|
362
|
-
static encode(choice?: Choice): number;
|
|
363
|
-
/**
|
|
364
|
-
* Parse a Pokémon Showdown choice string into a `Choice`.
|
|
365
|
-
* Only numeric choice data is supported.
|
|
366
|
-
*/
|
|
367
|
-
static parse(choice: string): Choice;
|
|
368
|
-
/** Formats a `Choice` into a Pokémon Showdown compatible choice string. */
|
|
369
|
-
static format(choice: Choice): string;
|
|
370
|
-
/** Returns the "pass" `Choice`. */
|
|
371
|
-
static pass(): Choice;
|
|
372
|
-
/** Returns a "move" `Choice` with the provided data. */
|
|
373
|
-
static move(data: 0 | 1 | 2 | 3 | 4): Choice;
|
|
374
|
-
/** Returns a "switch" `Choice` with the provided data. */
|
|
375
|
-
static switch(data: 2 | 3 | 4 | 5 | 6): Choice;
|
|
376
|
-
}
|
|
377
|
-
/** Utilities for working with `Result` objects */
|
|
378
|
-
export declare class Result {
|
|
379
|
-
/** All valid result types. */
|
|
380
|
-
static Types: readonly [undefined, "win", "lose", "tie", "error"];
|
|
381
|
-
private constructor();
|
|
382
|
-
/** Decode a `Result` from its binary representation. */
|
|
383
|
-
static decode(byte: number): Result;
|
|
384
|
-
}
|
|
385
|
-
export { ParsedLine, Info, SideInfo, PokemonInfo, Log } from './protocol';
|
|
330
|
+
export { initialize } from './addon';
|
|
331
|
+
export { Choice, Result } from './common';
|
|
332
|
+
export type { Player } from './common';
|
|
333
|
+
export type { ParsedLine, PokemonInfo } from './protocol';
|
|
334
|
+
export { Info, SideInfo, Log } from './protocol';
|
|
386
335
|
export { Lookup } from './data';
|
package/build/pkg/index.js
CHANGED
|
@@ -23,7 +23,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.Lookup = exports.Log = exports.SideInfo = exports.Info = exports.Result = exports.Choice = exports.Battle = void 0;
|
|
26
|
+
exports.Lookup = exports.Log = exports.SideInfo = exports.Info = exports.Result = exports.Choice = exports.initialize = exports.Battle = void 0;
|
|
27
27
|
const addon = __importStar(require("./addon"));
|
|
28
28
|
const data_1 = require("./data");
|
|
29
29
|
const gen1 = __importStar(require("./gen1"));
|
|
@@ -51,68 +51,11 @@ exports.Battle = new class {
|
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
53
|
};
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
static MATCH = /^(?:(pass)|((move) ([0-4]))|((switch) ([2-6])))$/;
|
|
60
|
-
constructor() { }
|
|
61
|
-
/** Decode a choice from its binary representation. */
|
|
62
|
-
static decode(byte) {
|
|
63
|
-
return { type: Choice.Types[byte & 0b11], data: byte >> 2 };
|
|
64
|
-
}
|
|
65
|
-
/** Encode a choice to its binary representation. */
|
|
66
|
-
static encode(choice) {
|
|
67
|
-
return (choice
|
|
68
|
-
? (choice.data << 2 | (choice.type === 'pass' ? 0 : choice.type === 'move' ? 1 : 2))
|
|
69
|
-
: 0);
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* Parse a Pokémon Showdown choice string into a `Choice`.
|
|
73
|
-
* Only numeric choice data is supported.
|
|
74
|
-
*/
|
|
75
|
-
static parse(choice) {
|
|
76
|
-
const m = Choice.MATCH.exec(choice);
|
|
77
|
-
if (!m)
|
|
78
|
-
throw new Error(`Invalid choice: '${choice}'`);
|
|
79
|
-
const type = (m[1] ?? m[3] ?? m[6]);
|
|
80
|
-
const data = +(m[4] ?? m[7] ?? 0);
|
|
81
|
-
return { type, data };
|
|
82
|
-
}
|
|
83
|
-
/** Formats a `Choice` into a Pokémon Showdown compatible choice string. */
|
|
84
|
-
static format(choice) {
|
|
85
|
-
return choice.type === 'pass' ? choice.type : `${choice.type} ${choice.data}`;
|
|
86
|
-
}
|
|
87
|
-
/** Returns the "pass" `Choice`. */
|
|
88
|
-
static pass() {
|
|
89
|
-
return Choice.PASS;
|
|
90
|
-
}
|
|
91
|
-
/** Returns a "move" `Choice` with the provided data. */
|
|
92
|
-
static move(data) {
|
|
93
|
-
return { type: 'move', data };
|
|
94
|
-
}
|
|
95
|
-
/** Returns a "switch" `Choice` with the provided data. */
|
|
96
|
-
static switch(data) {
|
|
97
|
-
return { type: 'switch', data };
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
exports.Choice = Choice;
|
|
101
|
-
/** Utilities for working with `Result` objects */
|
|
102
|
-
class Result {
|
|
103
|
-
/** All valid result types. */
|
|
104
|
-
static Types = [undefined, 'win', 'lose', 'tie', 'error'];
|
|
105
|
-
constructor() { }
|
|
106
|
-
/** Decode a `Result` from its binary representation. */
|
|
107
|
-
static decode(byte) {
|
|
108
|
-
return {
|
|
109
|
-
type: Result.Types[byte & 0b1111],
|
|
110
|
-
p1: Choice.Types[(byte >> 4) & 0b11],
|
|
111
|
-
p2: Choice.Types[byte >> 6],
|
|
112
|
-
};
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
exports.Result = Result;
|
|
54
|
+
var addon_1 = require("./addon");
|
|
55
|
+
Object.defineProperty(exports, "initialize", { enumerable: true, get: function () { return addon_1.initialize; } });
|
|
56
|
+
var common_1 = require("./common");
|
|
57
|
+
Object.defineProperty(exports, "Choice", { enumerable: true, get: function () { return common_1.Choice; } });
|
|
58
|
+
Object.defineProperty(exports, "Result", { enumerable: true, get: function () { return common_1.Result; } });
|
|
116
59
|
var protocol_1 = require("./protocol");
|
|
117
60
|
Object.defineProperty(exports, "Info", { enumerable: true, get: function () { return protocol_1.Info; } });
|
|
118
61
|
Object.defineProperty(exports, "SideInfo", { enumerable: true, get: function () { return protocol_1.SideInfo; } });
|
package/build/pkg/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/pkg/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,+CAAiC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/pkg/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,+CAAiC;AAEjC,iCAA8B;AAC9B,6CAA+B;AA2U/B,2CAA2C;AAC9B,QAAA,MAAM,GAAG,IAAI;IACxB,2EAA2E;IAC3E,MAAM,CAAC,GAAe,EAAE,OAAsB;QAC5C,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;QAChC,MAAM,MAAM,GAAG,aAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAC/B,QAAQ,GAAG,CAAC,GAAG,EAAE,CAAC;YAChB,KAAK,CAAC,CAAC,CAAC,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;YACxD,OAAO,CAAC,CAAC,MAAM,IAAI,KAAK,CAAC,mBAAmB,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC;QACzD,CAAC;IACH,CAAC;IAED;;;OAGG;IACH,OAAO,CAAC,GAAe,EAAE,MAAoB,EAAE,OAAuB;QACpE,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;QAChC,MAAM,MAAM,GAAG,aAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAC/B,QAAQ,GAAG,CAAC,GAAG,EAAE,CAAC;YAChB,KAAK,CAAC,CAAC,CAAC,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;YACjE,OAAO,CAAC,CAAC,MAAM,IAAI,KAAK,CAAC,mBAAmB,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC;QACzD,CAAC;IACH,CAAC;CACF,CAAC;AAEF,iCAAmC;AAA3B,mGAAA,UAAU,OAAA;AAClB,mCAAwC;AAAhC,gGAAA,MAAM,OAAA;AAAE,gGAAA,MAAM,OAAA;AAGtB,uCAA+C;AAAvC,gGAAA,IAAI,OAAA;AAAE,oGAAA,QAAQ,OAAA;AAAE,+FAAA,GAAG,OAAA;AAC3B,+BAA8B;AAAtB,8FAAA,MAAM,OAAA"}
|
package/build/pkg/protocol.d.ts
CHANGED
|
@@ -1,7 +1,25 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { GenderName, GenerationNum, ID, MoveName, SpeciesName, StatusName, TypeName } from '@pkmn/data';
|
|
2
2
|
import { Protocol } from '@pkmn/protocol';
|
|
3
3
|
import { Lookup } from './data';
|
|
4
4
|
import { PlayerOptions } from '.';
|
|
5
|
+
interface Generation {
|
|
6
|
+
num: GenerationNum;
|
|
7
|
+
species: {
|
|
8
|
+
get(id: ID): {
|
|
9
|
+
name: SpeciesName;
|
|
10
|
+
genderRatio: {
|
|
11
|
+
M: number;
|
|
12
|
+
F: number;
|
|
13
|
+
};
|
|
14
|
+
gender?: GenderName;
|
|
15
|
+
} | undefined;
|
|
16
|
+
};
|
|
17
|
+
moves: {
|
|
18
|
+
get(id: ID): {
|
|
19
|
+
name: MoveName;
|
|
20
|
+
} | undefined;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
5
23
|
/** A message logged by the engine parsed into Pokémon Showdown's protocol. */
|
|
6
24
|
export interface ParsedLine {
|
|
7
25
|
/** Positional protocol arguments. */
|
|
@@ -71,3 +89,4 @@ export declare function decodeIdentRaw(byte: number): {
|
|
|
71
89
|
};
|
|
72
90
|
export declare function decodeStatus(val: number): StatusName | undefined;
|
|
73
91
|
export declare function decodeTypes(lookup: Lookup, val: number): readonly [TypeName, TypeName];
|
|
92
|
+
export {};
|