@pkmn/engine 0.1.0-dev.d3e796d5 → 0.1.0-dev.d56bdadd

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.
@@ -135,12 +135,9 @@ pub const Pokemon = struct {
135
135
  }
136
136
  assert(p.moves.len > 0 and p.moves.len <= 4);
137
137
  for (p.moves, 0..) |m, j| {
138
- pokemon.moves[j] = .{
139
- .id = m,
140
- .pp_ups = 3,
141
- // NB: PP can be at most 61 legally (though can overflow to 63)
142
- .pp = @intCast(@min(Move.get(m).pp / 5 * 8, 61)),
143
- };
138
+ pokemon.moves[j].id = m;
139
+ // NB: PP can be at most 61 legally (though can overflow to 63)
140
+ pokemon.moves[j].pp = @intCast(@min(Move.pp(m) / 5 * 8, 61));
144
141
  }
145
142
  pokemon.item = p.item;
146
143
  if (p.hp) |hp| {
@@ -189,11 +186,9 @@ pub const Pokemon = struct {
189
186
  const pp_ups: u8 =
190
187
  if (!opt.cleric and rand.chance(u8, 1, 10)) rand.range(u2, 0, 2 + 1) else 3;
191
188
  // NB: PP can be at most 61 legally (though can overflow to 63)
192
- var base = Move.get(m).pp;
193
- const max_pp: u8 = @intCast(base + pp_ups * @min(base / 5, 7));
189
+ const max_pp: u8 = @intCast(Move.pp(m) + pp_ups * @min(Move.pp(m) / 5, 7));
194
190
  ms[i] = .{
195
191
  .id = m,
196
- .pp_ups = pp_ups,
197
192
  .pp = if (opt.cleric) max_pp else rand.range(u8, 0, max_pp + 1),
198
193
  };
199
194
  }