Commit Graph

49 Commits

Author SHA1 Message Date
LegoFigure11
cad1d25c4d
Add Gen 8 BSS Factory (#7843) 2020-12-31 02:09:29 +04:00
Guangcong Luo
6e281dbe31 Move build-utils from lib to tools
The current idea is for `lib` to contain shared libraries useful to
many projects. `build-utils` is specific to this repo and so doesn't go
there.
2020-12-26 10:08:30 -08:00
MacChaeger
da64d93765 Runners: Support 4P (and max games) (#7700) 2020-12-13 20:26:39 +00:00
Annika
66c043086e Modlog converter: Fix crash without SQLite library 2020-11-07 13:40:07 -08:00
Annika
ec0a92469a Modlog: Make tests work without SQLite 2020-11-05 22:40:53 -08:00
Guangcong Luo
9b5217ab70
Split up dex-data into more files (#7634)
* Split up dex-data over individual files

This commit introduces:
- `dex-abilities.ts`
- `dex-conditions.ts`
- `dex-formats.ts`
- `dex-items.ts`
- `dex-moves.ts`
- `dex-species.ts`

These files centralize definitions from `dex-data` and `global-types`.

* Inherit ItemData from Item etc

Previously, Condition inherited from ConditionData. Now, ConditionData
inherits from Condition. The advantage of the new approach is that now,
Condition and DataCondition no longer need to be separate types, and
there should be much less duplication of type definitions in general.

This has also been done for

- ItemData/Item/DataItem
- AbilityData/Ability/DataAbility
- FormatData/Format/DataFormat

Species and DataSpecies was already merged, but this also reverses
their inheritance (saving a lot of duplicated definitions in the
process!)

The only one left is MoveData, which is just super complicated and
will need its own commit.
2020-11-05 05:00:13 -08:00
Annika
aa069ce8fd
Support disabling modlogs (#7619)
Co-authored-by: Christopher Monsanto <chris@monsan.to>
2020-11-02 22:59:31 -05:00
Annika
7f2dec0797
Modlog: Avoid optional properties in ModlogEntry (#7613)
* Modlog: Avoid optional properties in ModlogEntry

* Use a type

* Make IP nullable

* Add NOT NULL constrains

* Fix typo
2020-11-01 14:07:01 -08:00
Annika
2f130e8762
Modlog: Support logging to a SQLite database (#7513)
* Modlog: Support logging to a SQLite database

Co-authored-by: Christopher Monsanto <chris@monsan.to>
2020-10-30 19:27:25 -04:00
Guangcong Luo
a38f0597f8 Remove last vestiges of tslint 2020-10-27 22:49:00 +00:00
Annika
099346ee1e Tools: Modernize modlog entries for blacklists 2020-10-25 16:13:46 -07:00
Guangcong Luo
9d87616176
Add more style linting rules (#7537)
* Lint arrow-body-style

* Lint prefer-object-spread

Object spread is faster _and_ more readable.

This also fixes a few unnecessary object clones.

* Enable no-parameter-properties

This isn't currently used, but this makes clear that it shouldn't be.

* Refactor more Promises to async/await

* Remove unnecessary code from getDataMoveHTML etc

* Lint prefer-string-starts-ends-with

* Stop using no-undef

According to the typescript-eslint FAQ, this is redundant with
TypeScript, and they're not wrong. This will save us from needing to
specify globals in two different places which will be nice.
2020-10-19 02:42:28 -07:00
Annika
0877f0ae1e
Modlog: Fix entries with an IP address and no user (#7446) 2020-09-30 17:55:41 -07:00
Annika
f1b4e3d43a
Modlog: Refactor to use ModlogEntry objects (#7403) 2020-09-28 11:06:30 -07:00
Mia
deeed6c789
Remove sim/ and data/'s globals (#7091) 2020-08-07 06:44:15 -07:00
Kirk Scheibelhut
922d292322 Simplify @pokemon-showdown/sets and rename package
@smogon is the preferred namespace for packages (eg. @smogon/calc),
but the fact that this import logic previously contained code from
two non-Smogon sources made such naming awkward. Given the damage
calc didn't end up using these sources (and the Pokémon Showdown
client doesn't either), its simpler to just remove the logic for
third party imports entirely. This allows us to remove ugly 'hidden'
JSON5 dependency, as well as `smogon.com/` namespacing on the
sources.

This commit also tidies up the package.json and type definitions to
be more robust. It makes `--access public` the default when
publishing and cleans up unpkg support.

This is obviously a breaking change, but it's also a package rename
so we get to start the version from zero there :). A corresponding
commit will be added to the client to account for these changes.
2020-06-04 19:43:56 -07:00
Kirk Scheibelhut
6d7bf4e202 Improve battleOnly forme handling in set-import
With this change we no longer make requests to Smogon for battle
only formes (as they just get duped to their base forme), instead we
try to pull out sets for the battle-only forme based on their bases.
This also more gracefully handles the Zygarde/Necrozma edge case.
2020-05-03 23:02:10 -07:00
Kirk Scheibelhut
4754076efa Update for @pokemon-showdown/sets v0.4.0
- updates smogon package dependency to the latest version
- make sure no old artifacts are left around from previous runs
- revert change from 7aa42b12: for whatever reason we do encounter
instances where `typeof species.battleOnly !== 'string'` and
`throw`-ing means no sets get output.
2020-05-03 13:24:25 -07:00
Guangcong Luo
56f6ab5489 Fix Zygarde-Complete validation 2020-05-01 13:02:30 -07:00
Guangcong Luo
7aa42b1212 Remove Dex.getOutOfBattleSpecies
Literally every current use is a bug.
2020-04-30 23:29:20 -07:00
Guangcong Luo
f6f4467265 Turn on prefer-const for .js files
Not having prefer-const on the JS side makes JS -> TS refactors really
unreadable. This commit just auto-fixes it so we're using
`prefer-const` everywhere.
2020-04-23 11:37:47 -07:00
Guangcong Luo
a049d85a98 Fix build errors from TypeScript update
I'm not entirely sure why these two errors are cropping up now, but
they are.

The "thenable" one seems to be a bug, but in what?
2020-04-17 23:00:28 -07:00
Kirk Scheibelhut
50a6b4c967 Fix long ling in set-import/importer.ts 2020-04-01 20:01:43 -07:00
Kirk Scheibelhut
59bcdab260 Update deps to get newest smogon for set-import 2020-04-01 20:00:36 -07:00
Kris Johnson
994fc60aed
Rename Template to Species (#6478) 2020-03-25 23:29:27 -07:00
Guangcong Luo
62f432c6c3 Fix build error 2020-03-17 19:49:13 -07:00
Kirk Scheibelhut
86d3cc1174 Fix handling of missing format/level in sets 2020-03-17 15:03:43 -07:00
Kris Johnson
83ebdb27da
Add Dex#getOutOfBattleSpecies (#6463) 2020-03-16 20:31:38 +04:00
Guangcong Luo
64ff1da81f Refactor more things to use inheritsFrom 2020-03-10 09:59:36 -07:00
Kirk Scheibelhut
36b5b48d79 Add Gen 8 support for RandomPlayerAI and sim tools
- add support to the RandomPlayerAI for Dynamaxing
 - add support to ExhaustiveRunner for Gigantamax Pokemon
 - simplify range logic in RandomPlayerAPI
 - handle crash from toID (needed by data/scripts.js) and Config
	(needed if a Battle takes long enough to potentially allow for
	requesting ties) globals not being defined
 - mark Gen 8 formats as runnable by the runners
2020-03-08 20:56:59 -07:00
Guangcong Luo
647ba61a46 Turn on prefer-regex-exec in eslint 2020-03-07 13:39:02 -08:00
Guangcong Luo
125fe31d06 Improve eslintrc
Fixed some more code style, allowing these rules to be enabled:

- `comma-dangle`
- `function-paren-newline`
- `member-delimiter-style`
- `no-eval`
- `no-fallthrough`
- `no-misused-promises`
- `no-unused-vars`
- `operator-linebreak`
2020-03-06 22:35:55 -08:00
Guangcong Luo
2f0e83c14b Categorize eslintrc rules
eslintrc rules are now sorted into categories, in theory making them
easier to maintain.
2020-03-06 22:35:45 -08:00
Guangcong Luo
b21c9047e2
Migrate to typescript-eslint (#6342) 2020-03-05 08:33:06 -08:00
Kirk Scheibelhut
f3b666cc8c Use latestDate to simplify tools/set-import
The STATISTICS map was out of date anyway, this moves maintaining it
to the smogon package (which now has logic for updating it in an
automated way).
2020-03-02 17:47:39 -08:00
Kirk Scheibelhut
738fdc9c46 Update deps to get newest smogon for set-import 2020-03-02 16:31:59 -08:00
Kirk Scheibelhut
fdf5679a24 Update set-import stats to use latest stats logic
smogon@0.2.0 now supports the qualified naming transition period
at the end of Gen 6.
2020-02-27 17:00:40 -08:00
Kirk Scheibelhut
df8a7df29e Fix tools/set-import/stats and update for Gen 8 2020-02-26 10:16:42 -08:00
Kirk Scheibelhut
7bf4c01440 Zero sub-versions in set-import on version bump 2020-02-25 14:59:58 -08:00
Kirk Scheibelhut
37a331a4cb Get tools/set-import to work again
- a scripts.js init() method now calls toID
- Smogon updated the format of moveslots
2020-02-25 14:49:38 -08:00
Spandan Punwatkar
b6b66de896 Update Repo Links (#6102) 2019-11-28 12:47:38 +04:00
Kirk Scheibelhut
71bc4d5c05 Update tools/set-import for Gen 8 2019-11-25 15:32:12 -08:00
Kirk Scheibelhut
bfc0b0d75d Fix typos in set-import docs 2019-09-20 12:55:17 -07:00
Kirk Scheibelhut
c8b7f515fd Add an explicit LICENSE file to sets package 2019-09-20 12:37:42 -07:00
Kirk Scheibelhut
19d768e00e Fix mistakes from #5749
- and error 'ls' found its way into the source
- the sets/{README.md,index.d.ts} were excluded which also meant
  the sets/ directory didn't exist, causing errors
- the command is `npm publish --access public` not `publish`
2019-09-10 21:16:49 -07:00
Kirk Scheibelhut
b9e5fcb387
Introduce set importer logic (#5749)
`node tools/set-import [version]` can be run to create a
`@pokemon-showdown/sets` package containing sets from Smogon, usage
stats and third party sources. Some notes:

- The build is set up so that `tools/set-import/importer.ts` is
  compiled to `tools/set-import/importer.js` - creating a
  `.tools-dist/set-import` directory for the sole artifact was
  deemed to be overkill
- The sets package is generated such that it can be used easily on
  Node or in a browser (where the large set JSON can be loaded
  asynchronously)
- Supported tiers/formats are mostly arbitrary - those popular
  enough to have a signficant playerbase or analyses on Smogon have
  been included, but additional formats can be added based on demand
- Some set information is redundant for ease of use by downstream
  users: certain formes are split out and information that could
  theoretically be inferred like level/ability/HP IVs are included
  to simplify parsing logic and make the sets more immediately
  available. This results in what should mostly be negligible
  size overhead.
- In a similar vein, display versions of effect names instead of IDs
  are used (name -> ID is trivial, ID -> name requires data lookup)
- All sets pass validation, provided certain simple transformations
  are applied (eg. reverting `battleOnly` formes like Megas)

This tool has primarily been tested to run on Linux - running on
other platforms is not guaranteed to result in error-free output.
2019-09-10 21:15:05 -04:00
Guangcong Luo
7436c1f0f2 Remove import = and export =
`import =` and `export =` are really only intended for backwards
compatibility with CommonJS. While I really don't like the new module
system TC39 has designed for us, it's what we should be using, and
consistency is important.
2019-05-16 01:27:07 +04:00
Kirk Scheibelhut
df3d9b91ef Battle toJSON/fromJSON (#5427) 2019-04-30 14:48:27 +12:00
Kirk Scheibelhut
4975f1902b Move simulator harness to sim/tools (#5451) 2019-04-18 04:17:07 +09:30