Commit Graph

516 Commits

Author SHA1 Message Date
HoeenHero
4ced391d6b SSB: Apply various updates 2019-10-30 10:39:20 -04:00
WeWuzNidokangz
f7d66afe8a Fix !Obtainable Formes Battle Bond Greninja validation (#5913) 2019-10-29 03:31:21 +10:30
urkerab
bae434e606 Add a single event for a move's own immunity to a specific target (#5904) 2019-10-24 11:00:28 +10:30
Guangcong Luo
52df674a7f Properly fix Nidoqueen egg move crash
It turns out Nidorina can't breed, either.
2019-10-23 14:08:19 +10:30
Guangcong Luo
78e4d3945b Fix Nidoqueen egg move validation 2019-10-23 13:58:50 +10:30
Waleed Hassan
c88dfba1d1 Server: Reorganize TypeScript globals (#5903) 2019-10-21 14:39:59 +10:30
Guangcong Luo
77f7cb9fb0 Correctly validate Ash-Greninja 2019-10-18 14:37:23 +10:30
urkerab
00d6e9d741 Fix activation of Defiant and Competitive when boosts are maxed (#5895) 2019-10-18 13:32:07 +10:30
urkerab
5b9d0c8db6 Centralise invulnerability checks for No Guard and Lock-On (#5894) 2019-10-17 22:32:44 -04:00
urkerab
3bfec7bf2f Rename TryImmunity to Invulnerability (#5877)
It's a check for semi-invulnerability rather than any sort of immunity.
2019-10-16 20:12:12 -04:00
Guangcong Luo
6a32df9a81 Fix egg validation error in Gen 3 Weezing
This happened because the father checker was simplistic enough
that it didn't think to check Duskull for Pain Split, since
Dusclops learns it in future gens.
2019-10-16 12:34:00 +10:30
Guangcong Luo
92c0011b93 Fix HP Fighting Mega Latias validation 2019-10-15 21:00:40 +10:30
Konrad Borowski
3732641ea8 Mark items as items (not moves) during set validation
Fixes a bug which made Fightinium Z + Detect not considered to
be banned in 1v1 format.
2019-10-13 18:09:12 +02:00
urkerab
61faff236a Transform should copy the target's current weight (#5878) 2019-10-13 05:37:10 +11:00
Guangcong Luo
d6752954ef Further improve validator
- Tyranitar egg moves are fixed

- Staravia egg moves are now properly supported
  (9742ecf62f was a hack that caused the Tyranitar problem)

- Some Pokemon evolve by having a move in their learnset (like Piloswine
  with Ancient Power). These can only carry three other moves from their
  prevo, because the fourth move must be the evo move. This restriction
  doesn't apply to gen 6+ eggs, which can get around the restriction with
  the relearner.

Fixes #2287

(Except Shiftry and friends, but those are already tracked in
`rulesets:obtainablemoves`.)
2019-10-10 06:33:33 +11:00
Guangcong Luo
a750cd1d7a Fix crash when validating LC egg moves
I put in this `throw` because I thought this condition was impossible,
but it turns out it's possible! Good to know.
2019-10-09 06:50:45 -04:00
Guangcong Luo
5f1f230bde Fix forme validation in Hackmons
In formats without Obtainable Formes, we no longer validate bans as
if they were enabled.
2019-10-09 06:50:44 -04:00
Guangcong Luo
2adc80efe4
Improve egg validator (#5854)
Previously, we split gen 2-5 egg move validation into two phases,
`checkLearnset` where we searched for a valid father, and
`reconcileLearnset` where we made sure the father could learn the move
combination.

Egg move validation has now been completely moved out of these
functions and into `validateSource`, which calls `findEggMoveFathers`.

The new algorithm no longer requires `C` moves to be hardcoded into
`learnsets.js`, now doing a more thorough check validation for the
father's move combination. This should be slower than before, but
net performance should be massively improved due to two other
optimizations in this refactor:

- We no longer do any father-searching if the moveset can be obtained
  any other way - in particular, this means no more father validation
  in gen 6+ where all egg move combinations are legal anyway.

- We only check fully-evolved pokemon as fathers (because anything a
  prevo can learn, its evos can learn, too - yes, we remember to make
  exceptions for Salazzle, Combee, and future-gen evos)

In addition, `/learn` should now provide significantly better
information for egg move breeding, since it uses a more thorough check
instead of the validator's short-circuiting the moment it finds a valid
father.

This also improves some baby-only move validation, specifically fixing
the issue with Seismic Toss Charm Chansey.
2019-10-09 00:59:24 +11:00
urkerab
e717abe802 Require normal targets to be adjacent in Triples battles (#5852) 2019-10-09 00:56:51 +11:00
Guangcong Luo
3ddaebd181 Fix Let's Go Eevee/Pikachu-Starter validation 2019-10-07 01:58:56 +11:00
Guangcong Luo
bb9bfb8fcd Make validator bans/unbans apply in order
(Fixes an issue with RU's unban of Drought overriding NU's ban of
Drought.)
2019-10-06 17:54:28 +11:00
Guangcong Luo
c1ecbc6522 Fix misc validator bugs
- Repealing rules now always works, regardless of rule order
  (Fixes AAA validation)
- Fix a check for egg move hidden ability validation
  (Fixes a Gen 4 Dragon Dance Charizard set)
- Always ban AG when banning Uber
  (Fixes allowing Rayquaza-Mega in lower tiers)
- Fix ability validation in Let's Go
- Fix valid-move-combo dexsearch
2019-10-06 17:21:01 +11:00
Kirk Scheibelhut
691cf76de7 Fix EBC for external staleness via consumed Leppa 2019-10-05 15:41:18 -07:00
Guangcong Luo
2a93e9e05e Fix forme validator 2019-10-06 08:00:02 +11:00
Guangcong Luo
7a023746ba
Refactor battle.dex out of battle (#5851)
In most other similar systems, like TeamValidator, we use `thing.dex` instead of having it extend `ModdedDex`. Battle has always extended `ModdedDex`, though. This changes Battle to match the others.

This should fix an issue with `Battle.data` not being cached.

This also frees up Battle to extend ObjectReadWriteStream<string> in a future update.
2019-10-06 07:38:08 +11:00
Guangcong Luo
555bd9cdb8 Fix mega evolution ability validation 2019-10-06 07:34:51 +11:00
Guangcong Luo
70b1de52ec Fix egg move validator
`limitedEgg` shouldn't exist, but this is a stopgap for the new way
it works.
2019-10-06 07:17:18 +11:00
Guangcong Luo
3cd04c349e Fix missed conversions of validate -> obtainable 2019-10-06 04:32:23 +11:00
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
Waleed Hassan
da4b887054 Rename Room#id -> Room#roomid, User#userid -> User#id (#5826)
These should make it clearer that userids are IDs but roomids aren't.
2019-10-03 18:57:38 +10:00
urkerab
948257cce7 Change weight units to hectograms (#5765) 2019-10-03 14:00:16 +10:00
HoeenHero
3445da848a Move support for overwritting custom terrains to client.
This didnt work anymore anyways since setTerrain was moved from battle to field.
2019-09-27 22:53:49 -04:00
HoeenHero
7f7c2d9a95
Super Staff Bros Brawl Update (#5764) 2019-09-22 14:47:33 -04:00
Guangcong Luo
23a4b6ed66 Correctly ban illegal pokemon
Also support individual nonstandard bans in rule tables.

Fixes #5770
2019-09-11 20:49:29 -07:00
Guangcong Luo
c03499e037 Mark Pikachu/Eevee-Starter as Gen 7 2019-09-11 20:49:29 -07:00
Nol
a60dd6fb11 Fix typo (#5767) 2019-09-09 00:09:06 -05:00
Kirk Scheibelhut
4f70c022d6 Correct EBC switch condition to match the spec
"at least one team does not have the option of switching to a
non-stale Pokémon"
2019-09-01 16:17:36 -07:00
The Immortal
26dfe8fd9e Revamp Random Battle
- New ability ratings
- Improve move pools
- Allow non-status moves to be re-rolled if rejected (this fixes all undesired move set combinations)
- Update move & ability rejections
- New item possibilities
2019-09-01 19:40:53 +04:00
TheJetOU
20ced3f073 Fix linter warning in TeamValidator (#5700) 2019-08-13 17:25:54 +02:00
Kirk Scheibelhut
9ab3f5a668
Make /hotpatch fail if git history hasn't changed (#5688)
/forcehotpatch can be used to perform the hotpatch regardless.
2019-08-12 10:23:24 +02:00
Marty-D
7ed137dffd
Validator: Fix HA Raikou/Entei/Suicune legality in pentagon formats 2019-08-11 16:11:26 -04:00
Kirk Scheibelhut
25cea76a08
Change packed encoding of ability and gender
0|1|H|S saves minimal space over the ability ID and requires parsers have the data files, in addition to limiting the ability to search abilities in the teambuilder. Similar, gender can be elided most of the time and just chosen randomly if not specified.
2019-08-06 09:55:07 +02:00
Cole French
e3890fdae6 Prevent locked users from having Pokemon nicknames hidden in Cross Evolution (#5669) 2019-08-03 12:19:51 -05:00
Guangcong Luo
bf37e6a5fa Fix onModifyTemplate signature
This will intentionally fail CI. It's my hope that #5664 will pass it.
2019-08-01 16:13:08 -05:00
Kirk Scheibelhut
57dd3b527f Add isPokeball field to Items data (#5644) 2019-07-22 16:20:09 -05:00
Guangcong Luo
3db1d9916c Deduplicate Template definition
It turns out Template is the only remotely-easy type to merge the class
and interface for.

The others all have a bunch of event methods which would need to be
redefined on the class.
2019-07-19 18:20:42 -05:00
Guangcong Luo
516084d6a2 Deprecate and remove canUseRandomTeam
`canUseRandomTeam` was a feature intended to allow random teams to be
generated in custom games. I never added a UI for it, and nowadays we
have more than one Random Battle format anyway, so this flag no longer
makes any sense.

The new plan is to support "random team" custom rules, which should be
easier to implement and easier for users to understand.
2019-07-19 13:52:44 -05:00
Kirk Scheibelhut
875b02c816 Make Blitz/VGC Timer 'Rule' instead of 'ValidatorRule' 2019-07-17 12:14:35 -07:00
Guangcong Luo
0cc534092a Support timer rules 2019-07-16 16:03:02 -05:00
TheJetOU
ade29349c6 Send Elo rating in rated battles (#5595) 2019-07-11 02:38:49 -05:00