Commit Graph

190 Commits

Author SHA1 Message Date
urkerab
e853a61d58 Validate the template later once we know the real species (#2786) 2016-09-27 23:53:40 -07:00
urkerab
1a191a696a Allow the banlist to specify a numeric limit of team properties (#2773) 2016-09-24 12:35:57 -07:00
Ivo Julca
22dc7befc0
Refactor validator to use template strings 2016-09-19 12:05:40 -05:00
urkerab
b507af3cc4 Report complex bans using the original text (#2528) 2016-09-15 17:02:12 -07:00
Ben Davies
d9c6fe54b2 ProcessManager: subclass to extend ProcessManager, unit tests setup (#2739)
Before, an options object containing properties and values to be used
was how decorated instances of the class would be created. This meant
the constructor could assign anything you feel like to `this`. Rather
than that, the constructor now assigns a strict set of values, and
methods are redefined in subclasses.

Basic unit tests were added to test if they could be written for after
the final refactor to fix the other memory leak here.
2016-09-09 15:51:49 -05:00
urkerab
c6e84562f7 teamHas should keep count of how many of each property the team has (#2735) 2016-09-05 04:27:11 -05:00
Marty-D
8fc3aff490 Validator: Add Hidden Ability condition for Florges line
Only Blue, Red, and Yellow Floette can be found in the Friend Safari, so Orange and White are currently unable to have Symbiosis.
This is done here since there's no reason to add teambuilder slots for them when they won't be tiered separately anyway.
2016-09-03 17:39:44 -04:00
Taylor Everding
1a1f64fe95 Remove .js extension from requires (#2725) 2016-08-30 00:04:40 -05:00
Quinton Lee
1daec1a8f4 Hide nicknames of Pokemon used by locked users (#2639) 2016-07-24 02:28:12 -06:00
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