@pkmn/engine 0.1.0-dev.f3aaee39 → 0.1.0-dev.f3b63b86

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 (85) hide show
  1. package/LICENSE +1 -3
  2. package/README.md +77 -23
  3. package/build/pkg/addon/browser.d.ts +3 -0
  4. package/build/pkg/addon/browser.js +47 -0
  5. package/build/pkg/addon/browser.js.map +1 -0
  6. package/build/pkg/addon/node.d.ts +3 -0
  7. package/build/pkg/addon/node.js +110 -0
  8. package/build/pkg/addon/node.js.map +1 -0
  9. package/build/pkg/addon/wasm.d.ts +2 -0
  10. package/build/pkg/addon/wasm.js +53 -0
  11. package/build/pkg/addon/wasm.js.map +1 -0
  12. package/build/pkg/addon.d.ts +26 -4
  13. package/build/pkg/addon.js +39 -71
  14. package/build/pkg/addon.js.map +1 -1
  15. package/build/pkg/data/ids.json +12 -12
  16. package/build/pkg/data/layout.json +17 -4
  17. package/build/pkg/data/protocol.json +84 -13
  18. package/build/pkg/data.d.ts +27 -5
  19. package/build/pkg/data.js.map +1 -1
  20. package/build/pkg/gen1.d.ts +15 -18
  21. package/build/pkg/gen1.js +30 -21
  22. package/build/pkg/gen1.js.map +1 -1
  23. package/build/pkg/index.d.ts +42 -91
  24. package/build/pkg/index.js +23 -70
  25. package/build/pkg/index.js.map +1 -1
  26. package/build/pkg/protocol.d.ts +20 -1
  27. package/build/pkg/protocol.js +123 -102
  28. package/build/pkg/protocol.js.map +1 -1
  29. package/build/tools/debug.js +69 -74
  30. package/build/tools/debug.js.map +1 -1
  31. package/build/tools/display/debug.jsx +152 -0
  32. package/build/tools/display/debug.jsx.map +1 -0
  33. package/build/tools/display/index.js +152 -0
  34. package/build/tools/display/index.js.map +1 -0
  35. package/build/tools/display/ui.jsx +359 -0
  36. package/build/tools/display/ui.jsx.map +1 -0
  37. package/build/tools/display/util.js +33 -0
  38. package/build/tools/display/util.js.map +1 -0
  39. package/build.zig +273 -120
  40. package/package.json +64 -123
  41. package/src/bin/install-pkmn-engine +47 -21
  42. package/src/bin/pkmn-debug +1 -1
  43. package/src/lib/bindings/c.zig +200 -0
  44. package/src/lib/{binding → bindings}/node.zig +15 -32
  45. package/src/lib/bindings/wasm.zig +50 -0
  46. package/src/lib/common/array.zig +70 -0
  47. package/src/lib/common/data.zig +12 -24
  48. package/src/lib/common/debug.zig +32 -11
  49. package/src/lib/common/js.zig +3 -7
  50. package/src/lib/common/optional.zig +19 -18
  51. package/src/lib/common/options.zig +6 -0
  52. package/src/lib/common/protocol.zig +919 -430
  53. package/src/lib/common/rational.zig +341 -254
  54. package/src/lib/common/rng.zig +22 -15
  55. package/src/lib/common/util.zig +33 -1
  56. package/src/lib/gen1/calc.zig +706 -177
  57. package/src/lib/gen1/chance.zig +428 -302
  58. package/src/lib/gen1/data/moves.zig +193 -183
  59. package/src/lib/gen1/data/species.zig +4 -6
  60. package/src/lib/gen1/data/types.zig +9 -10
  61. package/src/lib/gen1/data.zig +60 -75
  62. package/src/lib/gen1/helpers.zig +90 -563
  63. package/src/lib/gen1/mechanics.zig +682 -600
  64. package/src/lib/gen2/calc.zig +150 -0
  65. package/src/lib/gen2/chance.zig +896 -0
  66. package/src/lib/gen2/data/items.zig +13 -21
  67. package/src/lib/gen2/data/moves.zig +664 -572
  68. package/src/lib/gen2/data/species.zig +2 -4
  69. package/src/lib/gen2/data/types.zig +139 -34
  70. package/src/lib/gen2/data.zig +121 -96
  71. package/src/lib/gen2/generated.zig +801 -0
  72. package/src/lib/gen2/helpers.zig +53 -38
  73. package/src/lib/gen2/mechanics.zig +3580 -29
  74. package/src/lib/napi.h +2 -0
  75. package/src/lib/node.zig +14 -0
  76. package/src/lib/pkmn.zig +125 -29
  77. package/src/lib/wasm.zig +13 -0
  78. package/src/tools/display/dom.ts +93 -0
  79. package/src/tools/display/ui.css +354 -0
  80. package/build/test/display.js +0 -400
  81. package/build/test/display.js.map +0 -1
  82. package/src/lib/binding/wasm.zig +0 -12
  83. package/src/lib/gen1/README.md +0 -892
  84. package/src/lib/gen2/README.md +0 -308
  85. package/src/test/display/pkmn.html.tmpl +0 -368
