Commit Graph

132 Commits

Author SHA1 Message Date
Annika
c134195915
Use ts-node instead of Sucrase (#8369) 2021-07-09 19:59:22 -07:00
Marty-D
6a833db4f6 Gen III-IV: Fix Choice lock timing 2021-07-08 15:46:02 -04:00
Marty-D
410ef7ca70
Gen IV: Hide Mail on Team Preview
https://www.smogon.com/forums/threads/team-preview-information-before-gen-5.3687366/
2021-07-07 19:31:10 -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
Adam Tran
be2210f881
Fix Future Sight Life Orb interactions (#8357) 2021-06-08 11:48:10 -04:00
Annika
d8988bb250 Random Battles: Fix double-Hidden Power bug 2021-06-05 12:24:08 -07:00
pacmanboss256
91f86530c5
Fix Gen 3 Weather Ball and Gen 4 Trick (#8314) 2021-05-24 15:07:37 -04: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
pacmanboss256
4186ef5f4f
Refactor Mold Breaker effect (#8291) 2021-05-14 08:32:41 -04: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
Leonard Craft III
771c60d4b9
Improve self-hit confusion damage (#8264) 2021-05-04 13:44:13 -04: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
Guangcong Luo
486f292904
Refactor everything to use Utils.sortBy (#8220)
A few uses of `array.sort()` have been left alone:

- sorting in `data/` because they aren't supposed to import anything

- `set-importer` because I still have no clue what that's for and what
  dependencies it is/isn't allowed to have

- `sort()` with no arguments used as a lexical sort (at which point
  `sortBy` offers no benefits)

All other cases have been replaced with `Utils.sortBy`, which should
be a massive increase in readability.

Sort orders should be much more readable now, without needing to puzzle
through sign issues. The order is always low-to-high, A-to-Z,
true-to-false.
2021-04-23 22:41:00 -07:00
Marty-D
94840470c3 Make sure Bide actually ends 2021-04-12 10:52:46 -04: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
44ef998ecc Implement free-for-all
This involves a huge refactor for how battles are constructed, but
it's totally worth it.

Currently, tournaments, challenges, and laddering are unsupported; only
unrated searches work. But it does work, and it's beautiful.
2021-04-01 04:44:16 -07:00
Guangcong Luo
3b5e8cbfc2
Refactor for multi battles (#8152) 2021-03-31 20:27:07 -07:00
Guangcong Luo
d18c0a4e1f Refactor more things to use pokemon.allies/foes
(This will make multi battles easier to implement.)
2021-03-28 20:06:18 -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
Annika
9e7074572e Random Battles update 2021-03-26 15:45:59 -07:00
Kris Johnson
5e6c259dec
Gen 3/4: Remove HAs in getSpecies (#8134) 2021-03-23 10:19:50 -07:00
Annika
550a4df374
Random Battles: Refactor Gen 5-7 (#8106) 2021-03-09 19:49:47 -08:00
Marty-D
e92bc94685 Gen IV: Fix Rough Skin
Little overzealous with the copypasting last time...
2021-03-06 14:33:57 -05:00
ACakeWearingAHat
d0eeeac7f0
Random Battles: Improve documentation (#8096) 2021-03-05 14:18:00 -08:00
Annika
13a870a4a3
Random Battles: Refactor Generation 4 (#8087) 2021-03-03 13:16:50 -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
The Immortal
396b46b92c Random Battle fixes 2021-02-01 08:00:44 +04:00
Marty-D
bc144b8504 Descriptions: Remove duplicates 2021-01-24 13:26:04 -05:00
urkerab
d35ddfaf7b
Fix Brick Break against bypassed type immunity (#7916) 2021-01-18 12:13:17 -05:00
Dawnofares
e7f7260927
Show OHKO message if OHKO move breaks substitute (#7171) 2021-01-12 12:16:17 -05:00
The Immortal
3ae56399bd Label Pokemon banned from LC as NFE 2021-01-11 00:29:18 +04:00
The Immortal
28db0e0438 Gen 4: Update Random Battle 2021-01-10 21:02:52 +04:00
The Immortal
2bd9e757c4 Past gens: Random Battle improvements 2021-01-10 19:19:33 +04:00
urkerab
74ae95a91c
Update accuracy calculation for latest Gen 7 research (#7806) 2020-12-15 18:37:24 -05:00
Marty-D
e85c2ce250
Gen III-IV: Fix Reflect / Light Screen again 2020-12-07 10:12:50 -05:00
Marty-D
5cbaefbf71
Gen III-IV: Air Lock / Cloud Nine have no message 2020-11-22 17:38:23 -05:00
Marty-D
8325b6300f
Gen III-IV: Fix Reflect / Light Screen in Doubles 2020-11-21 18:55:28 -05:00
Kris Johnson
7877b95e67 Random Battle: Fix typo and remove redundant check 2020-11-16 22:40:48 -07:00
Marty-D
2d0e06e497 Past Gens: Fix Fury Cutter 2020-11-09 18:10:05 -05:00
Guangcong Luo
a55d3cd530 Fix crashes from using moves with no target
Specifically, if you target your ally and your ally uses Ally Switch
(causing you to target yourself), certain moves (including Thunder,
Hurricane, and SSA) crash. This has been fixed.
2020-10-19 18:10:25 +01:00
Kris Johnson
4ea47cb308
Gen 4: Move Arceus to AG (#7511) 2020-10-12 03:01:50 +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
Marty-D
edcbf6a483 Gens 4-6 OU: Put consistently low usage Pokemon in OU by technicality
https://www.smogon.com/forums/posts/8525878/
2020-08-29 10:41:55 -04:00