@pkmn/engine 0.1.0-dev.83de29ee → 0.1.0-dev.84cc1a02

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,12 +55,17 @@ 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
 
@@ -206,19 +211,16 @@ pub const Pokemon = struct {
206
211
  }
207
212
  };
208
213
 
209
- // TODO: uncomment once integration tests pass
210
- // fn blocked(m: Move) bool {
211
- // // Binding moves are borked but only via Mirror Move / Metronome which are already blocked
212
- // return switch (m) {
213
- // .Mimic, .Metronome, .MirrorMove, .Transform => true,
214
- // else => false,
215
- // };
216
- // }
217
-
214
+ // cat src/test/showdown/blocklist.json | jq '."1".moves'
218
215
  fn blocked(m: Move) bool {
219
216
  if (Move.get(m).effect == .Binding) return true;
220
217
  return switch (m) {
221
- .Counter, .Mimic, .Bide, .Metronome, .MirrorMove, .Transform => true,
218
+ .Counter,
219
+ .Mimic,
220
+ .Metronome,
221
+ .MirrorMove,
222
+ .Transform,
223
+ => true,
222
224
  else => false,
223
225
  };
224
226
  }