@pkmn/engine 0.1.0-dev.af1565df → 0.1.0-dev.b9fb6eab

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,16 +55,21 @@ pub const Battle = struct {
55
55
  }
56
56
 
57
57
  pub fn random(rand: *PSRNG, opt: Options) data.Battle(data.PRNG) {
58
- return .{
58
+ var p1: u4 = 0;
59
+ var p2: u4 = 0;
60
+ var battle: data.Battle(data.PRNG) = .{
59
61
  .rng = prng(rand),
60
62
  .turn = 0,
61
63
  .last_damage = 0,
62
64
  .sides = .{ Side.random(rand, opt), Side.random(rand, opt) },
63
65
  };
66
+ battle.last_selected_indexes.p1 = p1;
67
+ battle.last_selected_indexes.p2 = p2;
68
+ return battle;
64
69
  }
65
70
  };
66
71
 
67
- fn prng(rand: *PSRNG) data.PRNG {
72
+ pub fn prng(rand: *PSRNG) data.PRNG {
68
73
  // GLITCH: initial bytes in seed can only range from 0-252, not 0-255
69
74
  const max: u8 = 253;
70
75
  return .{
@@ -206,10 +211,16 @@ pub const Pokemon = struct {
206
211
  }
207
212
  };
208
213
 
214
+ // cat src/test/showdown/blocklist.json | jq '."1".moves'
209
215
  fn blocked(m: Move) bool {
210
- // Binding moves are borked but only via Mirror Move / Metronome which are already blocked
216
+ if (Move.get(m).effect == .Binding) return true;
211
217
  return switch (m) {
212
- .Mimic, .Metronome, .MirrorMove, .Transform => true,
218
+ .Counter,
219
+ .Mimic,
220
+ .Metronome,
221
+ .MirrorMove,
222
+ .Transform,
223
+ => true,
213
224
  else => false,
214
225
  };
215
226
  }