The callback code in TeamValidator and the functions that use it have
been refactored to use Promises.
Pretty much all signatures have been changed, for instance:
TeamValidator.validateTeamSync(format, team)
-> TeamValidator(format).validateTeam(team)
TeamValidator.validateTeam(format, team, callback)
-> TeamValidator(format).prepTeam(team) // returns a Promise
Validators are no longer cached since they're really lightweight. They
contain a format and a Tools instance, and Tools instances are already
cached in Tools anyway. This saves a tiny bit of RAM in exchange for a
tiny bit of CPU time, but more importantly makes the code more
readable.
I'm introducing a new pattern/API for managing the parts of code with
child processes - their process managers are now at .PM and are now
opt-in, so you can use them synchronously without needing to spawn
any processes.
Fixes#2448
Context in command-parser.js has been renamed CommandContext and
refactored to use ES6 classes. Its also subsumed the canTalk
function. Future iterations will probably put the parse function
inside it as well.
Implements Tools#toTimeStamp to support Node.js builds without ICU support,
which are currently the default. If/when that changes, we should be able to
use Date#toLocaleDateString, given that appropriate locale options are used.
There's a lot of discussion on this decision in the comments of 61e2cfca27
`this.speciesid === 'shedinja'` and `this.template.baseStats['hp'] === 1` do the exact same thing in Hackmons and Custom Game. They are both valid interpretations of:
```
0803E554 LDR R0, =0x12F
0803E556 CMP R7, R0
0803E558 BNE loc_0803E568
```
But this is disassembly. Who knows what the uncompiled code looks like? Maybe it's not even hardcoded; maybe the uncompiled code just checks a list of Pokémon whose base HP is 1, and if you change Shedinja's base HP in the source, it'll have more than 1 HP. You can't say whether it does or doesn't.
So the only question between `this.speciesid === 'shedinja'` and `this.template.baseStats['hp'] === 1` is: which is better for mods?
I would argue that `this.template.baseStats['hp'] === 1` is better for mods, since it lets you 1. change Shedinja's max HP, and 2. give other pokemon 1 max HP, all just by editing pokedex.js (without needing to edit the engine). To be fair, it makes it so you can't have a regularly-calculated 1-base-HP Pokémon (without editing the engine), but I think this is much less common than wanting to give Shedinja more HP and wanting to give other Pokémon 1 max HP combined. And as always, you can have whichever you want by editing the engine.
Now, you call the default behavior for Averagemons and Tier Shift "wrong", but this is only wrong if you define the stat changes in terms of hexediting the games' compiled data, not if you define the changes in terms of editing the source or in terms of what you'd expect. Which you are free to define it that way, but I don't like that definition and don't support hexediting as an excuse to make PS's behavior less intuitive for modders.