pokemon-showdown/server
Guangcong Luo 71498d451d
New validator (#5840)
* Refactor validator

This is a major refactor intended to make the default rules easier to
understand, and also easier for OMs to bypass.

Removed rules:
- `Pokemon`: This is now `-Nonexistent`. Its previous name was intended
  to be interpreted as "simulate the Pokémon games exactly, and only
  allow what they allow". The new name should make it clearer that it
  mainly bans CAPs and other nonexistent Pokémon and functionality.
- `-Illegal`: This is now `Obtainable` (see below).
- `Allow CAP`: This is now `+CAP`. Instead of having a hardcoded rule,
  OMs can now be manually whitelist any pokemon/item/etc or group of
  them, overriding `-Nonexistent`.
- `Ignore Illegal Abilities`: This is now `!Obtainable Abilities` (see
  below).

`Obtainable` was previously `-Illegal`, and does the same thing: Makes
sure you have a regular Pokémon game with only Pokémon that can be
obtained without hacking.

But instead of being a ban, it's now a rule that does nothing by
itself, except contain more rules:
- `Obtainable Moves`
- `Obtainable Abilities`
- `Obtainable Formes`
- `Obtainable Misc`
- `-Nonexistent`
- `-Unreleased`

This allows OMs to piecemeal repeal and unban any of these individual
rules, instead of the previous approach of unbanning them all and
manually reimplementing every single validation you wanted to keep.

* Refactor PokemonSources into a class

This mostly just makes a lot of the weirder checks in the validator
substantially more readable.

This also renames `lsetData` to `setSources`, which should also help
readability.

* Validate Bottle Cap HP types

Fixes an issue reported here:

https://github.com/Zarel/Pokemon-Showdown/issues/5742#issuecomment-533850288

* Fix several move validation issues

Fixes #5742

We have a new MoveSource type: R for Restricted. R moves work like
level-up/tutor/TM moves, except you're limited to one R move.

- Shedinja move stolen from Ninjask in Gen 3-4 are now R moves instead
  of event moves. This allows them to coexist with Nincada egg moves.

- Necrozma-DW/DM now inherit moves/events from Necrozma (like Rotom,
  but with event validation). This allows them to be shiny.

- Pokemon can now get egg moves from their own evolutions. This fixes
  some Tyrogue, Charmander, and Treecko sets mentioned in #5742

- Some more C moves were added, fixing some Hitmontop and Chatot sets
  mentioned in #5742

* Improve ability/move compatibility validator
2019-10-06 04:21:30 +11:00
..
chat-plugins New validator (#5840) 2019-10-06 04:21:30 +11:00
static Move server code to server/ 2019-02-03 16:07:06 -06:00
tournaments Use void in promises to appease TSLint (#5827) 2019-10-03 19:08:30 +10:00
chat-commands.js Fix mistake in /avatar 2019-10-03 21:51:34 -04:00
chat-formatter.ts Correctly define global types for .ts files 2019-08-23 09:33:49 -07:00
chat.ts New validator (#5840) 2019-10-06 04:21:30 +11:00
config-loader.ts Fix config modification for unit tests (#5585) 2019-07-03 21:38:02 -07:00
global.d.ts Add a RoomID type (#5759) 2019-09-07 14:15:27 -05:00
globals.ts Correctly define global types for .ts files 2019-08-23 09:33:49 -07:00
index.js Typescript punishments (#5728) 2019-08-29 19:46:42 -05:00
ip-tools.ts Update datacenters and IP-tools (#5849) 2019-10-05 14:53:21 +10:00
ladders-local.ts Rename Room#id -> Room#roomid, User#userid -> User#id (#5826) 2019-10-03 18:57:38 +10:00
ladders-remote.ts Rename Room#id -> Room#roomid, User#userid -> User#id (#5826) 2019-10-03 18:57:38 +10:00
ladders.ts Rename Room#id -> Room#roomid, User#userid -> User#id (#5826) 2019-10-03 18:57:38 +10:00
loginserver.ts Correctly define global types for .ts files 2019-08-23 09:33:49 -07:00
monitor.ts Use void in promises to appease TSLint (#5827) 2019-10-03 19:08:30 +10:00
punishments.ts Use void in promises to appease TSLint (#5827) 2019-10-03 19:08:30 +10:00
room-battle.ts Use void in promises to appease TSLint (#5827) 2019-10-03 19:08:30 +10:00
room-game.ts Rename Room#id -> Room#roomid, User#userid -> User#id (#5826) 2019-10-03 18:57:38 +10:00
roomlogs.ts Use void in promises to appease TSLint (#5827) 2019-10-03 19:08:30 +10:00
rooms.ts Add Announcements (#5404) 2019-10-04 01:21:38 +10:00
sockets.js Track connection times and log probable ghosts (#5768) 2019-09-17 21:02:57 -07:00
team-validator-async.js Import Chat correctly (#5693) 2019-08-11 17:24:31 +02:00
users.ts Use void in promises to appease TSLint (#5827) 2019-10-03 19:08:30 +10:00
verifier.ts Remove hardcoded URLs in favor of Config.routes (#5557) 2019-07-01 10:19:21 -07:00