Commit Graph

102 Commits

Author SHA1 Message Date
Alexander B
56f8c3144d
Proc hazards in the order they were set (#8730) 2022-05-19 19:05:32 -05:00
Karthik
49149ea8fb
Properly handle Zacian/Zamazenta Crowned forms (#8753) 2022-05-09 14:23:15 -05:00
Karthik
37eaeb735e
Fix Dynamax not starting in order of most recent speed (#8744) 2022-05-04 17:30:26 -04:00
Karthik
dfdb6e3876
Fix normal move target resolution in Triple Battles (#8735) 2022-05-04 17:29:03 -04:00
Karthik
70acfb1d0e
End Dynamax before start of 4th turn (#8719) 2022-04-18 12:15:31 -04:00
Leonard Craft III
b273c95358 Fix skipped hacked Max Move test 2021-12-30 17:22:45 -06:00
Leonard Craft III
d9e9864dbe Fix base power of hacked Max Moves 2021-12-27 00:18:25 -06:00
Leonard Craft III
7cf60606c5
Fix paralysis modifier application (#8478) 2021-11-06 15:52:39 -04:00
Leonard Craft III
ba07a7c75d
Add various mechanics tests (#8494) 2021-11-05 13:28:45 -05:00
Leonard Craft III
25910ed66d
Fix timing of freeze thaws (#8453) 2021-09-29 20:29:26 -04:00
Annika
c134195915
Use ts-node instead of Sucrase (#8369) 2021-07-09 19:59:22 -07:00
pacmanboss256
4937547bb1
Fix build (#8382) 2021-07-05 12:21:22 -07:00
Marty-D
866b5b7bb2 Check for a winner when Destiny Bond knocks out a Pokemon 2021-05-20 12:22:37 -04:00
Leonard Craft III
606576f453
Add various mechanics tests (#8313)
* Standardize Photon Geyser tests
* Add Gulp Missile tests
* Add Berserk Dragon Darts test
* Add Ring Target tests
* Add and improve Metronome tests
* Add Sparkling Aria tests
* Add additional Fling tests
* Standardize Mummy tests
* Add Rollout submove targeting test
* Improve Flower Veil tests
* Add Acupressure tests
* Improve Sky Drop tests
* Add Future Sight tests
* Improve Wandering Spirit tests
* Improve Rapid Spin tests
* Add Rocky Helmet victory test
* Improve Focus Punch tests
* Add a skipped Stomping Tantrum test
2021-05-20 08:43:08 -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
Marty-D
b0509ce39f Check for a winner after future moves 2021-05-15 10:31:30 -04:00
Marty-D
0a9aeb8fcd
Fix faint check mid-attack (#8297)
Only bother checking for a winner if the move's user is also fainted at the time, and check for a winner after the move completes.
2021-05-14 13:36:56 -04:00
pyuk-bot
b17171a2cb
Store originally targeted slot for two-turn moves (#8280) 2021-05-12 08:51:58 -04:00
Annika
1c3f6402f0
Tests: Use assert.equal and assert.notEqual more (#8276) 2021-05-07 23:51:18 -07:00
Annika
27764ef5bf Random Battles: Unify tests 2021-05-07 10:19:45 -07:00
Leonard Craft III
771c60d4b9
Improve self-hit confusion damage (#8264) 2021-05-04 13:44:13 -04:00
pacmanboss256
bb2d700883
Fix smart targeting with scripted moves (#8248) 2021-05-03 11:20:19 -04:00
Kris Johnson
d0fd8ac8e0 Fix build 2021-04-16 21:47:38 -06:00
Kris Johnson
f4fda49201 Update Battle Factory tests and command 2021-04-16 17:35:26 -06: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
Leonard Craft III
897a798db6 Expand G-Max Steelsurge test 2021-04-03 19:02:50 -05:00
pyuk-bot
817addfd62
Fix Follow Me, etc. in FFA (#8173) 2021-04-03 15:16:27 -07:00
HoeenHero
47d8bd4d82
Fix hazards not applying if the target side is fainted (#8171)
Co-authored-by: pyuk-bot <msaimrkon@gmail.com>
2021-04-03 15:15:13 -07:00
pyuk-bot
19111bda58
FFA: Don't retarget from a fainted target (#8166) 2021-04-03 01:50:00 -07:00
Guangcong Luo
1acffa98b3 Fix forfeiting in FFA 2021-04-01 14:46:00 -07:00
Guangcong Luo
39f5717c25 Fix repeate mega evolution bug 2021-03-31 22:16:06 -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
Guangcong Luo
619a1e228d
Stadium: Apply BRN Atk drop once instead of 5x (#8139) 2021-03-25 23:38:55 -07:00
pyuk-bot
e939d9cd6d
Actually don't allow Struggling Pokemon to Dynamax (#8011) 2021-02-10 17:10:41 -05:00
urkerab
edafebbbd8
Fix Magnet Rise in Inverse Battles (#7943)
* Make Magnet Rise work in Inverse Battles

* Improve Inverse Battle tests

Co-authored-by: Leonard Craft III <leonardcraft64@gmail.com>
2021-01-26 20:08:50 -06:00
urkerab
5123b6cc63 Revelation Dance should use Arceus's real type 2021-01-05 16:59:08 +00:00
Leonard Craft III
bed1f4ac99
Add various mechanics tests (#7857)
* Improve Volcalith tests readability

* Add G-Max Volcalith recoil damage order test

* Add 1 HP priority tests

* Add charge move targeting test

* Correct assertions of Ripen / Sturdy

* Skip failing tests

* Add Volcalith Black Sludge test

* Add Pressure Max / Z-move tests

* Add Pressure submove test

* Add NGas speed test

* Skip NGas speed test

* Add White Herb double Intimidate test

* Remove debug log

* Remove duplicate Pressure test

* Improve White Herb Intimidate test title

* Add Rollout Storage tests

* Add spread move Rollout storage test

* Add Magician Weakness Policy test

* Add Sleep tests

* Add Shell Bell spread move test

* Add Synchronize Lum Berry test

* oh yeah it doesn't work

* Remove duplicate test

* Add Sunsteel Strike tests

* Add Leech Seed ally switch test

* Add Primal weather Natural Gift test

* Add Emergency Exit hazards test

* Add generic hazards tests

* Add and standardize Arceus tests

* Add Transform ability test

* Add and standardize Parting Shot tests

* Add Memento tests

* Add Me First test

* Add Cursed Body Z-move test

* Add Assurance targeting test

* Clarify Assurance test description

* Add double faint switch test

* Add Receiver KO boost ability

* Add double Unnerve test

* Add Dynamax Eject Pack test

* Improve Dynamax forced switchout test

* Add Protective Pads Perish Body test

* Add Sticky Web Pressure test

* Add Speed modifier lower bound test

* Add Cloud Nine Hydration test

* Correct Cursed Body test

* Add Grassy Terrain Leftovers test

* Remove leftover debug

* Add additional Receiver and Soul-Heart tests

* Add Spite tests

* mish

* Add Shell Bell multihit test

* Add WP Dragon Tail test

Co-authored-by: The Immortal <the_immortal123@live.com>
2021-01-04 23:47:10 -08:00
Guangcong Luo
6b3a3070c9 Refactor team validator for readability
`checkLearnset` has been renamed `checkCanLearn`.

`reconcileLearnset` has been replaced with `validateMoves`, which
bundles the actual `checkCanLearn` calls with the old
`reconcileLearnset`, making for a better name.
2021-01-03 23:26:20 -08:00
MacChaeger
bb8aca0905
Fix move-disabling mechanics for Dynamaxed Pokemon (#7853) 2020-12-30 18:08:53 -05:00
urkerab
74ae95a91c
Update accuracy calculation for latest Gen 7 research (#7806) 2020-12-15 18:37:24 -05:00
MacChaeger
7d6da41e34
Factory sets: Add more EV validation (#7790) 2020-12-12 10:48:20 +04:00
MacChaeger
ef4132edb8
Fix two-turn submoves + Ally Switch in Doubles (#7654) 2020-11-25 15:21:23 -05:00
Kris Johnson
a641cfcce8
Fix Overflow Stat Clause and turn it into a mod (#7604) 2020-10-30 10:59:38 +04:00
Leonard Craft
07a721dd96 Unskip passing move self-target test 2020-10-19 19:57:37 -05:00
Leonard Craft III
1081a4423f
Add various mechanics tests (#7506) 2020-10-16 21:07:05 -07:00
Guangcong Luo
a65faf263f
Stop using assert.strict.strictEqual (#7515)
It turns out that when I switched us from `assert` to `assert.strict`,
I didn't actually update any existing tests or tell anyone:

0df0d234f2

So apparently everyone else just kept on using `strictEqual`.

This will be a PR and also throw an error if people continue trying to
use it, which should make it much clearer what PS policy is on this.

A lot of the problem may be that TypeScript marks assert.strict.equal
as deprecated when it's not. This was fixed 4 days ago:

https://github.com/DefinitelyTyped/DefinitelyTyped/pull/48452

But this probably hasn't made it to a thing yet. Until then, you'll
have to deal with TS marking your tests as deprecated, but it shouldn't
be too long.

Accidentally using `assert` instead of `assert.strict` should now show
an error. This protects against the probably much worse mistake of
accidentally using `assert.equal` rather than `assert.strict.equal`.

`assert.ok` is also deprecated now.
2020-10-14 01:19:03 -07:00
Kirk Scheibelhut
39c14e0868 Remove EBC staleness from abilities upon switching 2020-08-17 12:59:10 -07:00
Kris Johnson
00b88b521d
Handle Gigantamaxing properly (#7001) 2020-07-23 13:27:42 -07:00
Kirk Scheibelhut
d3b898ef7c Normal |t:| protocol message in Runner's DualStream 2020-07-21 13:35:53 -07:00