Commit Graph

1059 Commits

Author SHA1 Message Date
TheSupervillain
77bcaf4e33
Ignore 10000 speed upper limit in Custom Game (#8392) 2021-07-11 18:58:51 -07:00
Annika
e530cee6f1 Fix bugs with Sucrase build process 2021-07-11 11:54:22 -07:00
Annika
a499393c12 Fix build 2021-07-10 17:19:39 -07:00
Annika
491ce58234 Fix dex-formats in Sucrase build 2021-07-10 14:37:16 -07:00
Annika
c134195915
Use ts-node instead of Sucrase (#8369) 2021-07-09 19:59:22 -07:00
Kris Johnson
598ac409e8 Rename Let's Go! mod to 'gen7letsgo' 2021-07-06 23:07:51 -06:00
Guangcong Luo
3a4300e757 Always have a 1000-turn limit
Previously, you would need to opt into Endless Battle Clause to
have a 1000-turn limit. It is now enforced for all battles always.
2021-07-03 15:22:25 -05:00
Kris Johnson
9e217d34c2 Add July 2021 OMotM, LCotM, and RoA Spotlight 2021-07-01 10:47:55 -06:00
TheSupervillain
bfe92102c8
Gen 1: Fix Transform and Endless Battle Clause (#8372)
Gen 1 Endless Battle Clause now accounts for:

- frozen pokemon
- Struggle against Ghosts
- Ditto transforming into Ditto

Gen 1 Stadium now correctly simulates Transform failing in Transform-vs-Transform situations.
2021-06-28 22:42:16 -07:00
Marty-D
18446f02cc
Gen IV: Fix multi-hit behaviour while asleep 2021-06-14 17:18:45 -04:00
Guangcong Luo
8f87b6b84b Move packed team docs out of PROTOCOL.md
Packed team docs are now standardiszed in sim/TEAMS.md

(Also a bunch of smaller documentation improvements.)
2021-06-10 15:04:25 -07:00
Guangcong Luo
ea8e9df4e6 Further improve documentation 2021-06-10 09:17:58 -07:00
Guangcong Luo
ddb6010bb9 Support importing teams
We now have a `Teams.import` function. This supports importing teams
in any format, allowing it to be the backbone of a new series of
commandline functions, which support teams in any format.
2021-06-09 22:08:31 -07:00
Guangcong Luo
5d3b758564 Fix documentation 2021-06-09 19:19:43 -07:00
Guangcong Luo
a813a55679 Document changes and Dex
With Dex now having basic documentation, all our API documentation is
now inter-linked.
2021-06-09 17:51:49 -05:00
Guangcong Luo
f47e38c5ad Support building TS declarations
`./build decl` now builds TS declarations for everything exported by
`sim/`. Unfortunately, the built TS declarations still refer to global
types, so some things still have `any` type, but it's much better than
nothing.
2021-06-09 17:51:49 -05:00
Guangcong Luo
147b7e01c9 Export lib/ from sim/
This is a dumb hack, but it allows everyone to use PS's lib files
with `require('pokemon-showdown')`.

This is EXTREMELY unsupported and I make ZERO guarantees about API
stability.
2021-06-09 16:16:05 -05:00
Adam Tran
be2210f881
Fix Future Sight Life Orb interactions (#8357) 2021-06-08 11:48:10 -04:00
Marty-D
b830ceb818 Gen II, III: Implement Quick Claw properly 2021-06-07 12:26:50 -04:00
Guangcong Luo
da8f77ee4f Document Sim.Teams for NPM package 2021-06-06 10:29:40 -05:00
Guangcong Luo
74211859c9 Update to TypeScript 4.3
Changes relevant to our codebase:

- TypeScript now knows that `typeof id === 'string'`! A bunch of casts
  on `User | ID` or `Room | RoomID` are no longer necessary!!!

- `override` will protect against certain typoes, and we'll adopt it
  (and `--noImplicitOverride`) as soon as sucrase comes in

- `declare` is now required for properties we want to narrow the type
  of without directly overwriting - a good thing to use going forward,
	but very annoying to fix all our old code for
2021-05-26 14:16:54 -07:00
Guangcong Luo
743153ac32 Fix defaultLevel
defaultLevel should not be set to maxLevel if this would make teams break
maxTotalLevel.

Fixes a bug where level 100 pokemon were automatically set to higher
levels in cases where it didn't make sense.
2021-05-26 12:44:44 -04:00
Guangcong Luo
d555f6fe0d Fix max-len for long regexes
We use eslint-disable for max-len in a lot of places where we don't
actually need it. This fixes that.
2021-05-23 20:48:31 -07:00
Instruct
7143939f1c
Gen 6 Hackmons: Fix EV limit and comment (#8329) 2021-05-23 18:25:12 -07:00
Guangcong Luo
4a2d386c55 Fix VGC EV validation 2021-05-23 17:16:13 -07:00
Guangcong Luo
e511d5c646 Fix EV validation 2021-05-23 16:55:00 -07:00
Guangcong Luo
9c98ae5c87 Rules: Split "EV Limit" out from "Obtainable Misc"
"EV Limit = 510" is now its own rule which can be changed separately
from the rest of Obtainable Misc.

The rest of Obtainable Misc doesn't seem useful to break up, so I
haven't bothered.
2021-05-23 15:14:00 -07:00
Guangcong Luo
570d3d3d29 Fix Weezing-Galar from VC Koffing validation
This fixes an issue where a Weezing-Galar evolved from a Koffing
gotten from a Virtual Console transfer from RBY/GSC should be able
to have a non-Hidden Ability, but couldn't.

Thanks @Karthik99999 for bringing this to my attention.

Fixes #8327
2021-05-23 11:29:17 -07:00
Marty-D
008cfec4c3 Run events on future moves even while the user is not active
Fixes a regression in 16d078265b
2021-05-20 13:20:12 -04:00
Marty-D
866b5b7bb2 Check for a winner when Destiny Bond knocks out a Pokemon 2021-05-20 12:22:37 -04:00
Guangcong Luo
2936c55439 Rules: Add -no item and fix -all items
`no item` is now a fake item meaning "not holding an item", for the
purposes of the team validator. This means that `-no item` will force
all pokemon to carry items.

`all items` no longer includes not holding an item, so `-all items`
will now work as expected.
2021-05-17 04:22:24 -07:00
Leonard Craft III
f7465fd369
Gen I-II: Cap initial max PP at 61 (#8309) 2021-05-15 21:42:25 -07:00
Leonard Craft III
5a129fd1d7
Gen VII: Ignore user's Ability with Mold Breaker moves (#8306) 2021-05-15 14:38:21 -04:00
Marty-D
0a9aeb8fcd
Fix faint check mid-attack (#8297)
Only bother checking for a winner if the move's user is also fainted at the time, and check for a winner after the move completes.
2021-05-14 13:36:56 -04:00
pacmanboss256
4186ef5f4f
Refactor Mold Breaker effect (#8291) 2021-05-14 08:32:41 -04:00
Guangcong Luo
518ac11520 Validate Max Team Size
Fixes #8286
2021-05-13 23:45:55 -07:00
Karthik
ec2df7ceb4
Fix validator message for LGPE Pokemon (#8298) 2021-05-12 14:15:59 -04:00
Annika
62571c4907
Validator: Improve Gen 1 level validation (#8294) 2021-05-12 02:59:12 -07:00
Guangcong Luo
7e965b41a7 Revert timing for adding rules to field in #8274
It turns out rules need to be added before sides are initialized,
so that they can hook `ModifySpecies` during side initialization.

The proper way to fix this is pretty complex so this is just a hack.
2021-05-11 23:02:01 -07:00
Guangcong Luo
638c1e3ae8 Add "Max Move Count" value rule
Also stop enforcing 4 moves limit and 6 pokemon limit in `-Nonstandard`,
for the same reason we stopped enforcing the level 100 limit; any format
that explicitly wants it higher should automatically override it.
2021-05-07 02:16:24 -07:00
Guangcong Luo
880a5d9c06 Suppress crash when forfeiting after crash 2021-05-07 00:44:15 -07:00
Guangcong Luo
df42a795f9 Remove max level check from -Nonexistent
Anyone who sets a max level above 100 is opting in, so there's no
need to add a redundant check on top of that.
2021-05-06 21:19:04 -07:00
Guangcong Luo
36295dc27a
Simplify Team Preview events (#8274)
In format events:

`onFieldTeamPreview` has been renamed back to `onTeamPreview`. It's now
a custom event (like `onBegin`), rather than a field event.

Team Preview data has been entirely moved from `onBegin` into
`onTeamPreview`.

`onFieldStart` for formats/rules now happens after Team Preview, rather
than before. Use `onBegin` for things that happen before Team Preview.
2021-05-06 18:53:58 -07:00
Guangcong Luo
16e9a0eeec Fix bugs in value rule refactor 2021-05-06 07:49:17 -04:00
Guangcong Luo
55980d416c
Support value rules (#8267)
`teamLength`, `maxLevel`, `cupLevelLimit`, and `minSourceGen` no longer
exist as properties of `Format`. Instead, they're value rules that
become properties of `RuleTable`, and can be specified as custom rules
and inherited through rulesets like anything else.

See the PR for a full reckoning of changes:

https://github.com/smogon/pokemon-showdown/pull/8267
2021-05-06 01:16:16 -07:00
Guangcong Luo
1bf172fe7e Refactor: Move getTagRules inside RuleTable 2021-05-06 00:30:07 -07:00
Leonard Craft III
771c60d4b9
Improve self-hit confusion damage (#8264) 2021-05-04 13:44:13 -04:00
Guangcong Luo
edb45ebecc Refactor rule iteration 2021-05-04 04:50:58 -07:00
Guangcong Luo
c11dccb032
Rename and fix maxTeamSize (#8266)
`maxTeamSize` is a bad variable name (not that `teamLength.battle` is
any better, but that'll get fixed in a future refactor).

- Rename `maxTeamSize` to `chosenTeamSize`, to better indicate that
  this is the size after Team Preview, and that it is also the minimum
  size after Team Preview.

- Don't limit team sizes to 6 if `teamLength.battle` isn't specified.
  This removes an unnecessary `teamLength.battle` requirement in all
  Custom Game formats.

- Stop requiring `maxTeamSize` as a parameter for `battle.getRequests`.
  It's not even used except as a hint to the Preact client, and was
  never state in the first place.

- Stop supporting partial `side.chooseTeam`. This is an unused feature
  and removing it massively simplifies the code and fixes a bug in
  `cupLevelLimit` which definitely was not written with the
  understanding that `chooseTeam` could be partial.

- Fix a bug in #7929 which seemed to misunderstand what `teamsize` was
  for.
2021-05-04 00:31:05 -07:00
Marty-D
f853d63653 Revert "Don't check for a winner mid-attack"
This reverts commit 658b122ca8.
2021-05-01 19:25:47 -04:00