@pkmn/engine 0.1.0-dev.d4119c62 → 0.1.0-dev.d4bd80b1
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 +46 -18
- package/build/pkg/addon/browser.d.ts +3 -0
- package/build/pkg/addon/browser.js +47 -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 +110 -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/layout.json +15 -2
- 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 +15 -18
- package/build/pkg/gen1.js +28 -19
- package/build/pkg/gen1.js.map +1 -1
- package/build/pkg/index.d.ts +40 -90
- package/build/pkg/index.js +23 -70
- 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 +53 -78
- package/build/tools/debug.js.map +1 -1
- package/build/tools/display/debug.jsx +152 -0
- package/build/tools/display/debug.jsx.map +1 -0
- package/build/tools/display/index.js +152 -0
- package/build/tools/display/index.js.map +1 -0
- package/build/tools/display/ui.jsx +359 -0
- package/build/tools/display/ui.jsx.map +1 -0
- package/build/tools/display/util.js +33 -0
- package/build/tools/display/util.js.map +1 -0
- package/build.zig +330 -104
- package/package.json +60 -134
- package/src/bin/install-pkmn-engine +32 -21
- package/src/bin/pkmn-debug +1 -1
- package/src/lib/bindings/c.zig +255 -0
- package/src/lib/{binding → bindings}/node.zig +8 -21
- package/src/lib/bindings/wasm.zig +59 -0
- package/src/lib/common/array.zig +77 -0
- package/src/lib/common/data.zig +4 -4
- package/src/lib/common/debug.zig +39 -8
- package/src/lib/common/js.zig +4 -2
- package/src/lib/common/optional.zig +14 -10
- package/src/lib/common/options.zig +6 -0
- package/src/lib/common/protocol.zig +63 -67
- package/src/lib/common/rational.zig +128 -32
- package/src/lib/common/rng.zig +7 -9
- package/src/lib/common/util.zig +50 -1
- package/src/lib/gen1/calc.zig +686 -159
- package/src/lib/gen1/chance.zig +405 -280
- package/src/lib/gen1/data/moves.zig +2 -4
- package/src/lib/gen1/data/species.zig +2 -4
- package/src/lib/gen1/data/types.zig +1 -2
- package/src/lib/gen1/data.zig +24 -27
- package/src/lib/gen1/helpers.zig +92 -548
- package/src/lib/gen1/mechanics.zig +379 -258
- package/src/lib/gen2/calc.zig +37 -27
- package/src/lib/gen2/chance.zig +84 -496
- package/src/lib/gen2/data/items.zig +1 -3
- package/src/lib/gen2/data/moves.zig +2 -4
- package/src/lib/gen2/data/species.zig +1 -3
- package/src/lib/gen2/data/types.zig +1 -2
- package/src/lib/gen2/data.zig +19 -22
- package/src/lib/gen2/generated.zig +19 -26
- package/src/lib/gen2/helpers.zig +46 -25
- package/src/lib/gen2/mechanics.zig +217 -163
- 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 +95 -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 -329
- 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. */
|
|
@@ -19,6 +18,8 @@ export interface API {
|
|
|
19
18
|
* `Log`.
|
|
20
19
|
*/
|
|
21
20
|
log?: DataView;
|
|
21
|
+
/** FIXME */
|
|
22
|
+
bytes(): DataView;
|
|
22
23
|
/**
|
|
23
24
|
* Returns the result of applying Player 1's choice `c1` and Player 2's choice
|
|
24
25
|
* `c2` to the battle.
|
|
@@ -34,31 +35,25 @@ export interface API {
|
|
|
34
35
|
* soft-lock occurs).
|
|
35
36
|
*/
|
|
36
37
|
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
38
|
/** Returns a copy of the Battle data. */
|
|
52
39
|
toJSON(): Data<Battle>;
|
|
53
40
|
}
|
|
54
|
-
/** Helper type removing
|
|
55
|
-
export type Data<T
|
|
41
|
+
/** Helper type removing function types from a data type `T`. */
|
|
42
|
+
export type Data<T> = T extends readonly any[] ? {
|
|
43
|
+
[K in keyof T]: Data<T[K]>;
|
|
44
|
+
} : T extends Iterable<infer U> ? (U extends object ? Iterable<Data<U>> : T) : T extends object ? {
|
|
45
|
+
[K in keyof T as T[K] extends Function ? never : K]: Data<T[K]>;
|
|
46
|
+
} : T;
|
|
56
47
|
/** Type definitions for Generation I Pokémon data relevant in a battle. */
|
|
57
48
|
export declare namespace Gen1 {
|
|
58
49
|
/** Representation of the entire state of a Generation I Pokémon battle. */
|
|
59
50
|
interface Battle extends API {
|
|
60
51
|
/** The sides involved in the battle. */
|
|
61
52
|
sides: Iterable<Side>;
|
|
53
|
+
/** Returns the side of the `player`. */
|
|
54
|
+
side(player: Player): Side;
|
|
55
|
+
/** Returns the opposing side to `player`. */
|
|
56
|
+
foe(player: Player): Side;
|
|
62
57
|
/** The battle's current turn number. */
|
|
63
58
|
turn: number;
|
|
64
59
|
/** The last damage dealt by either side. */
|
|
@@ -84,6 +79,16 @@ export declare namespace Gen1 {
|
|
|
84
79
|
* the effect switching would have on its original order).
|
|
85
80
|
*/
|
|
86
81
|
pokemon: Iterable<Pokemon>;
|
|
82
|
+
/**
|
|
83
|
+
* Returns the current slot of the Pokémon that started the battle at index
|
|
84
|
+
* `id`, or undefined if the index is invalid.
|
|
85
|
+
*/
|
|
86
|
+
slot(id: number): Slot | undefined;
|
|
87
|
+
/**
|
|
88
|
+
* Returns the Pokémon currently at the provided `slot`, or undefined if
|
|
89
|
+
* nothing occupies the slot.
|
|
90
|
+
*/
|
|
91
|
+
get(slot: Slot): Pokemon | undefined;
|
|
87
92
|
/** The last move the player used. */
|
|
88
93
|
lastUsedMove: ID | undefined;
|
|
89
94
|
/** The last move the player selected. */
|
|
@@ -127,13 +132,19 @@ export declare namespace Gen1 {
|
|
|
127
132
|
* boosts/status/etc (and which may differ from its original stored stats).
|
|
128
133
|
*/
|
|
129
134
|
stats: StatsTable;
|
|
135
|
+
/** Returns the value Pokémon's current `stat`. */
|
|
136
|
+
stat(stat: StatID | 'spc'): number;
|
|
130
137
|
/** The Pokémon's current boosts. */
|
|
131
138
|
boosts: BoostsTable;
|
|
139
|
+
/** Returns the value Pokémon's current `boost`. */
|
|
140
|
+
boost(boost: BoostID): number;
|
|
132
141
|
/**
|
|
133
142
|
* The Pokémon's move slots (which may differ from its original stored
|
|
134
143
|
* moves).
|
|
135
144
|
*/
|
|
136
145
|
moves: Iterable<MoveSlot>;
|
|
146
|
+
/** The Pokémon's current move at `slot`, or undefined if absent. */
|
|
147
|
+
move(slot: 1 | 2 | 3 | 4): MoveSlot | undefined;
|
|
137
148
|
/** The Pokémon's volatiles statuses. */
|
|
138
149
|
volatiles: Volatiles;
|
|
139
150
|
stored: {
|
|
@@ -143,8 +154,12 @@ export declare namespace Gen1 {
|
|
|
143
154
|
types: readonly [TypeName, TypeName];
|
|
144
155
|
/** The Pokémon original unmodified stats. */
|
|
145
156
|
stats: StatsTable;
|
|
157
|
+
/** Returns the value Pokémon's original `stat`. */
|
|
158
|
+
stat(stat: StatID | 'spc'): number;
|
|
146
159
|
/** The Pokémon's original move slots. */
|
|
147
160
|
moves: Iterable<Omit<MoveSlot, 'disabled'>>;
|
|
161
|
+
/** The Pokémon's original move at `slot`, or undefined if absent. */
|
|
162
|
+
move(slot: 1 | 2 | 3 | 4): Omit<MoveSlot, 'disabled'> | undefined;
|
|
148
163
|
};
|
|
149
164
|
/** The current one-indexed position of this Pokémon in the party. */
|
|
150
165
|
position: Slot;
|
|
@@ -242,6 +257,8 @@ export type CreateOptions = {
|
|
|
242
257
|
* that the engine be built in a specific compatibility mode).
|
|
243
258
|
*/
|
|
244
259
|
showdown?: boolean;
|
|
260
|
+
/** Whether the battle should be initialized without functionality afforded by native code. */
|
|
261
|
+
inert?: true;
|
|
245
262
|
} & ({
|
|
246
263
|
/** Player 1's options. */
|
|
247
264
|
p1: PlayerOptions;
|
|
@@ -302,40 +319,6 @@ export interface PlayerOptions {
|
|
|
302
319
|
/** The player's team. */
|
|
303
320
|
team: Partial<PokemonSet>[];
|
|
304
321
|
}
|
|
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
322
|
/** Factory for creating Battle objects. */
|
|
340
323
|
export declare const Battle: {
|
|
341
324
|
/** Create a `Battle` in the given generation with the provided options. */
|
|
@@ -344,44 +327,11 @@ export declare const Battle: {
|
|
|
344
327
|
* Restore a (possibly in-progress) `Battle` in the given generation with the
|
|
345
328
|
* provided options.
|
|
346
329
|
*/
|
|
347
|
-
restore(gen: Generation, battle: Battle
|
|
330
|
+
restore(gen: Generation, battle: Data<Battle>, options: RestoreOptions): Battle;
|
|
348
331
|
};
|
|
349
|
-
|
|
350
|
-
export
|
|
351
|
-
|
|
352
|
-
static Types: readonly ["pass", "move", "switch"];
|
|
353
|
-
protected static PASS: {
|
|
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
|
-
}
|
|
332
|
+
export { initialize } from './addon';
|
|
333
|
+
export { Choice, Result } from './common';
|
|
334
|
+
export type { Player } from './common';
|
|
385
335
|
export type { ParsedLine, PokemonInfo } from './protocol';
|
|
386
336
|
export { Info, SideInfo, Log } from './protocol';
|
|
387
337
|
export { Lookup } from './data';
|
package/build/pkg/index.js
CHANGED
|
@@ -15,15 +15,25 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.Lookup = exports.Log = exports.SideInfo = exports.Info = exports.Result = exports.Choice = exports.Battle = void 0;
|
|
36
|
+
exports.Lookup = exports.Log = exports.SideInfo = exports.Info = exports.Result = exports.Choice = exports.initialize = exports.Battle = void 0;
|
|
27
37
|
const addon = __importStar(require("./addon"));
|
|
28
38
|
const data_1 = require("./data");
|
|
29
39
|
const gen1 = __importStar(require("./gen1"));
|
|
@@ -51,68 +61,11 @@ exports.Battle = new class {
|
|
|
51
61
|
}
|
|
52
62
|
}
|
|
53
63
|
};
|
|
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;
|
|
64
|
+
var addon_1 = require("./addon");
|
|
65
|
+
Object.defineProperty(exports, "initialize", { enumerable: true, get: function () { return addon_1.initialize; } });
|
|
66
|
+
var common_1 = require("./common");
|
|
67
|
+
Object.defineProperty(exports, "Choice", { enumerable: true, get: function () { return common_1.Choice; } });
|
|
68
|
+
Object.defineProperty(exports, "Result", { enumerable: true, get: function () { return common_1.Result; } });
|
|
116
69
|
var protocol_1 = require("./protocol");
|
|
117
70
|
Object.defineProperty(exports, "Info", { enumerable: true, get: function () { return protocol_1.Info; } });
|
|
118
71
|
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":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/pkg/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,+CAAiC;AAEjC,iCAA8B;AAC9B,6CAA+B;AA6U/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 {};
|