Commit Graph

131 Commits

Author SHA1 Message Date
Marty-D
2b6424f2e8
Gen II: Fix Beat Up category also 2021-08-14 16:25:17 -04:00
Marty-D
c93111e81c
Gen II: Correct Unown formes
Thanks, pre!
2021-07-17 13:40:39 -04:00
Karthik
a36b74dbd1
Gen 3: Type boosting items should boost the attacking stat (#8402) 2021-07-17 13:36:56 -04:00
Marty-D
010dbd6e59
Fix Nintendo Cup 2000 Move Legality
Closes #8397
2021-07-14 20:32:56 -04:00
Marty-D
43713804b9 Gen II-IV: Fix Destiny Bond handling during Pursuit
Thanks, xzern and SuperEpicAmpharos!

Also noticed the Pursuit switch accuracy check wasn't overridden in Gen 2 yet so I threw that in too.
2021-06-24 12:05:11 -04:00
Marty-D
b830ceb818 Gen II, III: Implement Quick Claw properly 2021-06-07 12:26:50 -04:00
Annika
d8988bb250 Random Battles: Fix double-Hidden Power bug 2021-06-05 12:24:08 -07:00
Leonard Craft III
d946308900
Fix the order of many end-turn resolution effects (#8307)
Co-authored-by: Marty-D <Marty-D@users.noreply.github.com>
2021-05-17 11:53:52 -04:00
Annika
62571c4907
Validator: Improve Gen 1 level validation (#8294) 2021-05-12 02:59:12 -07:00
Annika
071e21da5c
Random Battles: Refactor to use Sets and Multisets more (#8292) 2021-05-11 09:16:28 -07:00
Annika
5d177a8384 Random Battles: Remove wrongly-implemented rules 2021-05-07 10:19:45 -07:00
Annika
2b3741ec2f Random Battles: Support more Value Rules
Specifically, randomized formats will now support Max Team Size, Min Source Gen, Adjust Level, Adjust Level Down, and Force Monotype.

This fixes the issue with randomly-generated Multi Battle teams containing six Pokémon, instead of three as desired.
2021-05-06 22:45:08 -07:00
Guangcong Luo
f9fdc73133
Support per-pokemon Residual handlers in Side/Field conditions (#8222)
For side conditions, `onStart`/`onRestart`/`onResidual`/`onEnd`
have been renamed `onSideStart`/`onSideRestart`/`onSideResidual`/`onSideEnd`,
with the `onResidualOrder` properties renamed `onSideResidualOrder`.

For field conditions, `onStart`/`onRestart`/`onResidual`/`onEnd`
have been renamed `onFieldStart`/`onFieldRestart`/`onFieldResidual`/`onFieldEnd`,
with the `onResidualOrder` properties renamed `onFieldResidualOrder`.

(The `onField` and `onSide` part helps make it clear to the type system
that the first argument is a Field or Side, not a Pokemon.)

Side and field conditions can now use `onResidual` to tick separately
on each pokemon in Speed order. `onResidualOrder` (the per-pokemon
tick) can be timed separate from `onSideResidualOrder` (the
per-condition tick), allowing conditions to end at a different priority
than they tick per-pokemon.

Relatedly, `onTeamPreview` and `onStart` in formats now need to be
`onFieldTeamPreview` and `onFieldStart`.

Unrelatedly, `effectData` has been renamed `effectState`, and the
corresponding state containers (`pokemon.statusData`,
`pokemon.speciesData`, `pokemon.itemData`, `pokemon.abilityData`,
`field.weatherData`, `field.terrainData`) have been similarly renamed. I
renamed the types a while ago, but I was holding off renaming the fields
because it would be a breaking change. But this is a breaking change
anyway, so we might as well do it now.

Note: `onResidual` will tick even on `onSideEnd` turns, although
`onSideResidual` won't. When refactoring weather, remember to
check `this.state.duration` so you don't deal weather damage on the
ending turn.

Intended as a better fix for #8216
2021-04-25 10:55:54 -07:00
InAShellnut
9ab4c86fe3
Add Stadium 2, Nintendo Cup 1997, and Nintendo Cup 2000 (#8195)
An implementation of Nintendo Cup 1997, Nintendo Cup 2000, and Pokemon Stadium 2, for Pokemon Showdown. The only thing which has not been implemented was showing the exact health of both Pokemon in Pokemon Stadium 2, however implementing that requires changes to the showdown client. The Nintendo Cup 1997 code was done by Enigami, and the rest was by myself (Shellnuts).

This should fulfill the requirements asked by the following accepted suggestions:
https://www.smogon.com/forums/threads/please-add-a-pok%C3%A9mon-stadium-2-simulator-in-showdown.3679486/
https://www.smogon.com/forums/threads/add-nintendo-cup-1997-and-2000-as-challenge-only-formats.3653454/
2021-04-22 00:54:14 -07:00
Marty-D
94840470c3 Make sure Bide actually ends 2021-04-12 10:52:46 -04:00
Guangcong Luo
5233559183 Refactor Dex types 2021-04-08 07:08:56 -07:00
Guangcong Luo
13189fdb02
Update Dex API (#8181)
This is the change that renames:

- `Dex.getMove` -> `Dex.moves.get`
- `Dex.getAbility` -> `Dex.abilities.get`
- `Dex.getItem` -> `Dex.items.get`
- `Dex.getSpecies` -> `Dex.species.get`
- `Dex.getEffect` -> `Dex.conditions.get`
- `Dex.getNature` -> `Dex.natures.get`
- `Dex.getType` -> `Dex.types.get`
- `Dex.getFormat` -> `Dex.formats.get`

In addition, some other APIs have been updated:

- `getByID` methods have also been added to every other table.
- `Dex.moves.all()` now gets an array of all moves
  - Plus equivalent methods for `abilities`, `items`, `species`, `formats`, `natures`, `types`
  - Note: there's no `Dex.conditions.all()`
- new API: `Dex.stats` for naming/iterating stats
- `Dex.getEffectByID` -> `Dex.conditions.getByID`
- `Dex.getType` -> `Dex.types.get`
- `Dex.data.Formats` -> `Dex.data.Rulesets`
- `Dex.formats` -> now an array `Dex.formats.all()`
- `Dex.getRuleTable` -> `Dex.formats.getRuleTable`
- `Dex.validateFormat` -> `Dex.formats.validate`

Team functions have been split off into a new `sim/teams` package:

- `Dex.packTeam` -> `Teams.pack`
- `Dex.fastUnpackTeam` -> `Teams.unpack`
- `Dex.generateTeam` -> `Teams.generate`
- `Dex.stringifyTeam` -> `Teams.export`

`Teams.export` has also been rewritten to better match how it works in client.

This implements #8178
2021-04-08 03:00:37 -07:00
Guangcong Luo
3b5e8cbfc2
Refactor for multi battles (#8152) 2021-03-31 20:27:07 -07:00
Guangcong Luo
ed454ef76a
Refactor scripts to battle-actions (#8138)
This introduces a new class, BattleActions, available as `battle.actions`,
moving all functions from `data/scripts.ts` to `sim/battle-actions.ts`.

This makes it so that "go to definition" will now work correctly for
functions previously in scripts; we no longer need UnimplementedError,
and there's now a clean conceptual separation between `battle` and
`battle-actions` (whereas the previous distinction between `battle` and
`scripts` was basically nonexistent).

This will be a difficult migration if you maintain a fork with custom
scripted mods. I'm sorry! Migration instructions are here:

https://github.com/smogon/pokemon-showdown/pull/8138
2021-03-28 12:01:38 -07:00
Marty-D
1240cb6195
Gen II: Fix Mean Look and Spider Web flags 2021-03-19 18:02:01 -04:00
ACakeWearingAHat
d0eeeac7f0
Random Battles: Improve documentation (#8096) 2021-03-05 14:18:00 -08:00
Annika
591eb345ce
Random Battles: Refactor LGPE and Gens 1-3 (#8060) 2021-02-23 10:27:19 -08:00
Annika
c2e97aaaed
Use optional chaining in more places (#8063) 2021-02-22 11:42:05 -08:00
ACakeWearingAHat
c9e431ed48
Random Battles: Bugfixes for Doubles and old generations (#8058) 2021-02-19 16:08:27 -08:00
Annika
bb4cbf3394
Random Battles: Refactor for code standards and readability (#8021)
This PR
- Brings all Random Battles code up to the standard 120-charaacter line length limit
- Improves readability for all Random Battles code
- Refactors current-gen Random Battles team generation to be more modular and readable

Documentation thanks to @ACakeWearingAHat!
2021-02-12 15:50:04 -08:00
May Evans
7bbcad8be0
Gen 2: Ban JP Phanpy Event in Int Formats (#8013) 2021-02-10 00:35:32 +04:00
Marty-D
bc144b8504 Descriptions: Remove duplicates 2021-01-24 13:26:04 -05:00
Marty-D
8947808628 Gen II: Fix damage calculation
Moves critical hit and item modifiers to the right places
2021-01-23 17:26:35 -05:00
ACakeWearingAHat
eeab2bd44a
Gen 2 Random Battle Improvements (#7942)
* Gen 2 Random Battle Improvements

* tighten level scale
2021-01-23 11:47:04 +04:00
urkerab
80d652d59b Sturdy should trigger before Focus Sash but after False Swipe 2021-01-05 16:58:03 +00:00
ACakeWearingAHat
4fda00e8ac
Update Doubles/Gen 2 Random Battle (#7808) 2020-12-15 11:52:47 +04:00
Leonard Craft III
12da66fb21
Correct Protean interactions & Gravity-blocked Status Z-Moves (#7729) 2020-11-30 16:30:51 -05:00
ACakeWearingAHat
1aafb31a6d
Update Gen 2/Gen 8 Doubles Random Battle (#7693) 2020-11-15 15:02:07 +04:00
ACakeWearingAHat
155cf001f5
Gen 2 Random Battle improvements (#7651) 2020-11-06 17:54:28 +04:00
The Immortal
2bc4a51a50 Random Battle improvements 2020-11-03 19:43:57 +04:00
The Immortal
c15663508b Gen 2 Random: Fix typo 2020-11-02 02:40:34 +04:00
The Immortal
a36bda12e7 Gen 2 Random: Fix Rest + Sleep Talk 2020-11-02 02:29:01 +04:00
ACakeWearingAHat
3037781e1d
Revamp Gen 2 Random Battle (#7610) 2020-11-02 01:13:11 +04: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
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
PartMan
52f67edd0d
Fix typo (#7491)
Obligatory Hacktoberfest typofix.
2020-10-07 23:36:16 -07:00
lotuspirate
7604acefd8
Update GSC NU Pokémon (#7405)
Changing tier for NU-viable Pokemon to NU from NFE/LC. Based loosely on GSC NU Viability Ranking.
2020-09-22 07:25:30 +04:00
urkerab
bcc6fddff5
Remove duplicate fail message from Encore (#7339) 2020-09-09 04:32:28 +04: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
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
Kris Johnson
324ad0425a
Fix various GSC/ADV mechanics (#7247) 2020-08-22 01:29:41 -07:00
Guangcong Luo
4d09f7acde Rename more instances of Effect to Condition 2020-07-26 11:26:23 -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
Annika
2037764dd4
Porygon doesn't learn Defense Curl in Gen 2 (#6976) 2020-07-07 17:25:07 -04:00