@pkmn/engine 0.1.0-dev.cf6f5d2c → 0.1.0-dev.d1b39ff0

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 (60) hide show
  1. package/LICENSE +1 -3
  2. package/README.md +95 -59
  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 +27 -5
  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.d.ts +2 -1
  11. package/build/pkg/gen1.js +38 -20
  12. package/build/pkg/gen1.js.map +1 -1
  13. package/build/pkg/index.d.ts +7 -4
  14. package/build/pkg/index.js.map +1 -1
  15. package/build/pkg/protocol.d.ts +4 -2
  16. package/build/pkg/protocol.js +65 -44
  17. package/build/pkg/protocol.js.map +1 -1
  18. package/build/test/display.js +15 -6
  19. package/build/test/display.js.map +1 -1
  20. package/build/tools/debug.js +5 -4
  21. package/build/tools/debug.js.map +1 -1
  22. package/build.zig +148 -126
  23. package/package.json +53 -24
  24. package/src/bin/install-pkmn-engine +35 -22
  25. package/src/lib/common/battle.zig +17 -0
  26. package/src/lib/common/data.zig +19 -31
  27. package/src/lib/common/debug.zig +22 -13
  28. package/src/lib/common/js.zig +118 -0
  29. package/src/lib/common/optional.zig +67 -0
  30. package/src/lib/common/options.zig +11 -0
  31. package/src/lib/common/protocol.zig +906 -367
  32. package/src/lib/common/rational.zig +454 -0
  33. package/src/lib/common/rng.zig +35 -26
  34. package/src/lib/common/util.zig +12 -0
  35. package/src/lib/gen1/calc.zig +802 -0
  36. package/src/lib/gen1/chance.zig +1159 -0
  37. package/src/lib/gen1/data/moves.zig +202 -190
  38. package/src/lib/gen1/data/species.zig +5 -5
  39. package/src/lib/gen1/data/types.zig +10 -10
  40. package/src/lib/gen1/data.zig +104 -90
  41. package/src/lib/gen1/helpers.zig +140 -42
  42. package/src/lib/gen1/mechanics.zig +1135 -773
  43. package/src/lib/gen2/calc.zig +135 -0
  44. package/src/lib/gen2/chance.zig +895 -0
  45. package/src/lib/gen2/data/items.zig +14 -20
  46. package/src/lib/gen2/data/moves.zig +664 -570
  47. package/src/lib/gen2/data/species.zig +2 -2
  48. package/src/lib/gen2/data/types.zig +137 -34
  49. package/src/lib/gen2/data.zig +130 -92
  50. package/src/lib/gen2/generated.zig +806 -0
  51. package/src/lib/gen2/helpers.zig +50 -26
  52. package/src/lib/gen2/mechanics.zig +3568 -12
  53. package/src/lib/node.zig +131 -0
  54. package/src/lib/pkmn.zig +81 -5
  55. package/src/lib/wasm.zig +13 -0
  56. package/src/test/display/pkmn.html.tmpl +5 -5
  57. package/src/lib/binding/node.zig +0 -229
  58. package/src/lib/binding/wasm.zig +0 -10
  59. package/src/lib/gen1/README.md +0 -804
  60. 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
  };