Previously, if we wanted to test if A was either 'B' or 'C', we would use
the pattern:
A in {B:1, C:1}
I actually don't know how common this pattern is; I just started using
it because I was tired of typing `A === 'B' || A === 'C'` all the time.
I never really liked it, though; the `:1` part made it kind of
blatantly a hack.
I did some testing and `['B', 'C'].includes(A)` is overall faster.
(A switch statement is around 20x faster still, but who wants to type
that much code?)
Anyway, the new standard is
['B', 'C'].includes(A)
Something something progress!
Previously, Berries would not activate after weather damage and before
other residual damage/healing.
According to: https://www.youtube.com/watch?v=FRI5PSekhR4
They should activate then. More research is needed to determine what
other situations Berries should activate but don't.
Rules for custom formats are once again sanitized and can be passed
around more easily by attaching them to the format's id.
Fixes:
- "Rule:" being required to add or remove a rule
- ruleset changes not being shown in battles
- the display of custom rules being affected by user input
- custom formats being broken by /hotpatch formats
Simulator instances still get their scripts included somewhat hackily,
but it's overall much less hacky than before. In particular, the
init code is now an actual constructor, allowing TypeScript to perhaps
validate it one future day.
I might regret supporting this syntax, but it's now possible to make
PS generate teams on the commandline using:
./pokemon-showdown generate-team [optional format name] [optional seed]
The output will be in packed team format (which can be pasted into
a teambuilder import box).
The seed-passing should make it significantly more straightforward to
debug team generation weirdness.
Random team generation scripts are no longer in scripts.js, but instead
in a new file random-teams.js.
The scripts are now also no longer run from inside battles, but in a
new team generator object. This makes it easier for external scripts
to generate random teams by running Dex.generateTeam(format).