@pkmn/engine 0.1.0-dev.bcb16a6c → 0.1.0-dev.c42deb42
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/package.json +1 -1
- package/src/lib/common/optional.zig +4 -6
- package/src/lib/common/protocol.zig +23 -18
- package/src/lib/gen1/chance.zig +43 -41
- package/src/lib/gen1/data/moves.zig +14 -0
- package/src/lib/gen1/helpers.zig +1 -16
- package/src/lib/gen1/mechanics.zig +29 -62
- package/src/lib/gen2/data/moves.zig +27 -10
- package/src/lib/gen2/data.zig +6 -2
- package/src/lib/gen2/mechanics.zig +1143 -81
|
@@ -288,6 +288,8 @@ pub const Move = enum(u8) {
|
|
|
288
288
|
const Extra = packed struct(u8) {
|
|
289
289
|
/// Whether this move can be called via Metronome.
|
|
290
290
|
metronome: bool = true,
|
|
291
|
+
/// Whether this move can be called via Sleep Talk.
|
|
292
|
+
sleep_talk: bool = true,
|
|
291
293
|
/// Whether this move is considered to be "continuous".
|
|
292
294
|
continuous: bool = false,
|
|
293
295
|
/// Whether this move can hit a flying target.
|
|
@@ -295,7 +297,7 @@ pub const Move = enum(u8) {
|
|
|
295
297
|
/// Whether this move can hit an underground target.
|
|
296
298
|
underground: bool = false,
|
|
297
299
|
/// Protocol reason offset associated with this move.
|
|
298
|
-
protocol:
|
|
300
|
+
protocol: u3 = 0,
|
|
299
301
|
};
|
|
300
302
|
|
|
301
303
|
comptime {
|
|
@@ -410,7 +412,7 @@ pub const Move = enum(u8) {
|
|
|
410
412
|
.type = .Normal,
|
|
411
413
|
.accuracy = percent(75),
|
|
412
414
|
.target = .Foes,
|
|
413
|
-
.extra = .{ .continuous = true },
|
|
415
|
+
.extra = .{ .sleep_talk = false, .continuous = true },
|
|
414
416
|
},
|
|
415
417
|
// SwordsDance
|
|
416
418
|
.{
|
|
@@ -457,12 +459,12 @@ pub const Move = enum(u8) {
|
|
|
457
459
|
},
|
|
458
460
|
// Fly
|
|
459
461
|
.{
|
|
460
|
-
.effect = .
|
|
462
|
+
.effect = .FlyDig,
|
|
461
463
|
.bp = 70,
|
|
462
464
|
.type = .Flying,
|
|
463
465
|
.accuracy = percent(95),
|
|
464
466
|
.target = .Any,
|
|
465
|
-
.extra = .{ .continuous = true },
|
|
467
|
+
.extra = .{ .sleep_talk = false, .continuous = true },
|
|
466
468
|
},
|
|
467
469
|
// Bind
|
|
468
470
|
.{
|
|
@@ -941,7 +943,7 @@ pub const Move = enum(u8) {
|
|
|
941
943
|
.type = .Grass,
|
|
942
944
|
.accuracy = percent(100),
|
|
943
945
|
.target = .Other,
|
|
944
|
-
.extra = .{ .continuous = true },
|
|
946
|
+
.extra = .{ .sleep_talk = false, .continuous = true },
|
|
945
947
|
},
|
|
946
948
|
// PoisonPowder
|
|
947
949
|
.{
|
|
@@ -1065,11 +1067,12 @@ pub const Move = enum(u8) {
|
|
|
1065
1067
|
},
|
|
1066
1068
|
// Dig
|
|
1067
1069
|
.{
|
|
1068
|
-
.effect = .
|
|
1070
|
+
.effect = .FlyDig,
|
|
1069
1071
|
.bp = 60,
|
|
1070
1072
|
.type = .Ground,
|
|
1071
1073
|
.accuracy = percent(100),
|
|
1072
1074
|
.target = .Other,
|
|
1075
|
+
.extra = .{ .sleep_talk = false },
|
|
1073
1076
|
},
|
|
1074
1077
|
// Toxic
|
|
1075
1078
|
.{
|
|
@@ -1282,7 +1285,7 @@ pub const Move = enum(u8) {
|
|
|
1282
1285
|
.type = .Normal,
|
|
1283
1286
|
.accuracy = percent(100),
|
|
1284
1287
|
.target = .Self,
|
|
1285
|
-
.extra = .{ .continuous = true },
|
|
1288
|
+
.extra = .{ .sleep_talk = false, .continuous = true },
|
|
1286
1289
|
},
|
|
1287
1290
|
// Metronome
|
|
1288
1291
|
.{
|
|
@@ -1394,7 +1397,7 @@ pub const Move = enum(u8) {
|
|
|
1394
1397
|
.type = .Normal,
|
|
1395
1398
|
.accuracy = percent(100),
|
|
1396
1399
|
.target = .Other,
|
|
1397
|
-
.extra = .{ .continuous = true },
|
|
1400
|
+
.extra = .{ .sleep_talk = false, .continuous = true },
|
|
1398
1401
|
},
|
|
1399
1402
|
// SpikeCannon
|
|
1400
1403
|
.{
|
|
@@ -1500,7 +1503,7 @@ pub const Move = enum(u8) {
|
|
|
1500
1503
|
.type = .Flying,
|
|
1501
1504
|
.accuracy = percent(90),
|
|
1502
1505
|
.target = .Any,
|
|
1503
|
-
.extra = .{ .continuous = true },
|
|
1506
|
+
.extra = .{ .sleep_talk = false, .continuous = true },
|
|
1504
1507
|
},
|
|
1505
1508
|
// Transform
|
|
1506
1509
|
.{
|
|
@@ -2463,7 +2466,7 @@ pub const Move = enum(u8) {
|
|
|
2463
2466
|
FixedDamage,
|
|
2464
2467
|
FlameWheel,
|
|
2465
2468
|
FlinchChance,
|
|
2466
|
-
|
|
2469
|
+
FlyDig,
|
|
2467
2470
|
FocusEnergy,
|
|
2468
2471
|
ForceSwitch,
|
|
2469
2472
|
Foresight,
|
|
@@ -2847,6 +2850,20 @@ pub const Move = enum(u8) {
|
|
|
2847
2850
|
/// The number of Pokémon moves in this generation.
|
|
2848
2851
|
pub const size = 251;
|
|
2849
2852
|
|
|
2853
|
+
/// Pokémon moves that can be called by Metronome in this generation.
|
|
2854
|
+
pub const METRONOME = init: {
|
|
2855
|
+
var num = 0;
|
|
2856
|
+
var moves: [239]Move = undefined;
|
|
2857
|
+
for (1..Move.size + 1) |i| {
|
|
2858
|
+
if (Move.get(@enumFromInt(i)).extra.metronome) {
|
|
2859
|
+
moves[num] = @enumFromInt(i);
|
|
2860
|
+
num += 1;
|
|
2861
|
+
}
|
|
2862
|
+
}
|
|
2863
|
+
assert(num == moves.len);
|
|
2864
|
+
break :init moves;
|
|
2865
|
+
};
|
|
2866
|
+
|
|
2850
2867
|
/// Returns the `Data` corresponding to the move.
|
|
2851
2868
|
pub inline fn get(id: Move) Data {
|
|
2852
2869
|
assert(id != .None);
|
package/src/lib/gen2/data.zig
CHANGED
|
@@ -338,9 +338,8 @@ pub const Volatiles = packed struct(u128) {
|
|
|
338
338
|
frozen: bool = false,
|
|
339
339
|
_: u15 = 0,
|
|
340
340
|
|
|
341
|
-
bind_reason: u4 = 0,
|
|
342
|
-
bind: u4 = 0,
|
|
343
341
|
bide: u16 = 0,
|
|
342
|
+
bind: Bind = .{},
|
|
344
343
|
disabled: Disabled = .{},
|
|
345
344
|
rage: u8 = 0,
|
|
346
345
|
substitute: u8 = 0,
|
|
@@ -353,6 +352,11 @@ pub const Volatiles = packed struct(u128) {
|
|
|
353
352
|
protect: u4 = 0,
|
|
354
353
|
attacks: u4 = 0, // bide/thrashing/rollout turns
|
|
355
354
|
|
|
355
|
+
const Bind = packed struct(u8) {
|
|
356
|
+
duration: u4 = 0,
|
|
357
|
+
reason: u4 = 0,
|
|
358
|
+
};
|
|
359
|
+
|
|
356
360
|
const Disabled = packed struct(u8) {
|
|
357
361
|
move: u4 = 0,
|
|
358
362
|
duration: u4 = 0,
|