@@ -1,21 +1,20 @@
1
- const std = @import("std");
2
- const builtin = @import("builtin");
3
-
4
- const pkmn = @import("../pkmn.zig");
5
-
6
- const data = @import("../common/data.zig");
7
1
  const DEBUG = @import("../common/debug.zig").print;
8
- const rng = @import("../common/rng.zig");
9
- const util = @import("../common/util.zig");
10
2
 
3
+ const builtin = @import("builtin");
4
+ const calc = @import("calc.zig");
5
+ const chance = @import("chance.zig");
6
+ const data = @import("../common/data.zig");
7
+ const gen1 = @import("../gen1/data.zig");
11
8
  const items = @import("data/items.zig");
9
+ const mechanics = @import("mechanics.zig");
12
10
  const moves = @import("data/moves.zig");
11
+ const pkmn = @import("../pkmn.zig");
12
+ const protocol = @import("../common/protocol.zig");
13
+ const rng = @import("../common/rng.zig");
13
14
  const species = @import("data/species.zig");
15
+ const std = @import("std");
14
16
  const types = @import("data/types.zig");
15
-
16
- const gen1 = @import("../gen1/data.zig");
17
-
18
- const mechanics = @import("mechanics.zig");
17
+ const util = @import("../common/util.zig");
19
18
 
20
19
  const assert = std.debug.assert;
21
20
  const expectEqual = std.testing.expectEqual;
@@ -33,18 +32,23 @@ pub const LOGS_SIZE = if (builtin.mode == .ReleaseSmall)
33
32
  else
34
33
  std.math.ceilPowerOfTwo(usize, MAX_LOGS) catch unreachable;
35
34
 
35
+ /// Null object pattern implementation of pkmn.battle.Options for Generation II.
36
+ pub const NULL = pkmn.battle.options(protocol.NULL, chance.NULL, calc.NULL);
37
+
36
38
  const Choice = data.Choice;
37
39
  const ID = data.ID;
38
40
  const Player = data.Player;
39
41
  const Result = data.Result;
40
42
 
41
43
  const PointerType = util.PointerType;
44
+ const isPointerTo = util.isPointerTo;
42
45
 
43
46
  const showdown = pkmn.options.showdown;
44
47
 
45
48
  pub const PRNG = rng.PRNG(2);
46
49
 
