I originally thought this would have to be hardcoded, but actually this
can be coded slightly less hardly than expected!
Getting a Blissey with Present + Heal Bell in Gen 2 works like this:
- Teach Smeargle Present + Heal Bell
- Breed Present + Heal Bell into Snubbull
- Chainbreed Present + Heal Bell into Blissey
The main issue is that checking chainbreeding is very hard, so PS
mostly just takes the stance of "chainbreeding multiple moves is
probably impossible; hardcode exceptions".
BUT! BUT!!!!
Instead of hardcoding this exact move combination, we can actually
just hardcode the fact "the first step of chainbreeding is always legal
if the first father is Smeargle". Which I did and it works!
Process Manager is now lib/process-manager.js
It's been entirely rewritten to reflect what I think a process manager
API should look like.
In particular, there are now two Process Managers, QueryProcessManager
and StreamProcessManager.
Pass QueryProcessManager a pure-ish query function (sync or async) that
takes a JSON value and returns a JSON value, and PM.query() will
execute that function in a subprocess, and return a Promise for its
return value.
StreamProcessManager is the same idea: Pass it a function to create an
ObjectReadWriteStream, and PM.createStream() will create a stream in a
subprocess and return a stream connected to it.
Rooms now have their logging abstracted into their own file, which also
allows the rest of rooms.js to be simplified by a decent margin.
This is in preparation for using Redis as a backing for scrollback log
storage, which will give us a lot more RAM to work with.
My newest newest plan is actually to locally cache room scrollback, and
only read battle logs from Redis. This will make chatroom-joining
faster.
Ladder is now a subclass of Matchmaker, and all the APIs previously
attached to Matchmaker are now directly available in Ladder.
In addition, all functions that take a formatid are now of the form
`Ladders(formatid).function(other arguments)`
TODO: Reverse polarity; it makes more sense for Matchmaker to be
a subclass of Ladder. Fortunately, this wouldn't involve API changes.
The client now interprets `rel="noopener"` to mean "check links for
interstice whitelist", and bypasses the interstice if it's not there.
This is is the best approach for [[google links]] to bypass the
interstice, while not whitelisting all of Google because Google
redirects are not generally trustworthy.
This mainly adds support for parenthetical spoilers:
(parenthetical spoiler: these)
They'll be useful for closing any other autoclosing spans in the
future, but currently spoiler is the only one.
This new version supports significantly more client chat formatting
than before, and is more readable.
Also new: the `code` formatting now uses basically the same system as
Markdown, where you can use as many `` ` `` in a row as you want as
your delimiter.
I'm not really sold on "TeamValidatorAsync" as a class name or file
name, so I'm open to suggestions.
The long-term plan is to put TeamValidator in sim/ but this is in three
commits because I really want the right file to retain blame history.
BattleRoom is now GameRoom, a slightly more abstract room type capable
of holding any of a number of possible roomgames. Currently, battles
are the only such roomgame, but any future roomgame could possibly use
it.
Differences between ChatRoom and GameRoom:
- GameRooms start at the left, ChatRooms start at the right
- GameRooms have chat on the right, and a game area on the left, with a
view area at the top left and a controls area at the bottom left
- GameRooms retain all their logs, ChatRooms only retain the latest 100
lines
- GameRooms expire after 40 minutes of inactivity or 10 minutes of zero
online users (configurable in the future)
- GameRooms are guaranteed to have an associated game, while ChatRooms
may or may not
- spawning and setting up child processes is now handled by
ProcessManager#constructor rather than needing to be done manually for
each module that uses ProcessManager
- direct references to ProcessManager in ProcessWrapper were removed to
prevent dead ProcessWrapper instances from being leaked when hotpatching
- process-manager.js and verifier.js now use Typescript
* Rename Gen6 formats to have [Gen 6] in name
* Add Gen 6 format aliases for bots
Those will be removed later when bots will be updated to know
about new format names.
* Matchmaking: move battle logging back to Rooms.global
For now, logging should be dealt by the global room until logging can be
abstracted away from it. This makes it simpler to refactor the logic in
Matchmaker#startBattle to be handled by Rooms.createBattle where it belongs.
* Matchmaking: use Matchmaker#cancelSearch format parametre
Optimizes cancelling searches if the format is known
This abstracts matchmaking logic from the global room away to its own
module, allowing the two to be decoupled from each other entirely with
some refactoring.
Related to #3361
* Sockets: fix Sockets.killWorker not disconnecting connections
* Sockets: fix unit tests
- Fix crash when constructing mock sockets in certain cases
- Properly prevent workers from writing to stdout
- Fix race conditions in workers-related tests that were causing false
positives
* Tests: mock workers now more closely imitate sockets' workers
This helps catch cases where messages are being sent in the wrong order
to the workers, e.g. messages sent to sockets that no longer exist.