@pkmn/engine 0.1.0-dev.d716e940 → 0.1.0-dev.da4a0515

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 (57) hide show
  1. package/LICENSE +1 -3
  2. package/README.md +90 -56
  3. package/build/pkg/addon.js +9 -9
  4. package/build/pkg/addon.js.map +1 -1
  5. package/build/pkg/data/ids.json +12 -12
  6. package/build/pkg/data/layout.json +26 -4
  7. package/build/pkg/data/protocol.json +69 -12
  8. package/build/pkg/data.d.ts +4 -4
  9. package/build/pkg/data.js.map +1 -1
  10. package/build/pkg/gen1.js +15 -18
  11. package/build/pkg/gen1.js.map +1 -1
  12. package/build/pkg/index.d.ts +2 -1
  13. package/build/pkg/index.js.map +1 -1
  14. package/build/pkg/protocol.js +61 -42
  15. package/build/pkg/protocol.js.map +1 -1
  16. package/build/test/display.js +2 -2
  17. package/build/test/display.js.map +1 -1
  18. package/build/tools/debug.js +5 -4
  19. package/build/tools/debug.js.map +1 -1
  20. package/build.zig +154 -116
  21. package/package.json +53 -24
  22. package/src/bin/install-pkmn-engine +35 -22
  23. package/src/lib/common/battle.zig +17 -0
  24. package/src/lib/common/data.zig +19 -31
  25. package/src/lib/common/debug.zig +20 -11
  26. package/src/lib/common/js.zig +118 -0
  27. package/src/lib/common/optional.zig +67 -0
  28. package/src/lib/common/options.zig +9 -0
  29. package/src/lib/common/protocol.zig +906 -367
  30. package/src/lib/common/rational.zig +357 -0
  31. package/src/lib/common/rng.zig +35 -26
  32. package/src/lib/common/util.zig +12 -0
  33. package/src/lib/gen1/calc.zig +426 -0
  34. package/src/lib/gen1/chance.zig +1061 -0
  35. package/src/lib/gen1/data/moves.zig +202 -190
  36. package/src/lib/gen1/data/species.zig +5 -5
  37. package/src/lib/gen1/data/types.zig +10 -10
  38. package/src/lib/gen1/data.zig +99 -87
  39. package/src/lib/gen1/helpers.zig +599 -23
  40. package/src/lib/gen1/mechanics.zig +978 -710
  41. package/src/lib/gen2/calc.zig +143 -0
  42. package/src/lib/gen2/chance.zig +1315 -0
  43. package/src/lib/gen2/data/items.zig +14 -20
  44. package/src/lib/gen2/data/moves.zig +664 -570
  45. package/src/lib/gen2/data/species.zig +2 -2
  46. package/src/lib/gen2/data/types.zig +137 -34
  47. package/src/lib/gen2/data.zig +130 -92
  48. package/src/lib/gen2/generated.zig +806 -0
  49. package/src/lib/gen2/helpers.zig +16 -22
  50. package/src/lib/gen2/mechanics.zig +3591 -12
  51. package/src/lib/node.zig +131 -0
  52. package/src/lib/pkmn.zig +84 -2
  53. package/src/lib/wasm.zig +13 -0
  54. package/src/lib/binding/node.zig +0 -229
  55. package/src/lib/binding/wasm.zig +0 -10
  56. package/src/lib/gen1/README.md +0 -812
  57. package/src/lib/gen2/README.md +0 -309
@@ -1,4 +1,4 @@
1
- //! Code generated by `tools/generate` - manual edits will be overwritten
1
+ //! Code generated by `tools/generate` - manual edits will be overwritten.
2
2
 
3
3
  const std = @import("std");
4
4
 
@@ -11,15 +11,15 @@ const Type = data.Type;
11
11
  /// Representation of a held item in Generation II Pokémon.
12
12
  pub const Item = enum(u8) {
13
13
  None,
14
+ SoftSand, // Ground
15
+ HardStone, // Rock
16
+ MetalCoat, // Steel
14
17
  PinkBow, // Normal
15
18
  BlackBelt, // Fighting
16
19
  SharpBeak, // Flying
17
20
  PoisonBarb, // Poison
18
- SoftSand, // Ground
19
- HardStone, // Rock
20
21
  SilverPowder, // Bug
21
22
  SpellTag, // Ghost
22
- MetalCoat, // Steel
23
23
  PolkadotBow, // ??? (Normal)
24
24
  Charcoal, // Fire
25
25
  MysticWater, // Water
@@ -36,21 +36,21 @@ pub const Item = enum(u8) {
36
36
  Stick,
37
37
  ThickClub,
38
38
  FocusBand, // FocusBand
39
- BerryJuice, // Berry
40
39
  ScopeLens, // CriticalUp
41
40
  Leftovers, // Leftovers
42
41
  BerserkGene,
43
42
  LightBall,
43
+ Berry, // Berry
44
+ BerryJuice, // Berry
45
+ GoldBerry, // Berry
46
+ MintBerry, // HealSleep
44
47
  PSNCureBerry, // HealPoison
45
48
  PRZCureBerry, // HealParalyze
46
- BurntBerry, // HealFreeze
47
49
  IceBerry, // HealBurn
48
- BitterBerry, // HealConfusion
49
- MintBerry, // HealSleep
50
+ BurntBerry, // HealFreeze
50
51
  MiracleBerry, // HealStatus
52
+ BitterBerry, // HealConfusion
51
53
  MysteryBerry, // RestorePP
52
- Berry, // Berry
53
- GoldBerry, // Berry
54
54
  MasterBall,
55
55
  UltraBall,
56
56
  GreatBall,
@@ -216,21 +216,15 @@ pub const Item = enum(u8) {
216
216
  pub const size = 196;
217
217
 
218
218
  /// Returns a `Type` boosted by this item or `null` if the item is not a type-boosting item.
219
- pub inline fn boost(item: Item) ?Type {
219
+ pub fn boost(item: Item) ?Type {
220
220
  assert(item != .None);
221
221
  if (item == .PolkadotBow) return .Normal;
222
- return if (@enumToInt(item) <= 18) @intToEnum(Type, @enumToInt(item) - 1) else null;
223
- }
224
-
225
- /// Whether or not this item is a Berry.
226
- pub inline fn berry(item: Item) bool {
227
- assert(item != .None);
228
- return @enumToInt(item) > 30 and @enumToInt(item) <= 40;
222
+ return if (@intFromEnum(item) <= 18) @enumFromInt(@intFromEnum(item) - 1) else null;
229
223
  }
230
224
 
231
225
  /// Whether or not this item is Mail.
232
- pub inline fn mail(item: Item) bool {
226
+ pub fn isMail(item: Item) bool {
233
227
  assert(item != .None);
234
- return @enumToInt(item) > 60 and @enumToInt(item) <= 70;
228
+ return @intFromEnum(item) > 60 and @intFromEnum(item) <= 70;
235
229
  }
236
230
  };