@pkmn/engine 0.1.0-dev.cf6f5d2c → 0.1.0-dev.d56bdadd
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/README.md +55 -44
- package/build/pkg/addon.js +3 -2
- package/build/pkg/addon.js.map +1 -1
- package/build/pkg/data/ids.json +12 -12
- package/build/pkg/data/layout.json +27 -5
- package/build/pkg/data/protocol.json +69 -12
- package/build/pkg/data.d.ts +2 -2
- package/build/pkg/gen1.d.ts +2 -1
- package/build/pkg/gen1.js +38 -20
- package/build/pkg/gen1.js.map +1 -1
- package/build/pkg/index.d.ts +4 -2
- package/build/pkg/index.js.map +1 -1
- package/build/pkg/protocol.d.ts +4 -2
- package/build/pkg/protocol.js +60 -39
- package/build/pkg/protocol.js.map +1 -1
- package/build/test/display.js +7 -3
- package/build/test/display.js.map +1 -1
- package/build.zig +103 -73
- package/package.json +41 -20
- package/src/bin/install-pkmn-engine +10 -5
- package/src/lib/binding/node.zig +46 -141
- package/src/lib/binding/wasm.zig +4 -2
- package/src/lib/common/battle.zig +17 -0
- package/src/lib/common/data.zig +19 -31
- package/src/lib/common/debug.zig +20 -11
- package/src/lib/common/js.zig +118 -0
- package/src/lib/common/optional.zig +67 -0
- package/src/lib/common/options.zig +9 -0
- package/src/lib/common/protocol.zig +770 -208
- package/src/lib/common/rational.zig +353 -0
- package/src/lib/common/rng.zig +24 -15
- package/src/lib/common/util.zig +12 -0
- package/src/lib/gen1/README.md +269 -179
- package/src/lib/gen1/calc.zig +426 -0
- package/src/lib/gen1/chance.zig +1060 -0
- package/src/lib/gen1/data/moves.zig +202 -190
- package/src/lib/gen1/data/species.zig +4 -4
- package/src/lib/gen1/data/types.zig +10 -10
- package/src/lib/gen1/data.zig +85 -71
- package/src/lib/gen1/helpers.zig +577 -35
- package/src/lib/gen1/mechanics.zig +874 -608
- package/src/lib/gen2/README.md +105 -85
- package/src/lib/gen2/calc.zig +143 -0
- package/src/lib/gen2/chance.zig +1314 -0
- package/src/lib/gen2/data/items.zig +14 -20
- package/src/lib/gen2/data/moves.zig +664 -570
- package/src/lib/gen2/data/species.zig +2 -2
- package/src/lib/gen2/data/types.zig +137 -34
- package/src/lib/gen2/data.zig +124 -86
- package/src/lib/gen2/generated.zig +808 -0
- package/src/lib/gen2/helpers.zig +16 -22
- package/src/lib/gen2/mechanics.zig +3490 -12
- package/src/lib/pkmn.zig +61 -2
package/src/lib/pkmn.zig
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
///
|
|
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;
|
|
@@ -46,9 +46,68 @@ pub const protocol = if (options.internal) struct {
|
|
|
46
46
|
pub const NULL = @import("common/protocol.zig").NULL;
|
|
47
47
|
};
|
|
48
48
|
|
|
49
|
-
|
|
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 {};
|