Commit Graph

765 Commits

Author SHA1 Message Date
Guangcong Luo
381bd7508a Clarify species limit and requiredItem errors 2020-05-16 12:30:41 -04:00
The Immortal
8be031bb6d Gen 3 Random Battle: Overhaul set generation 2020-05-14 07:58:36 +04:00
Guangcong Luo
f186eb8e5b Prevent nicknames from getting cut off
Nicknames that are too long will now give an error message instead of
silently being truncated.
2020-05-12 03:14:56 -07:00
Kris Johnson
56fbb0201a
Pikachu-Gmax is now available from raids (#6679)
* Pikachu-Gmax is now available from raids

* Volt Tackle is legal on Gmax Pikachu now
2020-05-12 06:14:57 +04:00
Kris Johnson
d20f1fbb64
Typescript info (#6670) 2020-05-11 03:08:33 -07:00
Kirk Scheibelhut
fa65ed4979
Add alt form index data to dex (#6669)
AltForm index info obtained from kwsch/PKHeX's FormConverter.cs (thanks Kurt).
Thanks to @Lusamine (Anubis) for help with the peculiarities.
2020-05-10 12:20:40 -07:00
Guangcong Luo
3a1fe75b13 Remove isViable from moves
It's a judgment call that doesn't belong among the other factual
information in `moves.ts`.

The information is still around; in the client's `battle-dex-search.ts`
in `BattleMoveSearch#moveIsNotUseless`. But now it's all in one place.

fb18721e82
2020-05-08 19:25:51 -07:00
Kirk Scheibelhut
d621a4b670 Don't assign Struggle a zMove.basePower of 100
This check exists for maxMove.basePower but not zMove. Thank you
SadisticMystic for confirming that while "it has an entry of 1 in
the data table, [it]'s a meaningless entry which is impossible
to access"
2020-05-04 21:49:01 -07:00
Kirk Scheibelhut
2af7040270
Group zMove and maxMove attributes (#6652)
This mostly serves to provide cleaner and more consistent field
naming. maxMove currently doesn't have boosts or effects to group
together but who knows what will be thrown at us via DLC, and being
symmetrical with zMoves is a nice.
2020-05-04 20:21:27 -07:00
Kris Johnson
8faaa45eb8
Gen 8 CAP learnset updates (#6636) 2020-05-04 19:05:28 +04:00
urkerab
1eff20a530
Fix G-Max Chi Strike's effect on Crit Ratio (#6639) 2020-05-01 21:14:01 -07:00
Guangcong Luo
56f6ab5489 Fix Zygarde-Complete validation 2020-05-01 13:02:30 -07:00
urkerab
544417e31f
Gen6+ Transform should also remove Focus Energy if necessary (#6637) 2020-05-01 12:01:56 -07:00
Guangcong Luo
c4dd88ac96 Update Effect type signatures
- `affectsFainted` is a `PureEffect` property

- `infiltrates` shouldn't exist on moves outside of OMs
2020-05-01 11:56:54 -07:00
Guangcong Luo
517d02f016 Fix crash with validating pokemon without learnsets 2020-05-01 14:54:11 -04:00
Kirk Scheibelhut
b05e1941e2 Ensure explosion halves defense in Gen 3&4 2020-05-01 11:03:54 -07:00
Kirk Scheibelhut
74e1e3692f
Fix default Max/Z power for isMax/isZ moves (#6634) 2020-05-01 00:35:10 -07:00
Guangcong Luo
7aa42b1212 Remove Dex.getOutOfBattleSpecies
Literally every current use is a bug.
2020-04-30 23:29:20 -07:00
Guangcong Luo
e0f6453b60 Refactor data definitions
- `Modded[Effect]Data` are now correctly defined: they must either have
  `inherit: true` and be partial, or not have `inherit: true` and be a
	complete `[Effect]Data` entry

- `id` is no longer allowed; instead, it's calculated directly from
  `toID(name)`. The one exception, Hidden Power, gets a `realMove`
	property to track this (it's still used to set `.id`, though;
	TODO: really fix it properly).

- `num` is still required in `data/pokedex.ts` (dex number),
  `data/moves.ts` (move index number, for Metronome), and
	`data/items.ts` (minisprite sprite-sheet location). It's still not
	required for mod-only items and moves.

- `num` is no longer allowed for PureEffects (in `statuses.ts`) where
  it's always been meaningless.

- `color` and `heightm`, being completely flavor, are still not
  required for `pokedex.ts` in mods. They're still required in the base
	pokedex.
2020-04-30 21:39:29 -07:00
Guangcong Luo
826e544b65 Refactor random set generation
The whole `checkBattleForme` system, introduced in 4410843e5a
and currently used in Gen 6 and 7, seems to have always been bugged.

As TI mentions in #5970, we already use `getPokemonPool` for alternate
forme handling.

I've replaced it with a roll for cosmetic formes.
2020-04-30 17:52:04 -07:00
Marty-D
15e4d4f2bd
Gen I-IV: Correctly treat both players having no Pokemon left as a tie 2020-04-30 14:01:32 -04:00
Kirk Scheibelhut
edddcb5c38
Correct Self-Destruct and Explosion base power (#6630)
As confirmed by SadisticMystic, base power cannot be above 255, so
this move data is clearly incorrect and results in downstream users
of the data files such as the Smogon or PS dex or the tooltips
displaying misleading information.
2020-04-29 14:59:59 -07:00
Guangcong Luo
9319f68423 Remove Unown forme from locked users
Apparently our old hack was to prevent Unown formes completely, because
locked users would sometimes use them to spell bad words.

I don't like that approach, so now only locked users can't use Unown
formes.
2020-04-29 14:15:04 -07:00
Guangcong Luo
800d8bd8f3 Remove Dex.getForme etc
The server now uses the same approach as the client of treating
cosmetic formes as real formes, as documented in `FORMES.md`.

This eliminates the need for the `.forme` and `.speciesid` properties
of `Pokemon`.

`pokemon.id` has also been removed: useful, since it turns out half
of its uses were bugs that should have used `pokemon.species.id`.
2020-04-28 17:38:54 -07:00
Guangcong Luo
42f949a0ed Remove egg group info from Gen 1 Pokédex 2020-04-28 16:25:35 -07:00
Kris Johnson
1bb842e099
Convert evos/prevo/etc from IDs to names (#6625) 2020-04-28 16:02:50 -07:00
urkerab
1ede5508aa
Moxie and Beast Boost should have one combined boost for all fainted Pokémon. (#6557)
In addition, they should not activate for a spread move that ends the game.
(This contrasts with Soul-Heart, which will activate until the last target.)
2020-04-27 15:44:33 -07:00
Guangcong Luo
e8e3493c40 Fix Struggle activation conditions
PS wasn't correctly detecting `disabled: 'hidden'` moves as disabled
for the purposes of detecting Struggle activation. This has been fixed.

Thanks to DaWoblefet for unit tests!

Fixes #6620
2020-04-26 17:52:06 -07:00
Guangcong Luo
987eb08ad2 Fix gmaxPower location 2020-04-26 17:52:06 -07:00
Kris Johnson
979be98574
Refactor inheritsFrom to changesFrom (#6611) 2020-04-26 14:44:25 -07:00
urkerab
fce96d8a15
Pass the Transform or Imposter effect to onModifySpecies (#6623) 2020-04-26 14:12:10 -07:00
Kirk Scheibelhut
30defec706
Validate that SpA and SpD EVs match in Gen 2 (#6615)
Pointed out by FOMG in https://www.smogon.com/forums/threads/gen-2-ps-development-post-bugs-here.3524926/post-8439815
2020-04-25 13:01:02 -07:00
Guangcong Luo
c5faebd739 Remove extraneous properties from BasicEffect
BasicEffect always had a `status` property to support the pattern of
testing it to see if it's a move that sets status directly.

This is just a situation that TypeScript is bad at.

Another possibility would be to set `status: undefined` on PureEffect,
Ability, Item, and Species, but I think that's also ugly. Casting to
Move is probably the best approach, so that's what we do now.
2020-04-25 12:57:46 -07:00
Guangcong Luo
549ef7edb1 Fix MoveData interface definition
For historical reasons, move property definitions have been very blurry
across `EffectData`. Fortunately, recent refactors have made it
possible to put them all where they're supposed to be.
2020-04-25 12:57:46 -07:00
Guangcong Luo
5d63b16d4d Fix botched merge in data/.ts refactor
The data/.ts refactor left a few .js files in, which weren't deleted
between 13 and 3 days ago:

c85f5bccb0

Because of this, the corresponding `.ts` files were considered new,
rather than renamed, and changes to the `.js` files got deleted rather
than merged.

Fortunately, this only affected `moves.js`, which has now been manually
re-merged with the changes.
2020-04-23 11:22:21 -07:00
Kris Johnson
28bf388b98
Typescript data (#6553) 2020-04-23 09:16:09 -07:00
Guangcong Luo
ebbcbf06a8 Fix Gen 2 gender ratio calculation
(Apparently it was based on older incorrect gender ratio information
from Bulbapedia.)

New version confirmed by Marty.
2020-04-20 12:51:44 -07:00
The Immortal
f194d31aac Fix G-Max moves legality again 2020-04-16 04:47:15 +04:00
Kirk Scheibelhut
78151fad79 Fix 32e193b2 to rely on isMax instead of Nonstandard 2020-04-15 16:15:19 -07:00
Guangcong Luo
900ad5a8c8
Prioritize -All Pokemon above +Past etc (#6574)
Previously, format bans/unbans were processed in order of "most specific
to least specific".

So `+Giratina-Origin` trumps `-Giratina` trumps `+Uber` trumps
`-All Pokemon`.

And nonstandard reasons (`Unobtainable`, `Past`, `CAP`, etc) were
slotted between `Uber` and `All Pokemon`.

This has the unfortunate effect that if a base ruleset allows a certain
normally-banned category of Pokémon, you can't use `-All Pokemon` to
whitelist a list of Pokémon.

Moving nonstandard reasons to lowest precedence once again allows
`-All Pokemon` to be used as intended.
2020-04-14 15:27:59 -07:00
The Immortal
32e193b2b9 Prevent G-Max moves from being used in Hackmons 2020-04-13 19:41:54 +04:00
Guangcong Luo
13ddc8f908 Add Custom Game warning for 510 EV limit
Custom Game is intended to be a "choose your own rules" format. It's usually pretty easy to tell if a
rule is being followed or not (a level 500 Pokémon is rather conspicuous) but EVs are generally
considered a secret.

For this reason, I've added a message for a discrepancy in EV use: one player adhering to the 510 EV
limit, and the other player not adhering to it.

This message is specific to Debug Mode (which Custom Game is, by default), which already leaks some
minor information, anyway.

To avoid information leaks completely, use Custom Rules:

https://github.com/smogon/pokemon-showdown/blob/master/config/CUSTOM-RULES.md
2020-04-11 04:20:19 -04:00
Kirk Scheibelhut
1f8c6bc7b8 Fix illegal ActiveMove cast in battle.ts
Frankenstein checkJs-Typescript with globals derps out and lets this
kind of thing slide, but without `hit` (which is only assigned the
line below) you can't cast to ActiveMove.
2020-04-08 22:33:56 -07:00
Kris Johnson
c13a12cb65
Add mod support for Field (#6543) 2020-04-08 16:22:52 -07:00
Guangcong Luo
091f764681 Fix rule inheritance 2020-04-08 13:25:11 -07:00
Guangcong Luo
0fb601f7f2 Don't allow arrays in battle.add
A bug in Mimicry happened because someone put an array into
`battle.add`. This shouldn't happen.

(Also add a hint for Mimicry.)
2020-04-08 11:17:48 -07:00
Guangcong Luo
2a3b739644 Work around teambuilder nickname issue
Apparently the teambuilder still defaults nicknames to full species
names, instead of base names as you might expect. This will have to be
fixed later...
2020-04-08 10:36:37 -07:00
Guangcong Luo
5abdb88e55 Refactor EventListener
Renames:
- .status -> .effect
- .statusData -> .state
- .thing -> .effectHolder

`thing` was always a really weird "I don't know what to call this"
variable name, but it's been renamed `effectHolder`, which should be
much clearer. `status` -> `effect` is I think the last remnant of old
PS code which called all effects "statuses". `statusData` -> `state`,
on the other hand, is the very first step in an initiative to calling
less things "data".
2020-04-07 17:05:19 -07:00
Guangcong Luo
ff0b80f297 Fix triples shift priority 2020-04-07 10:56:20 -07:00
Guangcong Luo
9d3351f12d Nickname Clause: Enforce after format validation
This allows OMs like Cross Evolution to use nicknames of other species
in `onValidateSet`.

Enforcement also now generates an error message, instead of silently
changing the name.
2020-04-07 10:56:19 -07:00