Commit Graph

929 Commits

Author SHA1 Message Date
Guangcong Luo
3b4a3ba7e0 Improve custom rule validation
Stray spaces are now consistently allowed in `/tour rules` and
`/challenge`, but are not allowed in `formats.ts`.

Improves #6811
2020-10-28 02:18:52 +00:00
PartMan
062e42402d
Fix Custom Rules Error (#6811)
`/challenge [Gen 8] OU @@@ +Reshiram` failed earlier, since the rule wasn't trimmed.
2020-10-27 19:00:05 -07:00
Guangcong Luo
a38f0597f8 Remove last vestiges of tslint 2020-10-27 22:49:00 +00: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
7eafea8ee1 Add client text data
This syncs data/text to exactly match the client's data/text, in
preparation for them to be merged. The server's data/text will be
canonical, moving forward:

Relevant changes:

- A new file `data/text/default` has been added, for battle messages
  not associated with a move/item/ability.

- As One (Glastrier) and As One (Spectrier) should not have a start
  message; only As One itself.

- Hidden Power's `realMove` property does not belong in data/text
  and has been removed (it's still in data/moves where it belongs).
2020-10-27 16:56:08 +00:00
Guangcong Luo
5f8c36c616 Ban Gen 1 Japan-only event moves
Fixes #7516
2020-10-26 15:30:47 +00:00
May Evans
e102416793
Ban Japanese Gen 1 Events in Int Formats: Part 2 (#7581)
Co-authored-by: Guangcong Luo <guangcongluo@gmail.com>
2020-10-26 06:00:35 -07:00
urkerab
b90f03b77e
Calculate natures with 16-bit truncation (#7540)
Also fixes Let's Go! which wanted to override these but couldn't.
2020-10-25 16:54:43 -07:00
Guangcong Luo
c96b2d6248 Improve sim readme 2020-10-24 22:09:52 +01:00
Kris Johnson
a1058ac29c
Convert VGC 2020's mod to a pre-DLC2 mod (#7564) 2020-10-24 06:00:29 +04:00
The Immortal
381c8190c6 Fix Dragon Ascent Rayquaza validation 2020-10-24 04:58:05 +04:00
Marty-D
0f17b39dd3 As One cannot be suppressed, acquired, or removed 2020-10-23 19:13:27 -04:00
The Immortal
498e38502a Implement As One correctly 2020-10-23 21:10:18 +04:00
The Immortal
e9c62cb86d Prevent As One from being copied or removed 2020-10-23 18:01:51 +04:00
Leonard Craft III
4e6ff7e72c
Validator: Allow Hidden Ability Entei/Raikou/Suicune in Gen 8 natively (#7563) 2020-10-23 15:28:12 +04:00
The Immortal
80d368d1cb Update hidden ability legality 2020-10-23 06:49:43 +04:00
HoeenHero
daa6010ddb Validator: Reject sets with the Gigantamax flag that cant Gmax 2020-10-21 13:50:38 -04:00
Guangcong Luo
ebd1ed11e4 Fix typo in sim/README.md 2020-10-21 17:32:10 +01:00
Guangcong Luo
2faa3d635d Publish 0.11.3 to npm
PS's sim engine is now available on npm!

sim/README.md describes how to use it:

https://github.com/smogon/pokemon-showdown/blob/master/sim/README.md
2020-10-21 17:24:58 +01:00
Guangcong Luo
a55d3cd530 Fix crashes from using moves with no target
Specifically, if you target your ally and your ally uses Ally Switch
(causing you to target yourself), certain moves (including Thunder,
Hurricane, and SSA) crash. This has been fixed.
2020-10-19 18:10:25 +01:00
Guangcong Luo
958d22fc7f Improve error propagation in debuggers
Running `./pokemon-showdown simulate-battle` no longer catches/rethrows
errors. This should make debugging with something like VS Code's
built-in debugger much easier.
2020-10-19 18:09:22 +01:00
Guangcong Luo
49743a6a93 Fix crash from bad changesFrom type
Fixes #7544
2020-10-19 17:40:38 +01:00
Guangcong Luo
d6c650d545 Properly fix HP type corruption crash 2020-10-19 17:18:28 +01: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
7ebc4411e9
Fix Allowing Hidden Power with an undefined hpType (#7541) 2020-10-18 22:52:25 -04:00
Guangcong Luo
1c0c77ff6b
Update to TypeScript 4.0 (#7504) 2020-10-10 14:43:32 -07:00
Mia
fb23fc8733
/showteam: Properly handle nick/form names (#7489) 2020-10-08 13:31:29 -07:00
Kris Johnson
ee0e8828bf
Stop serializing the HIT_SUBSTITUTE const in state (#7485) 2020-10-06 22:43:21 -07:00
Mia
aba5dd1119
/showteam: Support nicknames (#7464) 2020-10-03 08:25:14 -07:00
Kris Johnson
9f0b6d64d0
Add new Pet Mods of the Season (#7455) 2020-10-02 21:08:29 +04:00
Kris Johnson
fa569c7a49
Add properties to see which Pokemon fainted last/this turn (#7452) 2020-10-01 16:31:45 -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
Guangcong Luo
2bcea34447 Support ./pokemon-showdown simulate-battle -S
simulate-battle now has a new option: --spectate.

As a recap:

-D --debug: simulate in debug mode

-R --replay: output only the omniscient (debug) replay, rather than the
  full stream

-S --spectate: output only the spectator replay, rather than the full
  stream
2020-09-29 15:28:07 -07:00
The Immortal
b67701d8a4
Add suspect tests plugin (#7427) 2020-09-27 15:41:04 -07:00
Guangcong Luo
d429d58bc6 Fix suspect test ladders
We deployed a new suspect test system a few months ago, but we had to
back out of it when it didn't work as expected. This fixes the bug that
made it not work. In the future, setting `rated: "[Gen 8] Format Name"`
in `formats.ts` will cause ladder games in that format to actually
go in the specified format's ladder, instead of its own.
2020-09-27 08:43:08 -07:00
The Immortal
a5a238d9f8 Improve IVs validation
- Fixes #7302
- Removes unnecessary duplicated checks for legendaries having perfect IVs
2020-09-25 04:00:47 +04:00
The Immortal
0d71ec82c3 Random Battle improvements 2020-09-22 11:56:21 +04:00
urkerab
5d714fbb56
Replace @ts-ignore with type assertions or other less unsafe constructs (#7390) 2020-09-19 02:07:48 -07:00
Leonard Craft III
302d6ff6fb
Add hidestats arg to showteam and improve output (#7357) 2020-09-14 16:33:34 -07:00
EvGym
b57b527f1c
Support custom-formats file (#7240) 2020-09-07 23:31:01 -07:00
Strahm, Jeffrey S.(S&T-Student)
188426490b Rename FormatsData to FormatData
(The name FormatsData is inconsistent with how we name other things;
especially since it's supposed to be data for a single format. It was
probably originally a typo. -Zarel)
2020-09-07 19:35:14 -07:00
urkerab
1bf873018c
Remove outdated getAwakeningValues function (#7331) 2020-09-07 17:00:53 -07:00
Guangcong Luo
ea8f52ce97
Move descriptions to data/text/ files (#7036)
This adds some new `data/text/` files, which are the new home for
item/move/ability descriptions, as well as in-game messages, in one
place for ease of translation.
2020-09-06 22:00:11 -07:00
Kris Johnson
8656d633ac
Format volatiles consistently (#7314) 2020-09-05 08:12:24 -07:00
Kirk Scheibelhut
8744adaeca Consistently use this.dex in TeamValidator
Additionally allows Dex to optionally be provided as a constructor
arg for clients which do not rely on a global Dex object
2020-08-29 22:51:54 -07:00
Kirk Scheibelhut
c14a651523 Make sim compatible with TS 4.0
Operands of delete operators must be optional in TS 4.0, casting to
any in destroy is analogous to the null! hack
2020-08-28 11:21:00 -07:00
The Immortal
d98bf1b0ca Validator: Fix Gastrodon-East 2020-08-26 15:57:00 +04:00
urkerab
7be58f2425
Tweak team stringification (#7250) 2020-08-23 04:24:49 -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
Kirk Scheibelhut
39c14e0868 Remove EBC staleness from abilities upon switching 2020-08-17 12:59:10 -07:00
Guangcong Luo
c9a1339a0c Use for-await in more places 2020-08-15 16:31:46 -07:00
Guangcong Luo
18948c8c2c Refactor ObjectReadStreams to use for-await
Regular ReadStreams still can't; I now believe they shouldn't have a
"default" read method, and you should explicitly choose whether you
want to read "by chunks as they become available", "by chunks of a
specific line" or "by a delimiter".

So you would specifically use `stream.byLine()` or
`stream.byChunk([size])`, which would return an
`ObjectReadStream<string>`.

Inspired by #7195
2020-08-15 15:11:53 -07:00
Marty-D
7b3023c236 Fix Stuff Cheeks
Thanks EeveeTrainer and DaWoblefet
2020-08-15 15:46:19 -04:00
Mia
fa7a0025e5
/showteam: Fix bugs (#7206) 2020-08-12 16:12:45 -07:00
Kris Johnson
5e255012bc
Add a 'bst' property to Species (#7138) 2020-08-12 12:06:09 -07:00
The Immortal
d79ca8eae5 Don't show EVs warning for level 1 Pokemon 2020-08-12 15:22:37 +04:00
Marty-D
479ea5a72b Validator: Fix passing down level up moves
and finish implementing `canHatch`
2020-08-08 17:17:45 -04:00
Mia
deeed6c789
Remove sim/ and data/'s globals (#7091) 2020-08-07 06:44:15 -07:00
Marty-D
cc8e3723de
Validator: Fix event Pokemon with separate learnsets 2020-08-06 16:14:43 -04:00
Leonard Craft III
9e82f05ebb
Gen 3-4: Fix Camouflage to change to Normal-type (#7130) 2020-08-06 14:54:57 -04:00
Kris Johnson
f96ec4fb05
Add strict types to tiers (#7135) 2020-08-06 00:41:42 -07:00
Mia
fd0f83ff8d
Add a command to show the user's team in battles (#7068) 2020-08-06 00:36:43 -07:00
Guangcong Luo
54027d62bd
Support custom ladders (#6541)
This allows formats to specify a different ladder than their own, for
their rated battles to go on.
2020-08-06 00:28:53 -07:00
The Immortal
ca983630c1 Add Ripen activation for berries 2020-08-03 20:11:47 +04:00
Leonard Craft III
95243cdb00
Don't leak target of two-turn charge moves (#7104) 2020-07-31 17:55:28 -07:00
Annika
05a9f9a1e5
Minor code quality improvements based on LGTM (#7092) 2020-07-30 14:24:37 -07:00
Kris Johnson
70edfaa64c
Add support for more OMs (#7084) 2020-07-30 05:22:21 +04:00
Guangcong Luo
4d09f7acde Rename more instances of Effect to Condition 2020-07-26 11:26:23 -07:00
Kris Johnson
e042c81310
Fix Gigantamaxing (#7054) 2020-07-24 15:40:27 -07:00
Guangcong Luo
2f805c93a2
Remove "Battle" prefix from data exports (#7039)
`BattlePokedex` is now `Pokedex`, `BattleItems` is now `Items`, etc.

I also renamed `Movedex` to `Moves` and `Statuses` to `Conditions`.

`TypeChart` isn't `Types` yet, because unlike the others, it's not
indexed by ID. That should probably be fixed one day.
2020-07-24 12:42:26 -07:00
Kris Johnson
00b88b521d
Handle Gigantamaxing properly (#7001) 2020-07-23 13:27:42 -07:00
The Immortal
beb0ad1288 Fix validation for unbreedable Pokemon
Thanks @nineage.
2020-07-22 01:17:50 +04:00
Kirk Scheibelhut
d3b898ef7c Normal |t:| protocol message in Runner's DualStream 2020-07-21 13:35:53 -07:00
Marty-D
10e4ecdc84 Clean up event priorities 2020-07-21 10:43:12 -04:00
Kirk Scheibelhut
12f9edd729
Add |t:| to support real-time replays (#6998) 2020-07-20 05:26:04 -07:00
The Immortal
e2d268747c Remove Gmax restrictions
Closes #6954
2020-07-18 21:04:09 +04:00
Kirk Scheibelhut
47492210dc Fix battle serialization post 994fc60a
Thanks JXCoder for finding this!
2020-07-17 12:49:59 -07:00
Kris Johnson
b5ff34f862
Add OM Snake Draft formats (#7009) 2020-07-17 16:55:55 +04:00
Jacob McLemore
30e420204a
Fix Fusion Bolt + Fusion Flare interaction when first move fails (#6991) 2020-07-10 16:29:53 -07:00
urkerab
09350a01bf
Centralise the check for a restricted species (#6973) 2020-07-07 15:30:37 -07:00
ACakeWearingAHat
f9699c1be0
Random Doubles Updates (#6962) 2020-07-06 12:48:48 +04:00
urkerab
6fb5b4e90d
Allow custom formats (e.g. for tours) to modify format restrictions (#6958) 2020-07-05 14:32:30 -07:00
Guangcong Luo
8fd572f1f6 Refactor BattleQueue to wrap Array
The old decision to make it extend Array was wrong, as clearly
illustrated by the problems with slice/splice.
2020-07-01 16:37:36 -07:00
Kris Johnson
7010e0286f
Add OMotM and RoA Spotlight for July 2020 (#6936) 2020-07-01 12:59:10 +04:00
urkerab
17e4cb49a4
Adjust fractional priority for latest research (#6928) 2020-06-29 12:09:10 -07:00
The Immortal
393e2b10ff Ice Face isn't affected by Neutralizing Gas 2020-06-29 21:48:26 +04:00
The Immortal
5e7af36442 Fix Illusion interaction with Dynamax 2020-06-28 16:41:02 +04:00
Kris Johnson
28a4a9a91e
Fix STABmons Move Legality (#6918) 2020-06-25 16:12:57 -07:00
Guangcong Luo
ffecbc289b Fix infinite loop in Pumpkaboo validation 2020-06-25 16:05:04 -07:00
Marty-D
1516a56a93
Fix Burning Jealousy and Lash Out 2020-06-22 16:01:59 -04:00
The Immortal
4b4e7a57fc Implement "battle-ready" mechanic
This allows past-gen event Pokemon to be used in VGC. Closes #6881.
2020-06-21 04:23:52 +04:00
Guangcong Luo
dffd9dbff8 Fix stream destroying
`SubprocessStream` wasn't getting properly destroyed.
2020-06-18 21:47:03 -07:00
The Immortal
8817ca88c7 Move unreleasedHidden and maleOnlyHidden to Pokedex 2020-06-18 17:44:44 +04:00
Kris Johnson
4156eef05d
Fix various Isle of Armor DLC moves (#6862) 2020-06-18 00:25:26 -07:00
Kris Johnson
e20178d69d
Isle of Armor: Pokemon (#6839) 2020-06-17 23:37:14 +04:00
Kris Johnson
6b8826df58
Isle of Armor: Moves (#6841) 2020-06-17 22:02:25 +04:00
Enigami
21685eb661
Fix various Stadium issues (#6838) 2020-06-16 14:27:09 -07:00
Kris Johnson
b0675d7ff2
Add National Dex UU (#6836) 2020-06-15 18:22:45 +04:00
Enigami
8825960c9a
Fix event validator for RBY Tradebacks (#6832) 2020-06-14 11:08:58 -07:00
Guangcong Luo
1e5b5ab465 Update Streams API with pushEnd/writeEnd
Previously, ending a read stream was `stream.push(null)`, and ending a
write stream was `stream.end()`. This was often confusing, and so now,
these are consistently `stream.pushEnd()` and `stream.writeEnd()`.

This refactor already found a bug in which `stream.end()` was used
where `stream.push(null)` should have been.

Also in this refactor: By default, `pushError` ends the stream. You can
pass `true` as the second parameter if the error is recoverable (the
stream shouldn't end).
2020-06-10 16:07:24 -07:00