Commit Graph

181 Commits

Author SHA1 Message Date
Marty-D
3129669c1b Team Validator: Fix crash 2016-06-26 22:52:41 -04:00
The Immortal
192e7dc939 Fix crash with data searching commands 2016-05-26 07:01:56 +04:00
The Immortal
48b405b971 Fix event-only moves with illegal abilities 2016-05-26 05:41:34 +04:00
Marty-D
58c722d67d Validator: Fix legendary IV check 2016-05-22 08:40:58 -04:00
Marty-D
1aadbf46a0 Support a specific number of perfect IVs for event Pokemon 2016-05-21 12:46:34 -04:00
QuiteQuiet
0627c2a12d Support event Vivillons in team-validator (#2560) 2016-05-13 08:43:11 -04:00
Guangcong Luo
37f880e9fc Suppress constructor errors
Unless we want to change the syntax for data tables like pokedex.js,
'constructor' will always exist as a table key.

These changes represent the bare minimum to prevent this from
causing too-weird behavior.
2016-05-11 05:07:02 -04:00
The Immortal
289f267f7a Fix Kyurem formes 2016-05-10 15:44:54 +04:00
Guangcong Luo
fefb6f76bb Suppress crash in validator
This is a quick fix for the crash in validator, which seems to be
affecting Kyurem-Black/Kyurem-White event moves.
2016-05-10 05:39:05 -04:00
The Immortal
5db51a7091 Add in-game event data
And flag those as event only. This provides a more accurate database,
and some other flags are no longer needed.
2016-05-10 04:48:14 +04:00
The Immortal
0a5dfd649e Set possible shiny events
This prevents having duplicate events for cases where it’s possible to
obtain both shiny and non-shiny.
2016-05-08 02:29:02 +04:00
QuiteQuiet
63955aabd8 Add support for alternative models (#2539)
* Add aliases for alternate sprites

* Add support for alternate models for Pokemon
2016-05-04 11:20:50 -07:00
Guangcong Luo
4a995350bb Shim Array#includes
This also refactors everything to use Array#includes except data
and mods, which are large enough that I'll refactor them later
probably.
2016-05-04 02:55:18 -07:00
Guangcong Luo
5670e45017 Properly fix Mega validation 2016-05-03 16:32:55 -04:00
The Immortal
e05735546c Fix Megas validation 2016-05-04 00:09:03 +04:00
urkerab
2e14b782a7 Allow validation against a custom template (#2541) 2016-05-02 13:26:40 -07:00
urkerab
68af97f71d Always use Object.values(template.abilities) (#2543) 2016-05-02 12:18:40 -07:00
Ivo Julca
ce1fd87efd Split process manager class to its own file 2016-03-23 02:44:20 -05:00
Guangcong Luo
52cc7f2e37 Remove Object.values external dependency
An external dependency is kind of overkill when the only
implementation we need is three lines.

This also lets us write a more performant implementation that
omits the parts irrelevant to us.
2016-03-21 10:15:55 -05:00
Ivo Julca
3a8e58c966 Revert "Forcibly replace Object.values implementation from Sugar.js"
This reverts commit 3cce56f as it is no longer needed.
2016-03-21 02:22:01 -05:00
Ivo Julca
275f5cefe9 Fix support of non-multiprocess team validator 2016-03-21 02:18:25 -05:00
Guangcong Luo
b374f357f1 Fix bug in validator 2016-03-16 10:17:22 -05:00
Guangcong Luo
a125a3ed7b Remove sugar-deprecated 2016-03-16 09:51:23 -05:00
Guangcong Luo
e87fd32550 Refactor TeamValidator
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
2016-03-16 09:43:59 -05:00
Ivo Julca
3cce56f6d2 Forcibly replace Object.values implementation from Sugar.js 2016-03-10 17:18:53 -05:00
Ivo Julca
0281176fd1 Remove usage of Array|Object methods implemented by Sugar.js
Adds a dependency to shim Object.values until it's natively available.
2016-03-09 16:55:34 -05:00
Ivo Julca
bc1a46eee1 Deps: Deprecate sugar extensions 2016-03-09 16:31:44 -05:00
Marty-D
0c0a0ce403 Validator: Fix tradeback logic 2016-03-04 15:06:44 -05:00
The Immortal
5f91a8247a Add STABmons bans 2016-03-04 00:14:44 +04:00
The Immortal
9996235d07 Add new OMs of the Month 2016-03-01 20:28:48 +04:00
Guangcong Luo
04e36f1717 Fix crash in validator 2016-02-11 09:24:29 -06:00
Guangcong Luo
b665660608 Refactor for more ES6 features
Now that nodejs/node#3072 is mostly fixed, we can finally start using
Node 4+ features.

This refactor:

- uses arrow functions where appropriate

  Note that arrow functions still aren't used in Mocha, where `this`
  is sometimes meaningful.

  This also removes the need for .bind() nearly everywhere, as well
  as the `self = this` trick.

- refactors Validator and Connection into ES6 classes

- no longer uses Array#forEach for iterating arrays

  We strongly prefer for (let i = 0; i < arr.length; i++) because of
  performance reasons. Most forEaches have been replaced with for..of,
  though, which is 5x slower than the long-form loop but 2x faster
  than forEach, which is good enough outside of most inner loops.

  The only exception is tournaments, which is due for a more invasive
  refactor soon anyway.
2016-02-10 17:40:21 -06:00
Guangcong Luo
c5fb963cea Fix crash in validator 2016-02-09 12:31:18 -06:00
Guangcong Luo
8a8838552d Improve crashlogger
Crashlogger now supports passing in a dictionary of additional
information to report, so we no longer need to resort to making fake
errors.

The hadException parameter has now been removed entirely. I don't know
of a use case for it to be false.
2016-02-04 03:04:05 -06:00
Guangcong Luo
4264ab1029 Fix crash in validator 2016-02-01 23:08:21 -06:00
Guangcong Luo
883bcc5263 Fix event ability validator
The old code told me Tyranitar with Dragon Dance + Outrage needed to
have Guts (which is Larvitar's ability), which is clearly wrong.

The new code figures out the correct ability for the corresponding
ability slot.
2016-02-01 22:06:38 -06:00
Guangcong Luo
efa332547e Validator: Fix event/egg move interaction 2016-02-01 22:06:38 -06:00
Guangcong Luo
bb6100d699 Optimize validator a bit more
There's no need to push individual move sources if sourcesBefore covers
it.

Unfortunately, 5M and 5T come after 5E, so it's not nearly as optimal
as it could be...
2016-01-31 23:38:01 -06:00
Guangcong Luo
70e93eb8a2 Fix another crash in team validator 2016-01-31 23:16:42 -06:00
Guangcong Luo
38047539b4 Fix crashes in new validator 2016-01-31 22:26:21 -05:00
Guangcong Luo
6089e2b04c Validator: Fix Gen 2 tradeback check 2016-01-31 19:12:57 -06:00
Guangcong Luo
1da53454cb Validator: Support tradebacks in GSC
Joim's previous code apparently already did, but this implementation
does it correctly with the set-intersect system.

As an added bonus of correctly using the set-intersect system, it now
shows up properly in /gsclearn
2016-01-31 16:52:24 -06:00
Guangcong Luo
5b62f6bc0d Validator: Don't check abilities in gen 1-2 2016-01-31 12:51:35 -06:00
Guangcong Luo
f668d7207c Validator: Remove useless code 2016-01-31 04:40:33 -06:00
Guangcong Luo
1a69e7f9bc Replace indirect egg move conflict code
The old code had a number of huge logical errors, which led to various
ridiculous bugs like how gen 2 moves had to be in a certain order to
validate correctly.

The new code is rewritten from scratch and fixes all known problems in
the old code, and also applies it to all gens. Preliminary testing
hasn't revealed any flaws, so we'll see how this does in prod.
2016-01-31 04:07:07 -06:00
The Immortal
62258f4bce Fix perfect IV error message 2016-01-30 16:42:56 +04:00
Guangcong Luo
ddbb1a04ad Fix perfect IV count check
Previous check was requiring Latias-Mega to have 3 perfect IVs because
Latias-Mega is a gen 6 pokemon even though Latias itself isn't.

This also gives clearer error messages in the remaining situations.
2016-01-30 04:20:12 -08:00
Marty-D
dbb81b327a Validator: Fix shiny check for event-only moves 2016-01-27 17:47:09 -05:00
The Immortal
b969cae689 Add support for specific IVs in event Pokemon 2016-01-25 22:05:58 +04:00
Hector Garcia
3dce8eaff2 Add fastCheck flag to lsetData in checkLearnset
`fastCheck` allows for quick past-gen egg move searches
2016-01-11 20:50:20 +00:00