@pkmn/engine 0.1.0-dev.9a0c07c3 → 0.1.0-dev.a02611a4

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 (49) hide show
  1. package/README.md +71 -60
  2. package/build/pkg/addon.d.ts +7 -0
  3. package/build/pkg/addon.js +112 -0
  4. package/build/pkg/addon.js.map +1 -0
  5. package/build/pkg/data/layout.json +25 -3
  6. package/build/pkg/gen1.d.ts +5 -4
  7. package/build/pkg/gen1.js +47 -31
  8. package/build/pkg/gen1.js.map +1 -1
  9. package/build/pkg/index.d.ts +15 -12
  10. package/build/pkg/index.js.map +1 -1
  11. package/build/pkg/protocol.d.ts +4 -2
  12. package/build/pkg/protocol.js +4 -2
  13. package/build/pkg/protocol.js.map +1 -1
  14. package/build/test/display.js +31 -13
  15. package/build/test/display.js.map +1 -1
  16. package/build.zig +95 -76
  17. package/package.json +29 -16
  18. package/src/bin/install-pkmn-engine +11 -6
  19. package/src/bin/pkmn-debug +34 -7
  20. package/src/lib/binding/node.zig +46 -141
  21. package/src/lib/binding/wasm.zig +6 -4
  22. package/src/lib/common/battle.zig +17 -0
  23. package/src/lib/common/data.zig +11 -11
  24. package/src/lib/common/debug.zig +21 -11
  25. package/src/lib/common/js.zig +118 -0
  26. package/src/lib/common/optional.zig +60 -0
  27. package/src/lib/common/options.zig +12 -3
  28. package/src/lib/common/protocol.zig +308 -182
  29. package/src/lib/common/rational.zig +353 -0
  30. package/src/lib/common/rng.zig +10 -10
  31. package/src/lib/common/util.zig +12 -0
  32. package/src/lib/gen1/README.md +262 -154
  33. package/src/lib/gen1/calc.zig +426 -0
  34. package/src/lib/gen1/chance.zig +1044 -0
  35. package/src/lib/gen1/data/moves.zig +10 -10
  36. package/src/lib/gen1/data/species.zig +2 -2
  37. package/src/lib/gen1/data/types.zig +3 -3
  38. package/src/lib/gen1/data.zig +69 -43
  39. package/src/lib/gen1/helpers.zig +592 -32
  40. package/src/lib/gen1/mechanics.zig +983 -626
  41. package/src/lib/gen2/README.md +12 -13
  42. package/src/lib/gen2/data/items.zig +3 -3
  43. package/src/lib/gen2/data/moves.zig +16 -3
  44. package/src/lib/gen2/data/species.zig +1 -1
  45. package/src/lib/gen2/data/types.zig +3 -3
  46. package/src/lib/gen2/data.zig +59 -41
  47. package/src/lib/gen2/helpers.zig +15 -16
  48. package/src/lib/gen2/mechanics.zig +354 -11
  49. package/src/lib/pkmn.zig +68 -9
@@ -1,8 +1,9 @@
1
1
  const std = @import("std");
2
2
 
3
+ const pkmn = @import("../pkmn.zig");
4
+
3
5
  const common = @import("../common/data.zig");
4
6
  const DEBUG = @import("../common/debug.zig").print;
5
- const options = @import("../common/options.zig");
6
7
  const protocol = @import("../common/protocol.zig");
7
8
  const rng = @import("../common/rng.zig");
8
9
 
@@ -17,7 +18,7 @@ const ID = common.ID;
17
18
  const Player = common.Player;
18
19
  const Result = common.Result;
19
20
 
20
- const showdown = options.showdown;
21
+ const showdown = pkmn.options.showdown;
21
22
 
22
23
  const Damage = protocol.Damage;
23
24
  const Heal = protocol.Heal;
@@ -34,20 +35,362 @@ const Species = data.Species;
34
35
  const Stats = data.Stats;
35
36
  const Status = data.Status;
36
37
 
