Template, Item, Move, and Ability are now classes. This guarantees that
`getTemplate`, `getItem` etc return objects that implement their
interfaces (they didn't before).
As of their current implementation, they require trusted resource
files. The plan is, whenever we support custom resource files, to pass
all their strings through `sanitizeName`. This won't prevent servers
from causing the client to behave unexpectedly, but it should prevent
any actual vulnerabilities.
In addition, pokemon forme icon index tables have been moved to
`battle-dex-data.ts`.
Previously, we used the `eval` hack to "import" our code into test
files. The biggest problem with that approach is that we don't get
line numbers.
Now, we're assigning relevant variables to globals in Node.js for
tests. It's ugly, but it works. There's no simple way to import local
variables only if we're in Node.
Ideally, we'd build this in two different ways: A .mjs file for Node,
and a .js file for the browser. Or maybe use UMD. I'll figure it out
later, I guess.
This spec file is, incidentally, Jest-compatible. I benchmarked and
Jest is noticeably slower right now, so I'll stick with Mocha, but
if we ever need Jest features, it'll be useful to be able to easily
switch.
I'm reasonably confident that the tslint settings are where I want
them to be, at this point. Going over the line length limit is a
warning, not an error, so I don't have to worry about that being
too harsh.
This makes it so a regular build will rebuild battle text, instead of
requiring a full build.
battle text is under active development, so this is pretty useful,
even if conceptually, text is purely a graphical thing and not actually
needed by headless battles.
This will probably be our last data sync, until I work out a new solution
for rebuilding learnsets-g6 without needing an old copy, so learnsets-g6
can be gitignored.
The reason an old copy is currently needed is because it was written back
when learnsets-g6 contained data on the order same-level moves were learned
(most pokemon have a lot of L1 moves, and the order is relevant for which
moves are kept and which moves are replaced if you catch the pokemon at
medium-low level.)
This information isn't present in learnsets.js, so learnsets-g6.js needs to
preserve that information from older copies of learnsets-g6.js.
This has of course been entirely irrelevant for years, because we never
encoded learnset order data in gen 7 in the first place. But the code for
doing so stayed around...
These files are now autogenerated by the build scripts, and depend
on files not even present on GitHub anyway.
(The minidex is a database of height/width for PS's animated GIF
sprites, for use by the animation engine. It also contains dex numbers
for use by pokemon icon spritesheets.)
Weather uses both 'activate':
The mysterious strong winds weakened the attack!
and 'upkeep':
The sandstorm is raging.
So keeping them on the same message type is complicated. PS already
uses `|upkeep|` to mark the beginning of the residual phase, so this is
a good name for this message type.
For now, only upkeep messages happening during the residual step are
here - Hail, Sandstorm, and Uproar. Messages that happen at other
times, such as Attract's "[POKEMON] is in love with [TARGET]!" remain
as "activate".