@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.
@@ -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
- var p1: u4 = 0;
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
- pub fn prng(rand: *PSRNG) data.PRNG {
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
- if (Move.get(m).effect == .Binding) return true;
210
+ // Binding moves are borked but only via Mirror Move / Metronome which are already blocked
217
211
  return switch (m) {
218
- .Counter,
219
- .Mimic,
220
- .Metronome,
221
- .MirrorMove,
222
- .Transform,
223
- => true,
212
+ .Mimic, .Metronome, .MirrorMove, .Transform => true,
224
213
  else => false,
225
214
  };
226
215
  }