37
- pub fn update(battle: anytype, c1: Choice, c2: Choice, log: anytype) !Result {
38
+ pub fn update(battle: anytype, c1: Choice, c2: Choice, options: anytype) !Result {
39
+ assert(c1.type != .Pass or c2.type != .Pass or battle.turn == 0);
40
+ if (battle.turn == 0) return start(battle, options);
41
+
42
+ if (try turnOrder(battle, c1, c2, options) == .P1) {
43
+ if (try doTurn(battle, .P1, c1, .P2, c2, options)) |r| return r;
44
+ } else {
45
+ if (try doTurn(battle, .P2, c2, .P1, c1, options)) |r| return r;
46
+ }
47
+
48
+ return endTurn(battle, options);
49
+ }
50
+
51
+ fn start(battle: anytype, options: anytype) !Result {
52
+ const p1 = battle.side(.P1);
53
+ const p2 = battle.side(.P2);
54
+
55
+ var p1_slot = findFirstAlive(p1);
56
+ assert(!showdown or p1_slot == 1);
57
+ if (p1_slot == 0) return if (findFirstAlive(p2) == 0) Result.Tie else Result.Lose;
58
+
59
+ var p2_slot = findFirstAlive(p2);
60
+ assert(!showdown or p2_slot == 1);
61
+ if (p2_slot == 0) return Result.Win;
62
+
63
+ try switchIn(battle, .P1, p1_slot, true, options);
64
+ try switchIn(battle, .P2, p2_slot, true, options);
65
+
66
+ return endTurn(battle, options);
67
+ }
68
+
69
+ fn findFirstAlive(side: *const Side) u8 {
70
+ for (side.pokemon, 0..) |pokemon, i| if (pokemon.hp > 0) return side.pokemon[i].position;
71
+ return 0;
72
+ }
73
+
74
+ fn selectMove(battle: anytype) ?Result {
38
75
  _ = battle;
39
- _ = c1;
40
- _ = c2;
41
- _ = log;
76
+ return null;
77
+ }
78
+
79
+ fn saveMove(battle: anytype) void {
80
+ _ = battle;
81
+ return null;
82
+ }
83
+
84
+ fn switchIn(battle: anytype, player: Player, slot: u8, initial: bool, options: anytype) !void {
85
+ var side = battle.side(player);
86
+ var foe = battle.foe(player);
87
+
88
+ var active = &side.active;
89
+ const incoming = side.get(slot);
90
+
91
+ assert(incoming.hp != 0);
92
+ assert(slot != 1 or initial);
93
+
94
+ const out = side.pokemon[0].position;
95
+ side.pokemon[0].position = side.pokemon[slot - 1].position;
96
+ side.pokemon[slot - 1].position = out;
97
+
98
+ side.last_move = .None;
99
+
100
+ side.last_counter_move = .None;
101
+ foe.last_counter_move = .None;
102
+
103
+ active.stats = incoming.stats;
104
+ active.species = incoming.species;
105
+ active.types = incoming.types;
106
+ active.boosts = .{};
107
+ active.volatiles = .{};
108
+ active.moves = incoming.moves;
109
+
110
+ statusModify(incoming.status, &active.stats);
111
+
112
+ try options.log.switched(battle.active(player), incoming);
113
+ // TODO: options.chance.switched(player, side.order[0], out);
114
+
115
+ if (side.conditions.Spikes and !active.types.includes(.Flying)) {
116
+ incoming.hp -|= @max(incoming.stats.hp / 8, 1);
117
+ try options.log.damage(battle.active(player), incoming, .Spikes);
118
+ }
119
+ }
120
+
121
+ fn turnOrder(battle: anytype, c1: Choice, c2: Choice, options: anytype) !Player {
122
+ assert(c1.type != .Pass or c2.type != .Pass);
123
+
124
+ if (c1.type == .Pass) return .P2;
125
+ if (c2.type == .Pass) return .P1;
126
+
127
+ // Pokémon Showdown always rolls for Quick Claw every turn, even if no Pokémon hold Quick Claw
128
+ const qkc = showdown and try Rolls.quickClaw(battle, .P1, options);
129
+
130
+ if ((c1.type == .Switch) != (c2.type == .Switch)) return if (c1.type == .Switch) .P1 else .P2;
131
+
132
+ // https://www.smogon.com/forums/threads/adv-switch-priority.3622189/
133
+ // > In Gen 1 it's irrelevant [which player switches first] because switches happen instantly on
134
+ // > your own screen without waiting for the other player's choice (and their choice will appear
135
+ // > to happen first for them too, unless they attacked in which case your switch happens first)
136
+ // A cartridge-compatible implemention must not advance the RNG so we simply default to P1
137
+ const double_switch = c1.type == .Switch and c2.type == .Switch;
138
+ if (!showdown and double_switch) return .P1;
139
+
140
+ const m1 = .Pound; // TODO battle.side(.P1).last_selected_move;
141
+ const m2 = .Pound; // TODO battle.side(.P2).last_selected_move;
142
+ if (!showdown or !double_switch) {
143
+ const pri1 = Move.get(m1).priority;
144
+ const pri2 = Move.get(m2).priority;
145
+ if (pri1 != pri2) return if (pri1 > pri2) .P1 else .P2;
146
+
147
+ const qkc1 = battle.side(.P1).active.item == .QuickClaw;
148
+ const qkc2 = battle.side(.P2).active.item == .QuickClaw;
149
+ if (!showdown and qkc1 and qkc2) {
150
+ // If both Pokémon have Quick Claw the cartridge checks them in order and exits early if
151
+ // the first one procs, meaning the host has a slightly higher chance of going first
152
+ if (try Rolls.quickClaw(battle, .P1, options)) return .P1;
153
+ if (try Rolls.quickClaw(battle, .P2, options)) return .P2;
154
+ } else if (qkc1) {
155
+ const proc = if (showdown) qkc else try Rolls.quickClaw(battle, .P1, options);
156
+ if (proc) return .P1;
157
+ } else if (qkc2) {
158
+ const proc = if (showdown) qkc else try Rolls.quickClaw(battle, .P2, options);
159
+ if (proc) return .P2;
160
+ }
161
+ }
162
+
163
+ const spe1 = battle.side(.P1).active.stats.spe;
164
+ const spe2 = battle.side(.P2).active.stats.spe;
165
+ if (spe1 == spe2) {
166
+ // Pokémon Showdown's beforeTurnCallback shenanigans
167
+ if (showdown and !double_switch and hasCallback(m1) and hasCallback(m2)) {
168
+ battle.rng.advance(1);
169
+ }
170
+
171
+ const p1 = try Rolls.speedTie(battle, options);
172
+ if (!showdown) return if (p1) .P1 else .P2;
173
+
174
+ // Pokémon Showdown's "lockedmove" volatile's onBeforeTurn uses BattleQueue#changeAction,
175
+ // meaning that if a side is locked into a thrashing move and wins the speed tie, it
176
+ // actually uses its priority to simply insert its actual changed action into the queue,
177
+ // causing it to then execute *after* the side which should go second...
178
+ const t1 = battle.side(.P1).active.volatiles.Thrashing;
179
+ const t2 = battle.side(.P2).active.volatiles.Thrashing;
180
+ // If *both* sides are thrashing it really should be another speed tie, but we've patched
181
+ // that out and enforce host ordering of events, so P1 just goes first regardless of who
182
+ // won the original coin flip
183
+ if (t1 and t2) return .P1;
184
+ return if (p1) if (t1 and !t2) .P2 else .P1 else if (t2 and !t1) .P1 else .P2;
185
+ }
186
+
187
+ return if (spe1 > spe2) .P1 else .P2;
188
+ }
189
+
190
+ fn hasCallback(m: Move) bool {
191
+ return switch (m) {
192
+ .Counter, .MirrorCoat, .Pursuit => true,
193
+ else => false,
194
+ };
195
+ }
196
+
197
+ fn doTurn(
198
+ battle: anytype,
199
+ player: Player,
200
+ player_choice: Choice,
201
+ foe_player: Player,
202
+ foe_choice: Choice,
203
+ options: anytype,
204
+ ) !?Result {
205
+ if (try executeMove(battle, player, player_choice, options)) |r| return r;
206
+ if (try executeMove(battle, foe_player, foe_choice, options)) |r| return r;
207
+ return null;
208
+ }
209
+
210
+ fn executeMove(battle: anytype, player: Player, choice: Choice, options: anytype) !?Result {
211
+ if (choice.type == .Switch) {
212
+ try switchIn(battle, player, choice.data, false, options);
213
+ return null;
214
+ }
215
+
216
+ @panic("TODO");
217
+ }
218
+
219
+ fn endTurn(battle: anytype, options: anytype) @TypeOf(options.log).Error!Result {
220
+ battle.turn += 1;
221
+
222
+ if (showdown and battle.turn >= 1000) {
223
+ try options.log.tie();
224
+ return Result.Tie;
225
+ } else if (battle.turn >= 65535) {
226
+ return Result.Error;
227
+ }
228
+
229
+ try options.log.turn(battle.turn);
42
230
 
43
231
  return Result.Default;
44
232
  }
45
233
 
234
+ fn statusModify(status: u8, stats: *Stats(u16)) void {
235
+ if (Status.is(status, .PAR)) {
236
+ stats.spe = @max(stats.spe / 4, 1);
237
+ } else if (Status.is(status, .BRN)) {
238
+ stats.atk = @max(stats.atk / 2, 1);
239
+ }
240
+ }
241
+
242
+ inline fn isForced(active: anytype) bool {
243
+ return active.volatiles.Recharging or active.volatiles.Rage or
244
+ active.volatiles.Thrashing or active.volatiles.Charging or
245
+ active.volatiles.Underground or active.volatiles.Flying or
246
+ active.volatiles.Rollout;
247
+ }
248
+
249
+ pub const Rolls = struct {
250
+ inline fn speedTie(battle: anytype, options: anytype) !bool {
251
+ const p1 = if (options.calc.overridden(.P1, .speed_tie)) |player|
252
+ player == .P1
253
+ else if (showdown)
254
+ battle.rng.range(u8, 0, 2) == 0
255
+ else
256
+ battle.rng.next() < Gen12.percent(50) + 1;
257
+
258
+ try options.chance.speedTie(p1);
259
+ return p1;
260
+ }
261
+
262
+ inline fn quickClaw(battle: anytype, player: Player, options: anytype) !bool {
263
+ const qkc = if (options.calc.overridden(player, .quick_claw)) |val|
264
+ val == .true
265
+ else if (showdown)
266
+ battle.rng.chance(u8, 60, 256)
267
+ else
268
+ battle.rng.next() < 60;
269
+
270
+ try options.chance.quickClaw(player, qkc);
271
+ return qkc;
272
+ }
273
+ };
274
+
275
+ test "RNG agreement" {
276
+ if (!showdown) return;
277
+ var expected: [256]u32 = undefined;
278
+ for (0..expected.len) |i| {
279
+ expected[i] = @intCast(i * 0x1000000);
280
+ }
281
+
282
+ var spe = rng.FixedRNG(2, expected.len){ .rolls = expected };
283
+ var qkc = rng.FixedRNG(2, expected.len){ .rolls = expected };
284
+
285
+ for (0..expected.len) |i| {
286
+ try expectEqual(spe.range(u8, 0, 2) == 0, i < Gen12.percent(50) + 1);
287
+ try expectEqual(qkc.chance(u8, 60, 256), i < 60);
288
+ }
289
+ }
290
+
46
291
  pub fn choices(battle: anytype, player: Player, request: Choice.Type, out: []Choice) u8 {
47
- _ = battle;
48
- _ = player;
49
- _ = request;
50
- _ = out;
292
+ var n: u8 = 0;
293
+ switch (request) {
294
+ .Pass => {
295
+ out[n] = .{};
296
+ n += 1;
297
+ },
298
+ .Switch => {
299
+ const side = battle.side(player);
300
+ var slot: u4 = 2;
301
+ while (slot <= 6) : (slot += 1) {
302
+ const id = side.order[slot - 1];
303
+ if (id == 0 or side.pokemon[id - 1].hp == 0) continue;
304
+ out[n] = .{ .type = .Switch, .data = slot };
305
+ n += 1;
306
+ }
307
+ if (n == 0) {
308
+ out[n] = .{};
309
+ n += 1;
310
+ }
311
+ },
312
+ .Move => {
313
+ const side = battle.side(player);
51
314
 
52
- return 0;
315
+ var active = &side.active;
316
+ const stored = side.stored();
317
+
318
+ // While players are not given any input options on the cartridge in these cases,
319
+ // Pokémon Showdown instead produces a list with a single move that must be chosen.
320
+ //
321
+ // Given that no input is allowed on the cartridge 'Pass' seems like it would be logical
322
+ // here when not in compatibility mode, but the engine needs to be able to differentiate
323
+ // between passing while waiting for an opponent's forced switch after fainting and
324
+ // passing due to being forced into using a move. Instead of introducing another option
325
+ // we simply repurpose Move with no move slot, even though pedantically this is not
326
+ // strictly correct as the player would not have been presented the option to move or
327
+ // switch at all.
328
+ if (isForced(active)) {
329
+ out[n] = .{ .type = .Move, .data = @intFromBool(showdown) };
330
+ n += 1;
331
+ return n;
332
+ }
333
+
334
+ var slot: u4 = 2;
335
+ while (!active.volatiles.trapped and slot <= 6) : (slot += 1) {
336
+ const id = side.order[slot - 1];
337
+ if (id == 0 or side.pokemon[id - 1].hp == 0) continue;
338
+ out[n] = .{ .type = .Switch, .data = slot };
339
+ n += 1;
340
+ }
341
+
342
+ const limited = active.volatiles.Bide or active.volatiles.bind > 0;
343
+ // On the cartridge, all of these happen after "FIGHT" (indicating you are not
344
+ // switching) but before you are allowed to select a move. Pokémon Showdown instead
345
+ // either disables all other moves in the case of limited or requires you to select a
346
+ // move normally if sleeping/frozen/bound.
347
+ if (!showdown and (limited or
348
+ Status.is(stored.status, .FRZ) or Status.is(stored.status, .SLP)))
349
+ {
350
+ out[n] = .{ .type = .Move, .data = 0 };
351
+ n += 1;
352
+ return n;
353
+ }
354
+
355
+ slot = 1;
356
+ // Pokémon Showdown handles Bide and Binding moves by checking if the move in question
357
+ // is present in the Pokémon's moveset (which means moves called via Metronome / Mirror
358
+ // Move will not result in forcing the subsequent use unless the user also had the
359
+ // proc-ed move in their moveset) and disabling all other moves.
360
+ if (limited) {
361
+ assert(showdown);
362
+ assert(side.last_selected_move != .None);
363
+ while (slot <= 4) : (slot += 1) {
364
+ const m = active.moves[slot - 1];
365
+ if (m.id == .None) break;
366
+ if (m.id == if (active.volatiles.Bide) .Bide else side.last_selected_move) {
367
+ // Pokémon Showdown displays Struggle if limited to Bide but unable to pick
368
+ const struggle =
369
+ m.id == .Bide and (m.pp == 0 or active.volatiles.disabled_move == slot);
370
+ const s = if (struggle) 0 else slot;
371
+ out[n] = .{ .type = .Move, .data = s };
372
+ n += 1;
373
+ return n;
374
+ }
375
+ }
376
+ }
377
+
378
+ const before = n;
379
+ slot = 1;
380
+ while (slot <= 4) : (slot += 1) {
381
+ const m = active.moves[slot - 1];
382
+ if (m.id == .None) break;
383
+ if (m.pp == 0) continue;
384
+ if (active.volatiles.disabled_move == slot) continue;
385
+ out[n] = .{ .type = .Move, .data = slot };
386
+ n += 1;
387
+ }
388
+ // Struggle (Pokémon Showdown would use 'move 1' here)
389
+ if (n == before) {
390
+ out[n] = .{ .type = .Move, .data = 0 };
391
+ n += 1;
392
+ }
393
+ },
394
+ }
395
+ return n;
53
396
  }
package/src/lib/pkmn.zig CHANGED
@@ -1,13 +1,13 @@
1
- /// Configurated Options for the pkmn package.
1
+ /// Configured Options for the pkmn package.
2
2
  pub const options = @import("common/options.zig");
3
3
  /// Configures the behavior of the pkmn package.
4
4
  pub const Options = options.Options;
5
5
 
6
6
  /// The minimum size in bytes required to hold all choice options.
7
- pub const MAX_OPTIONS = gen1.MAX_OPTIONS;
7
+ pub const MAX_CHOICES = gen1.MAX_CHOICES;
8
8
  /// The optimal size in bytes required to hold all choice options.
9
- /// At least as large as `MAX_OPTIONS`.
10
- pub const OPTIONS_SIZE = gen1.OPTIONS_SIZE;
9
+ /// At least as large as `MAX_CHOICES`.
10
+ pub const CHOICES_SIZE = gen1.CHOICES_SIZE;
11
11
  /// The maximum number of bytes possibly logged by a single update.
12
12
  pub const MAX_LOGS = gen1.MAX_LOGS;
13
13
  /// The optimal size in bytes required to hold the largest amount of log data
@@ -25,12 +25,12 @@ pub const Result = @import("common/data.zig").Result;
25
25
  /// Pokémon Showdown's RNG (backed by a Generation V & VI RNG).
26
26
  pub const PSRNG = @import("common/rng.zig").PSRNG;
27
27
 
28
- /// Namespace for helpers related to protocol trace logging.
28
+ /// Namespace for helpers related to protocol message logging.
29
29
  pub const protocol = if (options.internal) struct {
30
30
  pub usingnamespace @import("common/protocol.zig");
31
31
  } else struct {
32
32
  /// Logs protocol information to its `Writer` during a battle update when
33
- /// `options.trace` is enabled.
33
+ /// `options.log` is enabled.
34
34
  pub const Log = @import("common/protocol.zig").Log;
35
35
  /// Stripped down version of `std.io.FixedBufferStream` optimized for
36
36
  /// efficiently writing the individual protocol bytes. Note that the
@@ -41,14 +41,73 @@ pub const protocol = if (options.internal) struct {
41
41
  /// intialized with a `LOGS_SIZE`-sized buffer.
42
42
  pub const FixedLog = @import("common/protocol.zig").FixedLog;
43
43
  /// Null object pattern implementation of `Log` backed by a
44
- /// `std.io.null_writer`. Ignores anything sent to it, though trace logging
45
- /// should addtionally be turned off entirely by using `options.trace`.
44
+ /// `std.io.null_writer`. Ignores anything sent to it, though protocol
45
+ /// logging should additionally be turned off entirely with `options.log`.
46
46
  pub const NULL = @import("common/protocol.zig").NULL;
47
47
  };
48
48
 
49
- /// Namespace for Generation I Pokémon
49
+ pub usingnamespace @import("common/rational.zig");
50
+
51
+ /// Namespace for cross-generation battle-related types.
52
+ pub const battle = @import("common/battle.zig");
53
+
54
+ /// Namespace for Generation I Pokémon.
50
55
  pub const gen1 = struct {
51
56
  pub usingnamespace @import("gen1/data.zig");
57
+ /// Tracks chance actions and their associated probability during a
58
+ /// Generation I battle update when `options.chance` is enabled.
59
+ pub const Chance = @import("gen1/chance.zig").Chance;
60
+ /// Namespace for types associated with tracking Generation I Pokémon chance outcomes.
61
+ pub const chance = struct {
62
+ /// Actions taken by a hypothetical "chance player" that convey
63
+ /// information about which RNG events were observed during a Generation
64
+ /// I battle `update`. This can additionally be provided as input to the
65
+ /// `update` call via the `Calc` when `options.calc` is enabled to
66
+ /// override the normal behavior of the RNG in order to force specific
67
+ /// outcomes.
68
+ pub const Actions = @import("gen1/chance.zig").Actions;
69
+ /// Information about the RNG that was observed during a Generation I
70
+ /// battle `update` for a single player.
71
+ pub const Action = @import("gen1/chance.zig").Action;
72
+ /// TODO
73
+ pub const Durations = @import("gen1/chance.zig").Durations;
74
+ /// TODO
75
+ pub const Duration = @import("gen1/chance.zig").Duration;
76
+ /// Null object pattern implementation of Generation I `Chance` which
77
+ /// does nothing, though chance tracking should additionally be turned
78
+ /// off entirely via `options.chance`.
79
+ pub const NULL = @import("gen1/chance.zig").NULL;
80
+ };
81
+ /// Allows for forcing the value of specific RNG events during a Generation I battle `update`
82
+ /// via `overrides` and tracks `summaries` of information relevant to damage calculation.
83
+ pub const Calc = @import("gen1/calc.zig").Calc;
84
+ /// Namespace for types associated with supported Generation I Pokémon damage calc features.
85
+ pub const calc = if (options.internal) struct {
86
+ pub usingnamespace @import("gen1/calc.zig");
87
+ } else struct {
88
+ /// TODO
89
+ pub const Overrides = @import("gen1/calc.zig").Overrides;
90
+ /// Information relevant to damage calculation that occured during a Generation I
91
+ /// battle `update`.
92
+ pub const Summaries = @import("gen1/calc.zig").Summaries;
93
+ /// Information relevant to damage calculation that occured during a Generation I
94
+ /// battle `update` for a single player.
95
+ pub const Summary = @import("gen1/calc.zig").Summary;
96
+ /// Null object pattern implementation of Generation I `Calc` which does nothing,
97
+ /// though damage calculator support should additionally be turned off
98
+ /// entirely via `options.calc`.
99
+ pub const NULL = @import("gen1/calc.zig").NULL;
100
+ };
52
101
  /// Provides helpers for initializing Generation I Pokémon battles.
53
102
  pub const helpers = @import("gen1/helpers.zig");
54
103
  };
104
+
105
+ // Internal APIs used by other pkmn libraries, not actually part of the public API.
106
+ // NOTE: `pub usingnamespace struct { ... }` here results in a (false?) dependency loop
107
+ pub const js = if (options.internal) struct {
108
+ pub usingnamespace @import("common/js.zig");
109
+ } else struct {};
110
+ pub const bindings = if (options.internal) struct {
111
+ pub const node = @import("binding/node.zig");
112
+ pub const wasm = @import("binding/wasm.zig");
113
+ } else struct {};