@pkmn/engine 0.1.0-dev.02b7f810 → 0.1.0-dev.14e79917
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 +22 -22
- package/build/pkg/addon.d.ts +2 -2
- package/build/pkg/addon.js +5 -5
- package/build/pkg/addon.js.map +1 -1
- package/build/pkg/data/layout.json +1 -1
- package/build/pkg/gen1.d.ts +5 -4
- package/build/pkg/gen1.js +43 -24
- package/build/pkg/gen1.js.map +1 -1
- package/build/pkg/index.d.ts +15 -12
- package/build/pkg/index.js.map +1 -1
- package/build/pkg/protocol.d.ts +4 -2
- package/build/pkg/protocol.js +4 -2
- package/build/pkg/protocol.js.map +1 -1
- package/build/test/display.js +31 -13
- package/build/test/display.js.map +1 -1
- package/build.zig +22 -27
- package/package.json +16 -15
- package/src/bin/install-pkmn-engine +3 -3
- package/src/lib/binding/node.zig +5 -5
- package/src/lib/binding/wasm.zig +3 -3
- package/src/lib/common/debug.zig +1 -0
- package/src/lib/common/options.zig +3 -3
- package/src/lib/common/protocol.zig +38 -38
- package/src/lib/gen1/README.md +90 -69
- package/src/lib/gen1/data.zig +19 -17
- package/src/lib/gen1/helpers.zig +4 -15
- package/src/lib/gen1/mechanics.zig +374 -304
- package/src/lib/gen2/data.zig +4 -4
- package/src/lib/pkmn.zig +7 -7
package/src/lib/gen1/helpers.zig
CHANGED
|
@@ -55,21 +55,16 @@ pub const Battle = struct {
|
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
pub fn random(rand: *PSRNG, opt: Options) data.Battle(data.PRNG) {
|
|
58
|
-
|
|
59
|
-
var p2: u4 = 0;
|
|
60
|
-
var battle: data.Battle(data.PRNG) = .{
|
|
58
|
+
return .{
|
|
61
59
|
.rng = prng(rand),
|
|
62
60
|
.turn = 0,
|
|
63
61
|
.last_damage = 0,
|
|
64
62
|
.sides = .{ Side.random(rand, opt), Side.random(rand, opt) },
|
|
65
63
|
};
|
|
66
|
-
battle.last_selected_indexes.p1 = p1;
|
|
67
|
-
battle.last_selected_indexes.p2 = p2;
|
|
68
|
-
return battle;
|
|
69
64
|
}
|
|
70
65
|
};
|
|
71
66
|
|
|
72
|
-
|
|
67
|
+
fn prng(rand: *PSRNG) data.PRNG {
|
|
73
68
|
// GLITCH: initial bytes in seed can only range from 0-252, not 0-255
|
|
74
69
|
const max: u8 = 253;
|
|
75
70
|
return .{
|
|
@@ -211,16 +206,10 @@ pub const Pokemon = struct {
|
|
|
211
206
|
}
|
|
212
207
|
};
|
|
213
208
|
|
|
214
|
-
// cat src/test/showdown/blocklist.json | jq '."1".moves'
|
|
215
209
|
fn blocked(m: Move) bool {
|
|
216
|
-
|
|
210
|
+
// Binding moves are borked but only via Mirror Move / Metronome which are already blocked
|
|
217
211
|
return switch (m) {
|
|
218
|
-
.
|
|
219
|
-
.Mimic,
|
|
220
|
-
.Metronome,
|
|
221
|
-
.MirrorMove,
|
|
222
|
-
.Transform,
|
|
223
|
-
=> true,
|
|
212
|
+
.Mimic, .Metronome, .MirrorMove, .Transform => true,
|
|
224
213
|
else => false,
|
|
225
214
|
};
|
|
226
215
|
}
|