The sim no longer uses any global variables, so this can and should be
removed.
`server/global-variables` has also been cleaned up, since I'm working
on this.
This syncs data/text to exactly match the client's data/text, in
preparation for them to be merged. The server's data/text will be
canonical, moving forward:
Relevant changes:
- A new file `data/text/default` has been added, for battle messages
not associated with a move/item/ability.
- As One (Glastrier) and As One (Spectrier) should not have a start
message; only As One itself.
- Hidden Power's `realMove` property does not belong in data/text
and has been removed (it's still in data/moves where it belongs).
Specifically, if you target your ally and your ally uses Ally Switch
(causing you to target yourself), certain moves (including Thunder,
Hurricane, and SSA) crash. This has been fixed.
Running `./pokemon-showdown simulate-battle` no longer catches/rethrows
errors. This should make debugging with something like VS Code's
built-in debugger much easier.
* Lint arrow-body-style
* Lint prefer-object-spread
Object spread is faster _and_ more readable.
This also fixes a few unnecessary object clones.
* Enable no-parameter-properties
This isn't currently used, but this makes clear that it shouldn't be.
* Refactor more Promises to async/await
* Remove unnecessary code from getDataMoveHTML etc
* Lint prefer-string-starts-ends-with
* Stop using no-undef
According to the typescript-eslint FAQ, this is redundant with
TypeScript, and they're not wrong. This will save us from needing to
specify globals in two different places which will be nice.
We're skipping two major typescript-eslint versions, so there are a
bunch of changes here, including:
- it's catching a lot of things it didn't catch in the past, for
reasons unclear to me
- no-unused-vars has to be explicitly disabled in global-types now
- a lot of `ts-ignore`s were never necessary and have been fixed
- Crashlogger can now handle being thrown things that aren't errors.
This has never been a problem in the past, but to satisfy TypeScript
we might as well not die in a fire on the off chance someone tries to
`throw null` or something.
simulate-battle now has a new option: --spectate.
As a recap:
-D --debug: simulate in debug mode
-R --replay: output only the omniscient (debug) replay, rather than the
full stream
-S --spectate: output only the spectator replay, rather than the full
stream
We deployed a new suspect test system a few months ago, but we had to
back out of it when it didn't work as expected. This fixes the bug that
made it not work. In the future, setting `rated: "[Gen 8] Format Name"`
in `formats.ts` will cause ladder games in that format to actually
go in the specified format's ladder, instead of its own.
(The name FormatsData is inconsistent with how we name other things;
especially since it's supposed to be data for a single format. It was
probably originally a typo. -Zarel)
This adds some new `data/text/` files, which are the new home for
item/move/ability descriptions, as well as in-game messages, in one
place for ease of translation.
`this.dex.deepClone` still exists as an alias to `Utils.deepClone` for
use in `data/`. I'll need to spend more time figuring out the correct
solution there.
Regular ReadStreams still can't; I now believe they shouldn't have a
"default" read method, and you should explicitly choose whether you
want to read "by chunks as they become available", "by chunks of a
specific line" or "by a delimiter".
So you would specifically use `stream.byLine()` or
`stream.byChunk([size])`, which would return an
`ObjectReadStream<string>`.
Inspired by #7195
`BattlePokedex` is now `Pokedex`, `BattleItems` is now `Items`, etc.
I also renamed `Movedex` to `Moves` and `Statuses` to `Conditions`.
`TypeChart` isn't `Types` yet, because unlike the others, it's not
indexed by ID. That should probably be fixed one day.
Previously, ending a read stream was `stream.push(null)`, and ending a
write stream was `stream.end()`. This was often confusing, and so now,
these are consistently `stream.pushEnd()` and `stream.writeEnd()`.
This refactor already found a bug in which `stream.end()` was used
where `stream.push(null)` should have been.
Also in this refactor: By default, `pushError` ends the stream. You can
pass `true` as the second parameter if the error is recoverable (the
stream shouldn't end).