Commit Graph

25 Commits

Author SHA1 Message Date
Alexander B
5b05bd2f6d
Refactor Revival Blessing to be an action + fixes (#9204) 2022-12-22 15:24:19 -06:00
pyuk-bot
7a6a8441cc
Fix Protosynthesis/Quark Drive/Booster Energy (#9118) 2022-12-04 16:20:21 -05:00
Kris Johnson
d50c8c249b
Add Gen 9 (#8997) 2022-11-17 20:46:29 -05:00
livid washed
b64d085b18
Gen 1: Fix simultaneous Counters so that they both fail (#8974) 2022-11-08 15:19:01 -08:00
Karthik
cfff8b85aa
Fix Focus Punch/Beak Blast/Shell Trap charge timing (#8733) 2022-04-25 16:35:36 -04:00
Karthik
e9c8a1ce3f
Improve check for Sky Drop preventing Mega Evolution (#8680) 2022-03-03 21:55:33 -06:00
Guangcong Luo
a1b52d4223 Fix bug in mega-evo speed tie code
(thanks @urkerab for review)
2021-04-29 02:33:49 -07:00
Guangcong Luo
7d235af30f Fix speed ties after mega evolution 2021-04-29 00:23:55 -07:00
Guangcong Luo
5c3d0f5eae Fix deterministic speed ties
We have apparently been sorting everything by switch-in order this
entire time, not just move redirection. This appears to be a mistake
in #5216

The actual bug fix is just the single line in `comparePriority`,
everything else is just documentation, and a bit of optimization of
how speed ties are resolved.

Fixes #6319
2021-04-10 09:41:22 -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
May Evans
94e9ca7aee
Gen 1: Fix Counter vs Hyper Beam (#7707)
Fixes this issue, which was brought to my attention by EB0LA: 

https://replay.pokemonshowdown.com/gen1ou-1226178707-boclvwycxq72syl17qt9a3729l1tprkpw
https://replay.pokemonshowdown.com/gen1randombattle-1224344866-9ha6ocg38ru2ontlnf0iak467r2nzu0pw

Thanks to Zarel for helping me figure out what to do ^^;
2020-11-18 05:55:18 -08:00
Guangcong Luo
3336decb79 Implement Desync Clause Mod for Gen 1 Counter 2020-11-15 02:18:37 +00:00
urkerab
5d714fbb56
Replace @ts-ignore with type assertions or other less unsafe constructs (#7390) 2020-09-19 02:07:48 -07:00
Guangcong Luo
8fd572f1f6 Refactor BattleQueue to wrap Array
The old decision to make it extend Array was wrong, as clearly
illustrated by the problems with slice/splice.
2020-07-01 16:37:36 -07:00
Kris Johnson
7010e0286f
Add OMotM and RoA Spotlight for July 2020 (#6936) 2020-07-01 12:59:10 +04:00
Kris Johnson
28bf388b98
Typescript data (#6553) 2020-04-23 09:16:09 -07:00
Guangcong Luo
ff0b80f297 Fix triples shift priority 2020-04-07 10:56:20 -07:00
Guangcong Luo
47b55f96bc Refactor dragIn to delegate to switchIn
dragIn and switchIn being two separate functions is a weird historical
quirk that leads to inconsistencies in implementation.

The only reason they need to be separated is a Mold Breaker quirk:
1da65efb12

(This is now done with an `if` statement.)

This should fix a lot of Roar/Whirlwind mechanics issues from `dragIn`
being on outdated mechanics compared to `switchIn`.
2020-03-30 05:25:20 -07:00
Guangcong Luo
38e4af504c Fix Emergency Exit on switch-in 2020-03-08 20:16:53 -07:00
Guangcong Luo
125fe31d06 Improve eslintrc
Fixed some more code style, allowing these rules to be enabled:

- `comma-dangle`
- `function-paren-newline`
- `member-delimiter-style`
- `no-eval`
- `no-fallthrough`
- `no-misused-promises`
- `no-unused-vars`
- `operator-linebreak`
2020-03-06 22:35:55 -08:00
Guangcong Luo
b21c9047e2
Migrate to typescript-eslint (#6342) 2020-03-05 08:33:06 -08:00
Guangcong Luo
1fa9e141f6 Fix Pledge moves 2020-02-15 13:38:58 -08:00
Guangcong Luo
652c7163cf
Refactor queue to new BattleQueue class (#6358)
Previously, battle queue stuff was just strewn around `battle.ts`.
This gives it a new home: `battle-queue.ts`.

This was intended to make `battle.ts` slightly more tractable, although
the difference is so small that maybe I shouldn't bother. Oh, well,
every little bit helps.
2020-02-12 16:20:17 -08:00