@pkmn/engine 0.1.0-dev.4eeb346e → 0.1.0-dev.545e0ef3

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.
@@ -332,9 +332,7 @@ must be gleaned through the `Battle` state). Useful size and offset information
332
332
  the [`layout.json`](../../data/layout.json) which exists to simplify writing driver code.
333
333
 
334
334
  Documentation of the wire protocol used for logging traces when `-Dtrace` is enabled can be found in
335
- [PROTOCOL.md](../../../docs/PROTOCOL.md). Note that the
336
- [`pkmn-debug`](../../../README.md#pkmn-debug) tool exists to display the binary protocol and battle
337
- data in the browser for ease of debugging.
335
+ [PROTOCOL.md](../../../docs/PROTOCOL.md).
338
336
 
339
337
  ### `Battle`
340
338
 
@@ -478,8 +476,7 @@ Smogon](https://www.smogon.com/forums/posts/5933177/show):
478
476
  - Confusion self-hits use the wrong damage formula resulting in off-by-one errors (and also fail to
479
477
  account for an opponent's Reflect). Furthermore, the confusion self-hit damage will erroneously be
480
478
  inflicted to the confused user's substitute if the confused user had been attempting to use a
481
- self-targeting move. Finally, Pokémon Showdown erroneously considers the *uncapped* self-hit
482
- damage for the purposes of tracking the battle's last damage.
479
+ self-targeting move.
483
480
 
484
481
  Beyond the general bugs listed above, several move effects are implemented incorrectly by Pokémon
485
482
  Showdown. Some of these moves are [too fundamentally broken to be implemented](#unimplementable) by
@@ -489,25 +486,16 @@ the pkmn engine, but the following moves have their broken behavior preserved in
489
486
  incorrectly still gets applied to Bide's user.
490
487
  - **Leech Seed**: Leech Seed fails to heal its source side if a seeded target faints due to
491
488
  recoil/crash damage on Pokémon Showdown. Pokémon Showdown also updates the battle's last damage
492
- field with the uncapped Leech Seed damage if the residual damage is applied which has consequences
493
- for Bide and Counter.
489
+ field with the uncapped Leech Seed damage which has consequences for Bide and Counter.
494
490
  - **Pay Day**: Pay Day should still scatter coins if it hits (but doesn't break) and opponent's
495
491
  Substitute but doesn't on Pokémon Showdown.
496
492
  - **Flinch**: Flinching does not get cleared during move selection on Pokémon Showdown and is
497
493
  instead cleared in Pokémon Showdown's "residual" phase, meaning the flinch status gets erroneously
498
494
  preserved across fainting (as fainting triggers Pokémon Showdown's "instaswitch" behavior which
499
495
  skips end-of-turn residuals).
500
- - **Rage**: Rage boosts should still result in burn/paralysis [stat modification
501
- errors](https://pkmn.cc/bulba-glitch-1#Stat_modification_errors) but don't on Pokémon Showdown.
502
- Furthermore, Pokémon Showdown only builds Rage for Disable/Explosion (hit/miss) when attacking
503
- into a Substitute instead of all moves. Pokémon Showdown also implements the [Rage and Thrash /
504
- Petal Dance accuracy bug]( https://www.youtube.com/watch?v=NC5gbJeExbs) incorrectly, as the
505
- accuracy only gets written when the volatile is present which can lead to incorrect accuracy
506
- values on turns where Rage is used on the same turn as a move which modifies accuracy or evasion.
507
496
  - **Thrash** / **Petal Dance**: once a Pokémon is locked into a thrashing move they will lose all
508
497
  speed ties on Pokémon Showdown (due to the fact that if they win the speed tie their action will
509
- then get "changed" and inserted back into the queue after their opponent's action). Pokémon
510
- Showdown also implements accuracy incorrectly, as covered above.
498
+ then get "changed" and inserted back into the queue after their opponent's action).
511
499
  - **Freeze** / **Sleep**: Pokémon Showdown requires a move to be selected when a Pokémon is frozen
512
500
  or sleeping and uses that in the event that the status is removed while on the cartridge no
513
501
  selection is possible and no turn exists for the thawed/woken Pokémon to act except in the case of
@@ -532,8 +520,7 @@ the pkmn engine, but the following moves have their broken behavior preserved in
532
520
  Pokémon Showdown implementing the health check based on floating point division instead of integer
533
521
  divison like on the cartridge (meaning the Substitute 1/4 glitch will only occur if the Pokémon's
534
522
  maximum HP is evenly divisible by 4). Finally, Substitute also incorrectly blocks Dream Eater on
535
- Pokémon Showdown and will incorrectly still heal 1 HP for any draining moves if the attack does 0
536
- damage.
523
+ Pokémon Showdown.
537
524
 
538
525
  In addition to numerous cases where Pokémon Showdown uses the wrong type of message (e.g. `|-fail`
539
526
  vs. `|-miss|` vs. `|-immune|`, e.g. in the case of Leech Seed) which are not documented here, Pokémon
@@ -17,16 +17,16 @@ const expectEqual = std.testing.expectEqual;
17
17
  const expect = std.testing.expect;
18
18
 
19
19
  /// The minimum size in bytes required to hold all Generation I choice options.
20
- pub const MAX_CHOICES: usize = 9; // move 1..4, switch 2..6
20
+ pub const MAX_OPTIONS: usize = 9; // move 1..4, switch 2..6
21
21
  /// The optimal size in bytes required to hold all Generation I choice options.
22
- /// At least as large as MAX_CHOICES.
22
+ /// At least as large as MAX_OPTIONS.
23
23
  pub const MAX_LOGS: usize = 180;
24
24
 
25
25
  /// The maximum number of bytes possibly logged by a single Generation I update.
26
- pub const CHOICES_SIZE = if (builtin.mode == .ReleaseSmall)
27
- MAX_CHOICES
26
+ pub const OPTIONS_SIZE = if (builtin.mode == .ReleaseSmall)
27
+ MAX_OPTIONS
28
28
  else
29
- std.math.ceilPowerOfTwo(usize, MAX_CHOICES) catch unreachable;
29
+ std.math.ceilPowerOfTwo(usize, MAX_OPTIONS) catch unreachable;
30
30
  /// The optimal size in bytes required to hold the largest amount of log data possible from a
31
31
  /// single Generation I update. At least as large as MAX_LOGS.
32
32
  pub const LOGS_SIZE = if (builtin.mode == .ReleaseSmall)