@pkmn/engine 0.1.0-dev.53335a32 → 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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pkmn/engine",
3
- "version": "0.1.0-dev.53335a32",
3
+ "version": "0.1.0-dev.545e0ef3",
4
4
  "description": "A minimal, complete, Pokémon battle simulation engine optimized for performance",
5
5
  "repository": "github:pkmn/engine",
6
6
  "license": "MIT",
@@ -467,7 +467,7 @@ Documentation of the wire protocol used for logging traces when `-Dtrace` is ena
467
467
 
468
468
  In addition to its alternative [RNG semantics](#rng), Pokémon Showdown's implementation of the first
469
469
  generation of Pokémon contains a number bugs, [many of which are known and have been documented on
470
- Smogon](https://www.smogon.com/forums/threads/rby-tradebacks-bug-report-thread.3524844/#post-5933177):
470
+ Smogon](https://www.smogon.com/forums/posts/5933177/show):
471
471
 
472
472
  - moves on Pokémon Showdown can do 0 damage instead of failing or causing a [division-by-zero
473
473
  freeze](https://pkmn.cc/bulba-glitch-1#Division_by_0).
@@ -554,7 +554,7 @@ called out in the `|rule|` section at the beginning of a battle's log):
554
554
  `|rule|` section** in Generation I (or II) as the actual order of switches here does not have
555
555
  competitive implications like it does in Generation III, but it is still contrary to how the games
556
556
  work where the [host (Player 1)'s Pokemon would switch
557
- first](https://www.smogon.com/forums/threads/gen-3-on-ps-final-fixes.3527268/post-5989318).
557
+ first](https://www.smogon.com/forums/posts/5989318/show).
558
558
 
559
559
  Pokémon Showdown enforces several clauses *before* the battle: **Cleric Clause** (all Pokémon must
560
560
  have full HP and PP, and not have any status conditions prior to the battle), **Stat Tradeback
@@ -575,13 +575,12 @@ left up to a client to support.
575
575
 
576
576
  Numerous moves on Pokémon Showdown are broken not simply due to local issues in the implementation
577
577
  of their effects but instead due to **global issues** related to fundamental mechanics such as
578
- [broken move
579
- selection](https://www.smogon.com/forums/threads/rby-fight-button-simulation-improvements-fix-partial-trapping-improve-counter.3673280/#post-8655897),
580
- using move name instead of slot to determine move identity, implementing volatile statuses
581
- incorrectly or not understanding how moves which call other moves work means that it isn't possible
582
- to completely implement Pokémon Showdown's behavior for the following moves (the pkmn engine
583
- attempts to reproduce as much of the behavior that can be reproduced without making data structure
584
- changes or dramatically deviating from the correct control flow):
578
+ [broken move selection](https://www.smogon.com/forums/posts/8655897/show), using move name instead
579
+ of slot to determine move identity, implementing volatile statuses incorrectly or not understanding
580
+ how moves which call other moves work means that it isn't possible to completely implement Pokémon
581
+ Showdown's behavior for the following moves (the pkmn engine attempts to reproduce as much of the
582
+ behavior that can be reproduced without making data structure changes or dramatically deviating from
583
+ the correct control flow):
585
584
 
586
585
  - **Wrap**: Binding moves like Wrap are implemented on Pokémon Showdown with an artificial
587
586
  `partialtrappinglock` volatile as opposed to how it works on the cartridge which simply relies on
@@ -670,10 +669,10 @@ compatibility mode, the implications of these differences are outlined below:
670
669
  Finally, the **initial 10-byte seed for link battles on Pokémon Red cannot include bytes larger than
671
670
  the `SERIAL_PREAMBLE_BYTE`**, so must be in the range $\left[0, 252\right]$. This has implications
672
671
  on the first 10 random numbers generated during the battle and has [**non-trivial competitive
673
- implications**](https://www.smogon.com/forums/threads/rby-tradebacks-bug-report-thread.3524844/page-16#post-9068411)
674
- (at the start of the battle move effects become more likely, the ["1/256-miss"
675
- glitch](https://glitchcity.wiki/1/256_miss_glitch) cannot happen, Player 1 is more likely to win
676
- speed ties, etc) that Pokémon Showdown cannot replicate due to everything described above.
672
+ implications**](https://www.smogon.com/forums/posts/9068411/show) (at the start of the battle move
673
+ effects become more likely, the ["1/256-miss" glitch](https://glitchcity.wiki/1/256_miss_glitch)
674
+ cannot happen, Player 1 is more likely to win speed ties, etc) that Pokémon Showdown cannot
675
+ replicate due to everything described above.
677
676
 
678
677
  All of places in the link battle code where randomness is required are outlined below:
679
678
 
@@ -772,11 +771,8 @@ The pkmn engine attempts to adhere to certain naming conventions:
772
771
  ## Resources
773
772
 
774
773
  - [pret/pokered](https://github.com/pret/pokered/) disassembly
775
- - [Gen I Main Battle
776
- Function](https://www.smogon.com/forums/threads/past-gens-research-thread.3506992/#post-5878612) -
777
- Crystal_
774
+ - [Gen I Main Battle Function](https://www.smogon.com/forums/posts/5878612/show) - Crystal_
778
775
  - [Pokemon Showdown!](https://github.com/smogon/pokemon-showdown)
779
776
  - [List of glitches (Generation
780
777
  I)](https://bulbapedia.bulbagarden.net/wiki/List_of_glitches_(Generation_I))
781
- - [Pokémon Showdown RBY
782
- Bugs](https://www.smogon.com/forums/threads/rby-tradebacks-bug-report-thread.3524844/#post-5933177)
778
+ - [Pokémon Showdown RBY Bugs](https://www.smogon.com/forums/posts/5933177/show)
@@ -2758,8 +2758,10 @@ pub fn choices(battle: anytype, player: Player, request: Choice.Type, out: []Cho
2758
2758
  const m = active.moves[slot - 1];
2759
2759
  if (m.id == .None) break;
2760
2760
  if (m.id == side.last_selected_move) {
2761
- // Pokémon Showdown displays Struggle if limited to Bide when out of PP
2762
- const s = if (m.pp == 0 and m.id == .Bide) 0 else slot;
2761
+ // Pokémon Showdown displays Struggle if limited to Bide but unable to pick
2762
+ const struggle =
2763
+ m.id == .Bide and (m.pp == 0 or active.volatiles.disabled_move == slot);
2764
+ const s = if (struggle) 0 else slot;
2763
2765
  out[n] = .{ .type = .Move, .data = s };
2764
2766
  n += 1;
2765
2767
  return n;