47
50
  pub fn Battle(comptime RNG: anytype) type {
51
+ const padding = if (!showdown) 3 else 5;
48
52
  return extern struct {
49
53
  const Self = @This();
50
54
 
@@ -53,17 +57,19 @@ pub fn Battle(comptime RNG: anytype) type {
53
57
  turn: u16 = 0,
54
58
  field: Field = .{},
55
59
 
56
- pub inline fn side(self: anytype, player: Player) PointerType(@TypeOf(self), Side) {
57
- assert(@typeInfo(@TypeOf(self)).Pointer.child == Self);
60
+ _: [padding]u8 = @splat(0),
61
+
62
+ pub fn side(self: anytype, player: Player) PointerType(@TypeOf(self), Side) {
63
+ assert(isPointerTo(self, Self));
58
64
  return &self.sides[@intFromEnum(player)];
59
65
  }
60
66
 
61
- pub inline fn foe(self: anytype, player: Player) PointerType(@TypeOf(self), Side) {
62
- assert(@typeInfo(@TypeOf(self)).Pointer.child == Self);
67
+ pub fn foe(self: anytype, player: Player) PointerType(@TypeOf(self), Side) {
68
+ assert(isPointerTo(self, Self));
63
69
  return &self.sides[@intFromEnum(player.foe())];
64
70
  }
65
71
 
66
- pub inline fn active(self: *const Self, player: Player) ID {
72
+ pub fn active(self: *const Self, player: Player) ID {
67
73
  return player.ident(@intCast(self.side(player).pokemon[0].position));
68
74
  }
69
75
 
@@ -77,35 +83,32 @@ pub fn Battle(comptime RNG: anytype) type {
77
83
  };
78
84
  }
79
85
 
80
- // TODO
81
86
  test Battle {
82
- try expectEqual(496, @sizeOf(Battle(PRNG)));
87
+ try expectEqual(512, @sizeOf(Battle(PRNG)));
83
88
  }
84
89
 
85
- const Field = packed struct {
90
+ pub const Field = packed struct(u8) {
86
91
  weather: Weather = .None,
87
92
  weather_duration: u4 = 0,
88
-
89
- comptime {
90
- assert(@sizeOf(Field) == 1);
91
- }
92
93
  };
93
94
 
94
- const Weather = enum(u4) {
95
+ pub const Weather = enum(u4) {
95
96
  None,
96
97
  Rain,
97
98
  Sun,
98
99
  Sandstorm,
99
100
  };
100
101
 
101
- const Side = extern struct {
102
- pokemon: [6]Pokemon = [_]Pokemon{.{}} ** 6,
103
- active: ActivePokemon = .{},
104
- conditions: Conditions,
102
+ pub const Side = extern struct {
103
+ pokemon: [6]Pokemon = @splat(.{}),
104
+ active: ActivePokemon align(8) = .{},
105
+ conditions: Conditions = .{},
106
+ // NB: wLastPlayerCounterMove / wLastEnemyCounterMove (wLastPlayerMove / wLastEnemyMove)
105
107
  last_used_move: Move = .None,
106
- _: u8 = 0,
107
108
 
108
- const Conditions = packed struct {
109
+ _: [7]u8 = @splat(0),
110
+
111
+ const Conditions = packed struct(u32) {
109
112
  Spikes: bool = false,
110
113
  Safeguard: bool = false,
111
114
  LightScreen: bool = false,
@@ -115,55 +118,71 @@ const Side = extern struct {
115
118
  light_screen: u4 = 0,
116
119
  reflect: u4 = 0,
117
120
 
118
- comptime {
119
- assert(@sizeOf(Conditions) == 2);
120
- }
121
+ future_sight: FutureSight = .{},
122
+
123
+ const FutureSight = packed struct(u16) {
124
+ damage: u12 = 0,
125
+ count: u4 = 0,
126
+ };
121
127
  };
122
128
 
123
129
  comptime {
124
- assert(@sizeOf(Side) == 240);
130
+ assert(@sizeOf(Side) == 248);
125
131
  }
126
132
 
127
- pub inline fn get(self: anytype, slot: u8) PointerType(@TypeOf(self), Pokemon) {
128
- assert(@typeInfo(@TypeOf(self)).Pointer.child == Side);
133
+ pub fn get(self: anytype, slot: u8) PointerType(@TypeOf(self), Pokemon) {
134
+ assert(isPointerTo(self, Side));
129
135
  assert(slot > 0 and slot <= 6);
130
136
  const id = self.pokemon[slot - 1].position;
131
137
  assert(id > 0 and id <= 6);
132
138
  return &self.pokemon[id - 1];
133
139
  }
134
140
 
135
- pub inline fn stored(self: anytype) PointerType(@TypeOf(self), Pokemon) {
136
- assert(@typeInfo(@TypeOf(self)).Pointer.child == Side);
141
+ pub fn stored(self: anytype) PointerType(@TypeOf(self), Pokemon) {
142
+ assert(isPointerTo(self, Side));
137
143
  return self.get(1);
138
144
  }
145
+
146
+ pub fn lastMove(self: anytype, encore: bool) Move {
147
+ assert(self.last_used_move != .None or !self.active.volatiles.dirty);
148
+ if (encore) return self.last_used_move;
149
+ return if (self.active.volatiles.dirty) .None else self.last_used_move;
150
+ }
151
+
152
+ // TODO
153
+ // pub fn useMove(self: anytype) void {
154
+ // assert(side.last_selected_move != .None);
155
+ // self.last_used_move = side.last_selected_move;
156
+ // self.active.volatiles.dirty = false;
157
+ // }
139
158
  };
140
159
 
141
160
  // NOTE: DVs (Gender & Hidden Power) and Happiness are stored only in Pokemon
142
- const ActivePokemon = extern struct {
143
- volatiles: Volatile align(4) = .{},
161
+ pub const ActivePokemon = extern struct {
162
+ volatiles: Volatiles align(4) = .{},
144
163
  stats: Stats(u16) = .{},
145
- moves: [4]MoveSlot = [_]MoveSlot{.{}} ** 4,
164
+ moves: [4]MoveSlot = @splat(.{}),
146
165
  boosts: Boosts = .{},
166
+ types: Types = .{},
147
167
  species: Species = .None,
148
- item: Item = .None,
149
- last_move: Move = .None,
168
+
150
169
  _: u8 = 0,
151
170
 
152
171
  comptime {
153
172
  assert(@sizeOf(ActivePokemon) == 44);
154
173
  }
155
174
 
156
- pub inline fn move(self: anytype, mslot: u8) PointerType(@TypeOf(self), MoveSlot) {
157
- assert(@typeInfo(@TypeOf(self)).Pointer.child == Pokemon);
175
+ pub fn move(self: anytype, mslot: u8) PointerType(@TypeOf(self), MoveSlot) {
176
+ assert(isPointerTo(self, Pokemon));
158
177
  assert(mslot > 0 and mslot <= 4);
159
178
  assert(self.moves[mslot - 1].id != .None);
160
179
  return &self.moves[mslot - 1];
161
180
  }
162
181
  };
163
182
 
164
- const Pokemon = extern struct {
183
+ pub const Pokemon = extern struct {
165
184
  stats: Stats(u16) = .{},
166
- moves: [4]MoveSlot = [_]MoveSlot{.{}} ** 4,
185
+ moves: [4]MoveSlot = @splat(.{}),
167
186
  types: Types = .{},
168
187
  dvs: DVs = .{},
169
188
  hp: u16 = 0,
@@ -178,8 +197,8 @@ const Pokemon = extern struct {
178
197
  assert(@sizeOf(Pokemon) == 32);
179
198
  }
180
199
 
181
- pub inline fn move(self: anytype, mslot: u8) PointerType(@TypeOf(self), MoveSlot) {
182
- assert(@typeInfo(@TypeOf(self)).Pointer.child == Pokemon);
200
+ pub fn move(self: anytype, mslot: u8) PointerType(@TypeOf(self), MoveSlot) {
201
+ assert(isPointerTo(self, Pokemon));
183
202
  assert(mslot > 0 and mslot <= 4);
184
203
  assert(self.moves[mslot - 1].id != .None);
185
204
  return &self.moves[mslot - 1];
@@ -192,7 +211,7 @@ pub const Gender = enum(u2) {
192
211
  Unknown,
193
212
  };
194
213
 
195
- const DVs = packed struct {
214
+ pub const DVs = packed struct(u16) {
196
215
  gender: Gender = .Male,
197
216
  pow: u6 = 40,
198
217
  type: Type = .Dark,
@@ -200,10 +219,10 @@ const DVs = packed struct {
200
219
  pub fn init(g: Gender, p: u6, t: Type) DVs {
201
220
  assert(p >= 1 and p <= 40);
202
221
  assert(t != .Normal and t != .@"???");
203
- return DVs{ .gender = g, .pow = p, .type = t };
222
+ return .{ .gender = g, .pow = p, .type = t };
204
223
  }
205
224
 
206
- pub inline fn power(dvs: DVs) u8 {
225
+ pub fn power(dvs: DVs) u8 {
207
226
  return @as(u8, dvs.pow) + 30;
208
227
  }
209
228
 
@@ -217,13 +236,8 @@ const DVs = packed struct {
217
236
  };
218
237
  const p: u6 = @intCast(1 + ((5 * @as(u8, (dvs.atk & 0b1000) | ((dvs.def & 0b1000)) >> 1 |
219
238
  ((dvs.spe & 0b1000)) >> 2 | ((dvs.spc & 0b1000)) >> 3) + (dvs.spc & 0b0011)) >> 1));
220
- var t = @as(u8, dvs.def & 0b0011) + (@as(u8, dvs.atk & 0b0011) << 2) + 1;
221
- if (t >= @intFromEnum(Type.@"???")) t = t + 1;
222
- return DVs{ .gender = g, .pow = p, .type = @enumFromInt(t) };
223
- }
224
-
225
- comptime {
226
- assert(@sizeOf(DVs) == 2);
239
+ const t = @as(u8, dvs.def & 0b0011) + (@as(u8, dvs.atk & 0b0011) << 2);
240
+ return .{ .gender = g, .pow = p, .type = Type.hiddenPower(t) };
227
241
  }
228
242
  };
229
243
 
@@ -248,10 +262,12 @@ test DVs {
248
262
  try expectEqual(Gender.Female, dvs.gender);
249
263
  }
250
264
 
251
- const MoveSlot = packed struct {
265
+ /// Representation of a Generation II Pokémon's move slot in a battle.
266
+ pub const MoveSlot = extern struct {
267
+ /// The identifier for the move.
252
268
  id: Move = .None,
253
- pp_ups: u2 = 3,
254
- pp: u6 = 0,
269
+ /// The remaining PP of the move.
270
+ pp: u8 = 0,
255
271
 
256
272
  comptime {
257
273
  assert(@sizeOf(MoveSlot) == 2);
@@ -260,14 +276,19 @@ const MoveSlot = packed struct {
260
276
 
261
277
  pub const Status = gen1.Status;
262
278
 
263
- const Volatile = packed struct {
279
+ /// TODO
280
+ pub const TriAttack = enum(u2) { PAR, FRZ, BRN };
281
+
282
+ pub const Volatiles = packed struct(u128) {
264
283
  Bide: bool = false,
265
284
  Thrashing: bool = false,
285
+ BeatUp: bool = false,
266
286
  Flinch: bool = false,
267
287
  Charging: bool = false,
268
288
  Underground: bool = false,
269
289
  Flying: bool = false,
270
290
  Confusion: bool = false,
291
+
271
292
  Mist: bool = false,
272
293
  FocusEnergy: bool = false,
273
294
  Substitute: bool = false,
@@ -278,52 +299,55 @@ const Volatile = packed struct {
278
299
  Transform: bool = false,
279
300
 
280
301
  Nightmare: bool = false,
281
- Cure: bool = false,
302
+ Curse: bool = false,
282
303
  Protect: bool = false,
283
304
  Foresight: bool = false,
284
305
  PerishSong: bool = false,
285
306
  Endure: bool = false,
286
307
  Rollout: bool = false,
287
308
  Attract: bool = false,
309
+
288
310
  DefenseCurl: bool = false,
289
311
  Encore: bool = false,
290
312
  LockOn: bool = false,
291
313
  DestinyBond: bool = false,
292
- BeatUp: bool = false,
314
+ Trapped: bool = false,
293
315
 
294
- trapped: bool = false,
295
316
  switched: bool = false,
317
+ // TODO: replace with simply looking at Choice on Battle
296
318
  switching: bool = false,
319
+ // TODO: simply store both last moves on side
320
+ dirty: bool = false,
297
321
 
298
- _: u5 = 0,
322
+ frozen: bool = false,
323
+ minimized: bool = false,
324
+ _: u10 = 0,
325
+ // TODO: is this needed for unmodified stats?
326
+ transform: u4 = 0,
299
327
 
300
- bind: u4 = 0,
301
- future_sight: FutureSight = .{},
302
328
  bide: u16 = 0,
303
- disabled: Disabled = .{},
329
+ bind: Bind = .{},
330
+ disable: Disable = .{},
304
331
  rage: u8 = 0,
305
332
  substitute: u8 = 0,
306
333
  toxic: u8 = 0,
307
334
  confusion: u4 = 0,
308
335
  encore: u4 = 0,
336
+ // TODO merge with attacks (ie rollout/thrashing)? need to be zeroed at same time
309
337
  fury_cutter: u4 = 0,
310
338
  perish_song: u4 = 0,
311
339
  protect: u4 = 0,
312
- rollout: u4 = 0,
340
+ attacks: u4 = 0, // bide/thrashing/rollout turns
313
341
 
314
- const Disabled = packed struct {
315
- move: u4 = 0,
342
+ const Bind = packed struct(u8) {
316
343
  duration: u4 = 0,
344
+ reason: u4 = 0,
317
345
  };
318
346
 
319
- const FutureSight = packed struct {
320
- damage: u12 = 0,
321
- count: u4 = 0,
347
+ const Disable = packed struct(u8) {
348
+ move: u4 = 0,
349
+ duration: u4 = 0,
322
350
  };
323
-
324
- comptime {
325
- assert(@sizeOf(Volatile) == 16);
326
- }
327
351
  };
328
352
 
329
353
  pub fn Stats(comptime T: type) type {
@@ -358,7 +382,7 @@ test Stats {
358
382
  try expectEqual(@as(u16, 279), Stats(u16).calc("spe", base.spe, 15, 63001, 100));
359
383
  }
360
384
 
361
- pub const Boosts = packed struct {
385
+ pub const Boosts = packed struct(u32) {
362
386
  atk: i4 = 0,
363
387
  def: i4 = 0,
364
388
  spe: i4 = 0,
@@ -374,7 +398,7 @@ pub const Boosts = packed struct {
374
398
  };
375
399
 
376
400
  test Boosts {
377
- const boosts = Boosts{ .spd = -6 };
401
+ const boosts: Boosts = .{ .spd = -6 };
378
402
  try expectEqual(0, boosts.atk);
379
403
  try expectEqual(-6, boosts.spd);
380
404
  }
@@ -387,15 +411,10 @@ test Item {
387
411
  try expectEqual(Type.Normal, Item.boost(.PolkadotBow).?);
388
412
  try expectEqual(Type.Dark, Item.boost(.BlackGlasses).?);
389
413
 
390
- try expect(!Item.mail(.UpGrade));
391
- try expect(Item.mail(.FlowerMail));
392
- try expect(Item.mail(.MirageMail));
393
- try expect(!Item.mail(.TownMap));
394
-
395
- try expect(!Item.berry(.LightBall));
396
- try expect(Item.berry(.PSNCureBerry));
397
- try expect(Item.berry(.GoldBerry));
398
- try expect(!Item.berry(.MasterBall));
414
+ try expect(!Item.isMail(.UpGrade));
415
+ try expect(Item.isMail(.FlowerMail));
416
+ try expect(Item.isMail(.MirageMail));
417
+ try expect(!Item.isMail(.TownMap));
399
418
  }
400
419
 
401
420
  pub const Move = moves.Move;
@@ -404,8 +423,13 @@ test Move {
404
423
  try expectEqual(251, @intFromEnum(Move.BeatUp));
405
424
  const move = Move.get(.DynamicPunch);
406
425
  try expectEqual(Move.Effect.ConfusionChance, move.effect);
407
- try expectEqual(@as(u8, 50), move.accuracy);
408
- try expectEqual(@as(u8, 5), move.pp);
426
+ try expectEqual(rng.Gen12.percent(50), move.accuracy);
427
+ try expectEqual(rng.Gen12.percent(100), move.chance);
428
+ try expectEqual(@as(u8, 5), Move.pp(.DynamicPunch));
429
+ try expectEqual(@as(i8, -1), Move.get(.Counter).priority);
430
+ try expect(!move.effect.isHighCritical());
431
+ try expect(Move.get(.KarateChop).effect.isHighCritical());
432
+ try expect(Move.get(.RazorWind).effect.isHighCritical());
409
433
  }
410
434
 
411
435
  pub const Species = species.Species;
@@ -425,8 +449,9 @@ test Types {
425
449
  try expect(!Type.Steel.special());
426
450
  try expect(Type.Dark.special());
427
451
 
428
- try expectEqual(@as(u8, 3), Type.Water.precedence());
429
- try expect(Type.Bug.precedence() > Type.Poison.precedence());
452
+ try expectEqual(@as(u8, 3), Type.precedence(.Water, .Water));
453
+ try expect(Type.precedence(.Poison, .Bug) > Type.precedence(.Poison, .Poison));
454
+ try expect(Type.precedence(.Ice, .Fire) > Type.precedence(.Ice, .Water));
430
455
 
431
456
  try expectEqual(Effectiveness.Super, Type.effectiveness(.Ghost, .Psychic));
432
457
  try expectEqual(Effectiveness.Super, Type.effectiveness(.Water, .Fire));