Commit Graph

80 Commits

Author SHA1 Message Date
Mia
953da16164 Dexsearch: Remove dependence on the Chat global 2021-08-14 20:06:48 -05:00
Karthik
8b911cbf12
Remove LC Uber as a valid tier in /ds help text (#8399) 2021-07-15 08:15:03 -07:00
PartMan
dfb246d40f
Datasearch: Minor refactor (#8390)
This fixes/changes a couple things:

a) Long dexsearch queries now reject with an error instead of blindly trimming and giving stuff like ``retur could not be found in any of the search categories``.
b) Maxgen now works properly (before this, the maxgen parameter only worked if it was either the first term or if there were no spaces after the preceding comma).
c) Mod now allows spaces around the equals sign (`mod = SSB`) instead of matching properly and failing on the split.
d) Gen0 no longer works in abilitysearch / itemsearch (not that relevant, but since current behaviour is to block Gen 1/2, seems a bit weird to allow 0).
e) Gen X and Maxgen X now work in abilitysearch / itemsearch (before this, they'd give a blank 'no results found').
f) Gen X and Maxgen X now support multi-digit generations (well in advance before Gen 10 releases, but doesn't hurt to be ready).
2021-07-10 04:19:03 -07:00
Kris Johnson
598ac409e8 Rename Let's Go! mod to 'gen7letsgo' 2021-07-06 23:07:51 -06:00
PartMan
46a858f2be
Movesearch: Add defrost and reflectable aliases (#8359)
Added Magic Coat/Magic Bounce since those are intuitive terms to use while searching
2021-06-08 11:45:16 -04:00
fart
839075a166
Allow alternative parameters for dexsearches (#7847) 2021-05-30 16:13:39 -07:00
Distrib
0596c9ba6e
Datasearch: Increase in the number of pokemon generated in /randpoke (#8317) 2021-05-26 12:38:20 -07:00
Guangcong Luo
58c85ee125 Fix crash with min source gen in /learn 2021-05-17 04:30:00 -07:00
Guangcong Luo
9abbe47531
Support setting a default format/mod for commands in rooms (#8237) 2021-04-27 15:38:51 -07:00
Guangcong Luo
810aff74cd Namespace more server global types 2021-04-25 14:16:27 -07:00
Guangcong Luo
486f292904
Refactor everything to use Utils.sortBy (#8220)
A few uses of `array.sort()` have been left alone:

- sorting in `data/` because they aren't supposed to import anything

- `set-importer` because I still have no clue what that's for and what
  dependencies it is/isn't allowed to have

- `sort()` with no arguments used as a lexical sort (at which point
  `sortBy` offers no benefits)

All other cases have been replaced with `Utils.sortBy`, which should
be a massive increase in readability.

Sort orders should be much more readable now, without needing to puzzle
through sign issues. The order is always low-to-high, A-to-Z,
true-to-false.
2021-04-23 22:41:00 -07:00
Kris Johnson
e9e58c9f99 Dexsearch: Fix bug with mod parameters 2021-04-15 16:44:44 -06:00
Guangcong Luo
5233559183 Refactor Dex types 2021-04-08 07:08:56 -07:00
Guangcong Luo
13189fdb02
Update Dex API (#8181)
This is the change that renames:

- `Dex.getMove` -> `Dex.moves.get`
- `Dex.getAbility` -> `Dex.abilities.get`
- `Dex.getItem` -> `Dex.items.get`
- `Dex.getSpecies` -> `Dex.species.get`
- `Dex.getEffect` -> `Dex.conditions.get`
- `Dex.getNature` -> `Dex.natures.get`
- `Dex.getType` -> `Dex.types.get`
- `Dex.getFormat` -> `Dex.formats.get`

In addition, some other APIs have been updated:

- `getByID` methods have also been added to every other table.
- `Dex.moves.all()` now gets an array of all moves
  - Plus equivalent methods for `abilities`, `items`, `species`, `formats`, `natures`, `types`
  - Note: there's no `Dex.conditions.all()`
- new API: `Dex.stats` for naming/iterating stats
- `Dex.getEffectByID` -> `Dex.conditions.getByID`
- `Dex.getType` -> `Dex.types.get`
- `Dex.data.Formats` -> `Dex.data.Rulesets`
- `Dex.formats` -> now an array `Dex.formats.all()`
- `Dex.getRuleTable` -> `Dex.formats.getRuleTable`
- `Dex.validateFormat` -> `Dex.formats.validate`

Team functions have been split off into a new `sim/teams` package:

- `Dex.packTeam` -> `Teams.pack`
- `Dex.fastUnpackTeam` -> `Teams.unpack`
- `Dex.generateTeam` -> `Teams.generate`
- `Dex.stringifyTeam` -> `Teams.export`

`Teams.export` has also been rewritten to better match how it works in client.

This implements #8178
2021-04-08 03:00:37 -07:00
Distrib
0bd9f47324
Datasearch: Improve dexsearchhelp & movesearchhelp (#8066) 2021-03-21 18:42:04 -07:00
Kris Johnson
987c8d95d4 Datasearch: Fix crash 2021-03-03 12:44:30 -07:00
pyuk-bot
e3d13f821d
Dexsearch: use optional chaining in getMod() (#8091) 2021-03-01 12:09:57 -07:00
Mia
5d5b831275 Datasearch: Fix crash in PM 2021-03-01 12:46:13 -06:00
Kris Johnson
50fef2bc68 Fix crash in /ds 2021-03-01 10:32:08 -07:00
Kris Johnson
aeecf8d24c
Dexsearch: Add support for searching by mods (#8064) 2021-02-28 14:37:00 -08:00
Mia
76c10841ea
Lib: Add an index file for all exports (#7972) 2021-01-31 18:00:19 -08:00
Guangcong Luo
f4abf52f61 Fix QueryProcessManager type signatures 2021-01-30 11:35:35 -08:00
Adam Tran
14744879c8
Fix excluding variables in /ms (#7859) 2021-01-18 11:42:58 -06:00
The Immortal
3ae56399bd Label Pokemon banned from LC as NFE 2021-01-11 00:29:18 +04:00
Guangcong Luo
6b3a3070c9 Refactor team validator for readability
`checkLearnset` has been renamed `checkCanLearn`.

`reconcileLearnset` has been replaced with `validateMoves`, which
bundles the actual `checkCanLearn` calls with the old
`reconcileLearnset`, making for a better name.
2021-01-03 23:26:20 -08:00
PartMan
6597ef0f15
Add multi-hit as a parameter to /ms (#7855)
* Add multi-hit as a parameter to /ms

* Revert /help ds, add multihit to /help ms, fix TS

Code linted, let's go
'Tis coding at midnight
Save what had been tossed...
Bring back the older line...
The older line.

* ;-;

  1465 passing (25s)
  53 pending


> pokemon-showdown@0.11.4 posttest /home/partman/Documents/Code/pokemon-showdown
> npm run tsc


> pokemon-showdown@0.11.4 tsc /home/partman/Documents/Code/pokemon-showdown
> tsc


No idea why this wasn't caught.

* Fingers crossed
2021-01-03 11:42:27 -08:00
Guangcong Luo
ad656f67e4 Keep track of why moves can't be learned
The validator will now always know and be able to report exactly why
a move can't be learned, instead of sometimes not being able to figure
it out.
2021-01-03 09:53:04 -08:00
Instruct
e56d470671
Dexsearch: Add Strength Sap & Jungle Healing to list of recovery moves (#7851) 2020-12-30 02:29:59 +04:00
Adam Tran
6702decd95
Add Pivot moves as a /ms category (#7822)
* draft test

* Move search for pivot moves
2020-12-26 21:57:03 -08:00
MacChaeger
c86c5966d9
/dexsearch: Fix immunity check for Thousand Arrows (#7727)
Unlike /effectiveness and /coverage, /dexsearch doesn't need to support
arbitrary mods, so Thousand Arrows can be hard-coded as the only move to
ignore any immunities.
2020-11-24 10:12:53 -08:00
MacChaeger
2b4de5d9d5
Fix type immunity check in /ds weak and resists and disallow status moves (#7717) 2020-11-22 00:48:40 -08:00
MacChaeger
5d71b3a28f
Dexsearch: Support resists move and weak move (#7713) 2020-11-20 00:50:09 -08:00
Mia
db7cd135bd
Datasearch: Disallow 'all' search broadcasting in battles (#7686) 2020-11-11 14:37: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
PartMan
a4a3e385e8
Fix G-Max moves not showing up in movesearch (#7555)
Happened because G-Max moves had move.isNonstandard as 'Gigantamax'.
2020-10-28 13:02:37 -07:00
Guangcong Luo
c9759954b9 Remove sim/global-variables.d.ts
The sim no longer uses any global variables, so this can and should be
removed.

`server/global-variables` has also been cleaned up, since I'm working
on this.
2020-10-27 22:03:14 +00:00
Guangcong Luo
e8451f8104 Clean up imports
A lot of our code for child processes doesn't really follow our
original standards. This refactors them back to work the way they
were intended to.
2020-10-24 22:12:35 +01:00
ZardMX
3a4e1b1f47
Make Galar formes show up in /ds (#7447) 2020-10-19 03:19:04 -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
Kris Johnson
52fb644d9e
Update various datasearch commands (#7512) 2020-10-12 15:46:19 +04:00
Annika
969cde2e35 Datasearch: Limit arguments to 300 characters 2020-10-08 19:55:14 -07:00
Annika
f7eb0c9eae Datasearch: Use CommandContext#checkChat 2020-10-08 19:46:58 -07:00
Jeremy Tan Jie Rui
6e956aee51
Add documentation on maxgen parameter to /ds (#7451) 2020-10-01 09:40:17 -07:00
Guangcong Luo
3d68248efa Update to latest eslint
We're skipping two major typescript-eslint versions, so there are a
bunch of changes here, including:

- it's catching a lot of things it didn't catch in the past, for
  reasons unclear to me

- no-unused-vars has to be explicitly disabled in global-types now

- a lot of `ts-ignore`s were never necessary and have been fixed

- Crashlogger can now handle being thrown things that aren't errors.
  This has never been a problem in the past, but to satisfy TypeScript
	we might as well not die in a fire on the off chance someone tries to
	`throw null` or something.
2020-09-29 15:28:08 -07:00
Mia
44fc0123ad
Chat: Refactor CommandContext and PageContext to use ErrorMessage more (#7234) 2020-09-06 00:15:16 -07:00
Guangcong Luo
8d79bf9725 Rename Dex.deepClone to Utils.deepClone
`this.dex.deepClone` still exists as an alias to `Utils.deepClone` for
use in `data/`. I'll need to spend more time figuring out the correct
solution there.
2020-08-21 04:24:34 -07:00
Annika
c00e66b76d
Datasearch: Support excluding monotype Pokemon (#7214) 2020-08-15 15:44:46 -07:00
Kris Johnson
5e255012bc
Add a 'bst' property to Species (#7138) 2020-08-12 12:06:09 -07:00
Annika
1c5f989837
Datasearch: Allow all-only searches if sorted (#7182) 2020-08-08 01:11:46 -07:00
Mia
deeed6c789
Remove sim/ and data/'s globals (#7091) 2020-08-07 06:44:15 -07:00