This makes it so we no longer need to ad-hoc convert seeds from strings
to arrays when we get them from text protocols like the command line or
BattleStream's `reseed` command.
It also has the side benefit of making inputlogs very slightly smaller.
* Sim: Use a CSPRNG
* Add test
* fix test prng
* move prng test to others
* fix slight hack
* tf?
* Fuck this
* fucking lol
* fix crap
* i'm going to kill someone
* i hate state
* fix test
* Good work genius
* typo
* Fix exportinputlog
* Refactor for inputlog backwards compatibility
This is a pretty major refactor which is mostly unrelated to the
feature, but it does make the code a lot simpler.
* Readability pass
* Readability (again)
* Remove sodium-native dependency
* Refactor to serialize seeds in hex strings
(Also removes the Buffer dependency from PRNG, and slightly improves
comments.)
* Apparently << is 32-bit signed
* Readability
---------
Co-authored-by: Guangcong Luo <guangcongluo@gmail.com>
* Properly validate HP type for events
https://www.smogon.com/forums/threads/bug-report-validator.3754044/
* Update team-validator.ts
* Update team-validator.ts
* Update sim/team-validator.ts
Co-authored-by: urkerab <urkerab@users.noreply.github.com>
* Update team-validator.ts
Just some CamelCase...
* Prevent HP Stellar from being usable
https://www.smogon.com/forums/threads/bug-report-validator.3755718/
* Apply suggestions from code review
---------
Co-authored-by: urkerab <urkerab@users.noreply.github.com>
Co-authored-by: Kris Johnson <11083252+KrisXV@users.noreply.github.com>
* PoC deduplicate `Species` against parent mod
Have to punt on the deep equals for now.
* `DexSpecies`: Tweak dedup logic to be faster
* `DexSpecies`: Improve comments around dedup logic
* `DexSpecies`: Use utils deepEquals function for dedup
Significantly faster than the `assert` equivalent
* Preload data when using Dex.mod
With the initial introduction fo TypeScript at 3716f36,
``Dex.mod``, and ``Dex.format`` (nowadays ``Dex.forFormat``)
no longer ensured that the data cache has been filled.
Newer lazy-loading getter APIs were introduced, which were
intended to be used as a replacement for direct access to the
loaded data (``dataCache``).
However, these APIs were either not effective or not properly
used., as reflected by 43ef4d9, which reverted ``Dex.forFormat``
to its full capabilities.
Nevertheless, ``Dex.mod`` was left untouched, which results in a
footgun where ``Dex.forFormat('gen1randbats').gen == 1``, but
``Dex.mod('gen1').gen == 9``.
This commit brings back ``Dex.mod`` to its original behavior, so
that gen information is always there when it's needed.
* Add test for dex.mod(mod).gen
* Swap around test instructions
This is more reliable given the load order.