Commit Graph

66 Commits

Author SHA1 Message Date
Kris Johnson
994fc60aed
Rename Template to Species (#6478) 2020-03-25 23:29:27 -07:00
The Immortal
1765d9fbfa Improve bbb4da013 2020-03-19 02:06:10 +04:00
The Immortal
c09044a777 Move gen property to Pokedex 2020-03-18 23:09:45 +04:00
The Immortal
bbb4da0131 Refactor forme data 2020-03-18 15:17:55 +04:00
Kris Johnson
3e26318758
Refactor learnsets.js (#6466) 2020-03-18 00:59:29 -07:00
Guangcong Luo
64ff1da81f Refactor more things to use inheritsFrom 2020-03-10 09:59:36 -07:00
The Immortal
84253d40ee Fix getPokemonPool 2020-03-10 17:43:03 +04:00
Kris Johnson
82a3fc7b94
Refactor [Gen 2] Random Battle (#6435) 2020-03-09 11:56:15 +04:00
Kris Johnson
86761e3577
Add Random Battles chat plugin (#6433) 2020-03-09 09:55:43 +04:00
The Immortal
f0ce9b76d4 Make gen8 the default mod 2020-03-07 14:00:13 +04:00
Waleed Hassan
8aa4f053bb
Use optional chaining and linter improvements (#6422)
This is mostly just a follow up to #6342.

`prefer-optional-chaining` was turned on and fixed in every location it
complained in. The transformed function [0] looks expensive from a
glance but from skimming through the replaced sites it doesn't appear
to be ran in any important place, so it should be OK.

The linter improvements are:
- Increase linter performance
	- Make `full-lint` and `lint` write to different caches so we
	  avoid overwriting their caches since they're different configs
	- Change husky's hook to `npm run lint` so as to write to the
	  same cache
	- Remove `@typescript-eslint/eslint-plugin-tslint` which is
	  essentially a wrapper to TSLint because the rules aren't worth
	  running another linter
- Convert `.eslintrc.json` and `.eslintrc-syntax.json` to two spaces
  rather than four tabs to respect PS' `.editorconfig`
- Rename `fulllint` to `full-lint` to ease spelling it

[0] - https://pastie.io/mmtxpf.js (prettified)
2020-03-06 11:44:32 -08:00
Guangcong Luo
b21c9047e2
Migrate to typescript-eslint (#6342) 2020-03-05 08:33:06 -08:00
Kris Johnson
d3e266cddd
Fix crash with TRs (#6330) 2020-02-03 00:25:49 -08:00
Kris Johnson
05efe2e011
Add TRs (#6317) 2020-02-02 23:19:45 -08:00
urkerab
b589745a25 Typescript move.target (#6260) 2020-01-11 09:10:10 -05:00
Guangcong Luo
138fccbaa8 Consolidate more rules into Standard
- `Obtainable` and `Team Preview` are now part of `Standard`

- `minSourceGen: 8` is now a part of `-Unreleased` (which is part of
  `Obtainable`) in Gen 8. Instead, it's NatDex that overrides it with
	`minSourceGen: 1`. This allows `!Standard, Standard NatDex` and
	`!Standard NatDex, Standard` to work as intended.

- Duplicate rules are now checked for (does not apply to subrules, so
  multiple inheritance is still possible)

- It is now possible to inherit `minSourceGen` from rules.
2020-01-03 23:42:48 -05:00
Guangcong Luo
1e1c97c255 Add default types/stats for template
A stub Template object now has `['???']` as its `types` array.

This should suppress some crashes, but the underlying problem remains.
2019-12-27 22:09:11 +09:00
Guangcong Luo
b31b88a79b Add documentation for custom rules 2019-12-25 11:26:23 +09:00
The Immortal
1287dd8add Fix "Past" unreleased hidden abilities 2019-12-22 19:59:32 +04:00
Quinton Lee
9a97a49b24 Dex: fix Darmanitan-Galar-Zen's gen (#6187) 2019-12-15 16:11:23 +09:00
Kris Johnson
f1ad861659 Fix Necrozma-Ultra's inheritance (#6176) 2019-12-12 00:13:14 +04:00
Kris Johnson
89002124b3 Change inheritsLearnsetFrom to inheritsFrom and fix Necrozma-Ultra's inheritance (#6168) 2019-12-10 08:03:49 +04:00
The Immortal
a133a5b28b Fix 4b324e536
This reverts the other changes that were related to that commit.
2019-12-02 18:13:08 +04:00
Kris Johnson
953531cb6f Add inheritsLearnsetFrom property (#6133) 2019-12-02 21:15:48 +09:00
Guangcong Luo
d550bb64d8 Support past-gen-only tracking in minPastGen
This adds new properties `isUnreleased: 'Past'` and
`unreleasedHidden: 'Past'`, which mark a Pokémon or Hidden Ability as
released in past gens, but not in the current gen. This allows them
to be banned in present-gen-only formats, but not in past-gen-transfer
formats.
2019-12-01 20:24:52 +13:00
The Immortal
6018270cbc Dex: Identify Galar Darmanitan as gen 8 2019-11-26 23:38:11 +04:00
HoeenHero
b2625ed70c Remove formeLetters
We don't use these at all currently and they are starting
to overlap. As discussed at the start of Gen 8 development
were removing them now.
2019-11-26 13:26:17 -05:00
Guangcong Luo
5364c63e23 Introduce item.itemUser
`item.itemUser` replaces `item.zMoveUser`, and is a new field
representing a list of possible users of an item, for items that are
restricted to specific species.

`item.zMoveUser` is a base forme for items that affect every forme, and
a forme name otherwise (forme name is currently only used for
`forcedForme` uses).

Arceus is a weird case. Both generic Z crystals and Plates, while
having unique effects on Arceus, also have effects on other Pokémon.
For this reason, Arceus isn't listed as an `itemUser` of either of
these item types - use-cases that want this should also check
`item.forcedForme`.

This is mostly intended to be useful to move-searching and custom
rules (like NatDex, which will only allow past-gen items associated
with removed species).
2019-11-25 15:26:36 +13:00
Guangcong Luo
a9e1ec8487 Implement a default zMovePower
Like gmaxPower, Z-move powers mostly follow a formula, which can be
applied to newer moves.

(In the future, we can save some bytes by not listing the powers.)
2019-11-25 15:26:36 +13:00
whales
9e454e3ea6 Mark double iron bash as gen 7 (#6042) 2019-11-21 13:47:08 +04:00
Kris Johnson
8370c488ce Fix the evolution method of new Pokemon (#5982) 2019-11-20 21:44:16 +13:00
Christopher Monsanto
b90475a257 Don't allow Darmanitan-Zen-Galar in previous gens (#6022) 2019-11-20 04:56:00 +04:00
The Immortal
e7cece5282 Add minSourceGen field to Formats 2019-11-19 03:12:22 +04:00
The Immortal
7a3cd9d078 Restrict SwSh metagames to Galar learnsets 2019-11-18 00:22:36 +04:00
Russell Jones
b2e9336c32 Fix Gmax powers (#5985) 2019-11-17 20:14:10 +04:00
Guangcong Luo
4fc49bc7f9 Fix Body Press
Fixes #5975

Fixes #5979
2019-11-17 18:47:16 +13:00
The Immortal
0000c69c44 Fix illegal moves in Hackmons Cup
And re-enable the format
2019-11-16 23:07:08 +04:00
Guangcong Luo
0bb2e58efd Fix Dynamax move base power
Dynamax moves now have the correct base power, and now correctly only
deal 25% usual damage against Protect.
2019-11-17 06:32:17 +13:00
Guangcong Luo
01f12b3a54 Fix Gigantamax formes being available in past gens
A WIP Gigantamax implementation broke this.

Fixes #5961
2019-11-16 20:00:54 +13:00
HoeenHero
9ecbcabee9
Dynamaxing (#5946) 2019-11-15 21:33:10 -05:00
Guangcong Luo
10062ece4f Fix Koffing/Weezing Gen 7 Abilities
PS apparently doesn't have gen-accurate Ability data for Pokémon in
Gen 3 that gained Abilities between Gen 3 and Gen 4 (like Pidgeot
still has Tangled Feet in Gen 3), but that will have to be left for
a future commit.
2019-11-16 14:39:14 +13:00
Kris Johnson
46ad0bccd7 Add Gen 8 Pokemon 2019-11-15 22:01:36 +13: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
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
Guangcong Luo
c03499e037 Mark Pikachu/Eevee-Starter as Gen 7 2019-09-11 20:49:29 -07: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