Commit Graph

1096 Commits

Author SHA1 Message Date
Annika
9e7074572e Random Battles update 2021-03-26 15:45:59 -07:00
Guangcong Luo
619a1e228d
Stadium: Apply BRN Atk drop once instead of 5x (#8139) 2021-03-25 23:38:55 -07:00
urkerab
d395d18591
End Uproar if the user is under the effect of Throat Chop (#8135)
SadisticMystic confirmed that the user of Uproar simply calms down at the end of the current turn.
2021-03-23 17:42:41 -04:00
Annika
c1fa436e35 Trivia: Implement a /trivia unrankednew command
This enables the creation of Trivia officials that do not reward points.
2021-03-20 12:30:46 -07:00
Leonard Craft III
9db5e91afa Improve Thick Fat tests 2021-03-19 21:46:54 -05:00
Annika
ff56f7e503 Random Battles update 2021-03-19 18:28:08 -07:00
Annika
ffd0092bfb Random Battles: Add basic unit test framework
This will save me a lot of time typing in `/eval`s on localhost to test, and also hopefully catch regressions!
2021-03-18 18:17:25 -07:00
Marty-D
d1c80dc60f Validator: Fix Diancie exception
Thanks Anubis!
2021-03-08 12:57:53 -05:00
Mia
07b1c01f75
Support hotpatching User/Room/ProcessManager protos (#8095) 2021-03-08 05:23:17 -08:00
Leonard Craft III
013dd54d33
Gen IV: Fix Struggle's interaction with Shedinja (#8048) 2021-02-17 09:44:10 -05:00
Leonard Craft III
3e702fdc40 Add Slow Start tests 2021-02-16 16:48:29 -06:00
Guangcong Luo
1b281650c6 Rename Stadium to Gen 1 Stadium
This is required to add support for Stadium in unit tests. A lot of the
codebase assumes that all mods start with "gen" followed by a number,
but I don't want to touch the others at the moment.
2021-02-15 21:03:47 -08:00
Instruct
e7695c4b78
Gen 3: Add Deoxys Forme Clause and Deoxys Camouflage Mod (#8024) 2021-02-15 01:37:58 -08:00
urkerab
16fe1cbc27
Focus Punch can't be Flinched (#8031) 2021-02-15 01:34:47 -08:00
pyuk-bot
ccb92de32b
Set abilityOrder before entrance effects activate (#8010) 2021-02-11 16:14:59 -05:00
pyuk-bot
e939d9cd6d
Actually don't allow Struggling Pokemon to Dynamax (#8011) 2021-02-10 17:10:41 -05:00
Annika
31605c36b3 Modlog: FIx converter bug in action-taker regex 2021-02-06 11:42:07 -08:00
Guangcong Luo
da30a71706 Revert "Remove User#inRooms and User#games (#7815)"
This reverts commit 5c9c84c415.

This also reverts commit 1fc92ef977.
2021-01-30 15:55:55 -05:00
Mia
5c9c84c415
Remove User#inRooms and User#games (#7815) 2021-01-28 10:41:35 -08:00
Leonard Craft III
0d78f967d6 Fix Ripen's interaction with Jaboca/Rowap Berries 2021-01-26 20:36:25 -06: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
Leonard Craft III
b950891185 Improve Future Sight no target test 2021-01-19 20:43:51 -06:00
Adam Tran
14744879c8
Fix excluding variables in /ms (#7859) 2021-01-18 11:42:58 -06:00
urkerab
d35ddfaf7b
Fix Brick Break against bypassed type immunity (#7916) 2021-01-18 12:13:17 -05:00
urkerab
f0d3c85148
Fix Soundproof blocking self sound moves in Gen 8 (#7917) 2021-01-15 20:05:32 -06:00
Guangcong Luo
a68656a8e7 Support destroying rooms in unit tests
Matchmaking unit tests currently rely on destroying and re-creating a
user causing them to forget about battles they're in, which is not
actually supposed to happen, and breaks #7815.
2021-01-10 03:39:01 -08:00
Guangcong Luo
66fe68e8ee Tests: Refactor users-utils
The old users-utils had an unnecessarily difficult-to-use API. This
new one should be more straightforward and unified.
2021-01-09 22:33:32 -08:00
The Immortal
0fc3d514e6 Rename U-turn test for consistency 2021-01-08 10:46:41 +04:00
Adam Tran
2c65de1a16
Fix various Future Sight / Doom Desire issues (#7884) 2021-01-07 19:20:30 -05:00
urkerab
2c0bd53966
Grassy Terrain should heal before Leftovers (#7882) 2021-01-07 19:17:48 -05:00
urkerab
cdcdf2da1b Shell Bell should heal from all damage 2021-01-05 17:29:35 +00:00
urkerab
5123b6cc63 Revelation Dance should use Arceus's real type 2021-01-05 16:59:08 +00:00
urkerab
80d652d59b Sturdy should trigger before Focus Sash but after False Swipe 2021-01-05 16:58:03 +00:00
urkerab
4192201d60 Pressure should deduct additional PP from Z-moves and Max moves 2021-01-05 13:17:27 +00:00
urkerab
845b4386c4 Pressure should not deduct additional PP from Sticky Web 2021-01-05 13:14:56 +00:00
urkerab
6ba98478a6 Cursed Body should be able to disable Z-moves 2021-01-05 13:06:40 +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
The Immortal
fa2698a3a0 Fix PP reduction moves 2021-01-04 16:27:09 +04:00
Guangcong Luo
73c7d5e5d8 Fix bug in Sketch validation
Earlier today, I tried to remove the hardcode for Smeargle without
realizing what it was for (Smeargle gets Spore as an event move, which
shouldn't override its ability to Sketch Spore).

It turns out, 7 years ago when I added the Smeargle hardcode, I wrote
a TODO to fix it which I never got around to:

2e1ab04eb6

Anyway, this commit fixes it properly.
2021-01-03 23:52:33 -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
Adam Tran
fbda1e5d92
Fix Protean/Libero on first of two turn moves (#7870) 2021-01-03 09:42:08 -05:00
The Immortal
d8a90a94f9 Protective Pads should negate Perish Body
Thanks @DaWoblefet!
2021-01-03 16:35:55 +04:00
urkerab
fa78e2a31c
Make Unnerve activate after Skill Swap and Neutralizing Gas wearing off (#7866) 2021-01-02 14:39:54 -05:00
Adam Tran
0f724acb03
Fix Neutralizing Gas ending issues (#7860) 2021-01-01 18:39:19 -05:00
The Immortal
d9c2ee8d39 Lum Berry activates after Synchronize
Thanks @DaWoblefet!
2020-12-31 21:58:36 +04:00
MacChaeger
bb8aca0905
Fix move-disabling mechanics for Dynamaxed Pokemon (#7853) 2020-12-30 18:08:53 -05:00
Marty-D
1b046208ba
Add Metal Burst redirection test 2020-12-30 16:41:18 -05:00
Adam Tran
d6e05d0a98
Fix Metal Burst interaction with called moves (#7835) 2020-12-30 14:36:06 -05:00
Adam Tran
674eb1449f
Fix Conversion 2 interaction with called moves (#7813) 2020-12-30 11:50:04 -05:00
Adam Tran
2f5fbad4e7
Fix Pursuit interaction with pivot moves (#7819) 2020-12-30 11:48:26 -05:00
Adam Tran
6702decd95
Add Pivot moves as a /ms category (#7822)
* draft test

* Move search for pivot moves
2020-12-26 21:57:03 -08:00
Leonard Craft III
b9363ef707 Tests: unskip oldgen Fury Cutter, improve readability 2020-12-22 23:21:31 -06:00
The Immortal
fda0ee61f4 Gen 7/6: Implement Toxic accuracy mechanics 2020-12-22 15:50:05 +04:00
Leonard Craft III
653ca9d4ae Victory Star tests are Victory Star 2020-12-16 06:41:11 -06:00
Leonard Craft III
8fc481b65a Add Victory Star tests 2020-12-15 19:13:04 -06:00
urkerab
74ae95a91c
Update accuracy calculation for latest Gen 7 research (#7806) 2020-12-15 18:37:24 -05:00
Adam Tran
56258a08c7
Run checks for Gravity, Heal Block, Throat Chop on called moves (#7758) 2020-12-15 10:15:12 -05:00
Annika
f2bfc82ca1
Chat monitor: Improve the handling of usernames (#7786)
* Chat monitor: Improve the handling of usernames

This PR ignores word boundaries in evasion regexes when filtering usernames, preventing the use of usernames with evasions of slurs in them.

* properly fix merge conflicts
2020-12-14 12:55:11 -08:00
MacChaeger
7d6da41e34
Factory sets: Add more EV validation (#7790) 2020-12-12 10:48:20 +04:00
Adam Tran
f63e7e4a8d
Add Heal Block independent fail message (#7785) 2020-12-11 19:38:52 -05:00
MacChaeger
58ee2f2130
Activate Jaboca and Rowap Berry on KO (#7779) 2020-12-08 15:15:41 -05:00
urkerab
6daa05781b
Protean should affect the victim of Snatch rather than the user (#7768) 2020-12-07 09:43:55 +04:00
Leonard Craft III
12da66fb21
Correct Protean interactions & Gravity-blocked Status Z-Moves (#7729) 2020-11-30 16:30:51 -05:00
Adam Tran
32d3d8dda6
Fix Max Guard bypass with multiple targets (#7739) 2020-11-30 12:59:53 -05:00
MacChaeger
ebb570e608
Tests: Add a function to save a battle replay (#7692) 2020-11-29 22:08:01 +00:00
MacChaeger
8f6576e59a
Don't activate Flower Gift/Ice Face when KOed (#7733) 2020-11-26 15:36:59 -05:00
MacChaeger
66da9ca824
Wimp Out does switch out before fainted Pokemon (#7731) 2020-11-26 13:56:40 +04:00
The Immortal
006fd097f0 Fix Stance Change mechanics 2020-11-26 13:47:27 +04:00
Annika
a1b085f033
Chat monitor: Support unit tests (#7710) 2020-11-26 01:33:09 -08:00
MacChaeger
ef4132edb8
Fix two-turn submoves + Ally Switch in Doubles (#7654) 2020-11-25 15:21:23 -05:00
MacChaeger
ffc632cbf1
Fix Burning Jealousy/Lash Out vs. "turn 0" effects (#7730) 2020-11-25 13:30:03 +04:00
aviettran
f66569a242
Fix Symbiosis interaction with Eject Button (#7718) 2020-11-24 11:14:05 -05:00
MacChaeger
3dfa1bdd91
Fix Emergency Exit/Wimp Out false positives (#7719) 2020-11-24 05:42:55 -08:00
The Immortal
d958c32f73 Fix After You test description 2020-11-21 23:26:36 +04:00
The Immortal
d65b2427dd Fix Fling vs Protect 2020-11-21 22:54:25 +04:00
The Immortal
271b6be01b Merge Libero and Protean tests 2020-11-21 22:54:00 +04:00
The Immortal
079d931e97 Fix Fling mechanics 2020-11-21 11:16:01 +04:00
The Immortal
8bb09561e0 Add Protean tests 2020-11-21 11:14:34 +04:00
The Immortal
6b1b318977 Fix Metronome interaction with two-turn moves 2020-11-20 13:14:00 +04:00
Annika
fe9a3419f7
Tests: Remove debug print from Pollen Puff test 2020-11-19 21:31:12 -08:00
Leonard Craft
41033e7345 Fix Pollen Puff's interaction with ally Substitute 2020-11-19 22:12:02 -06:00
Marty-D
d28ddeca4e Descriptions: Replace "major" with "non-volatile" 2020-11-17 14:49:19 -05:00
Guangcong Luo
b51db459d7 Fix Desync Clause test
It was in Mirror Coat rather than Counter.

Also switch to checking for "activated", so it doesn't conflict
with #7702 (committed separately so git blame still shows me as
test author)
2020-11-17 00:33:13 +00:00
Guangcong Luo
3336decb79 Implement Desync Clause Mod for Gen 1 Counter 2020-11-15 02:18:37 +00:00
Marty-D
826dd94eae Validator: Fix Ability attribution from Virtual Console 2020-11-13 11:28:10 -05:00
Marty-D
b098b54187 Validator: Fix Ability attribution from Dream World 2020-11-12 18:13:58 -05:00
The Immortal
fff0f6c806 Release Gigantamax Melmetal
Also added necessary validation for it as its event is a special case.
2020-11-12 05:41:24 +04:00
Mia
6145fab828
Allow the Help auto-response filter to be used in all rooms (#7645) 2020-11-08 20:16:25 -08:00
Guangcong Luo
8543fc291a Fix Gen 2 evo/tradeback validation 2020-11-09 04:12:59 +00:00
Annika
ec0a92469a Modlog: Make tests work without SQLite 2020-11-05 22:40:53 -08:00
Leonard Craft III
920af21aac
Abilities: Add isPermanent flag (#7614) 2020-11-03 10:31:11 -05:00
Annika
aa069ce8fd
Support disabling modlogs (#7619)
Co-authored-by: Christopher Monsanto <chris@monsan.to>
2020-11-02 22:59:31 -05:00
Annika
7f2dec0797
Modlog: Avoid optional properties in ModlogEntry (#7613)
* Modlog: Avoid optional properties in ModlogEntry

* Use a type

* Make IP nullable

* Add NOT NULL constrains

* Fix typo
2020-11-01 14:07:01 -08:00
Annika
2f130e8762
Modlog: Support logging to a SQLite database (#7513)
* Modlog: Support logging to a SQLite database

Co-authored-by: Christopher Monsanto <chris@monsan.to>
2020-10-30 19:27:25 -04:00
The Immortal
42f491a092 Fix Ripen 2020-10-30 14:03:35 +04: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
b673ff3fe4 Add Berserk to the Berserk sim test 2020-10-30 03:05:46 +00:00
Guangcong Luo
e90658c038 Validate Natures in tests
(There's no need to validate natures somewhere that has an actual
performance impact.)
2020-10-29 16:19:07 +00:00
The Immortal
1a0e56a3ac Fix Neutralizing Gas interactions 2020-10-29 04:35:12 +04:00
Kris Johnson
b1e2331c7b
Fix Slow Start's interaction with Neutralizing Gas (#7580) 2020-10-28 12:51:33 -07:00
Guangcong Luo
5f8c36c616 Ban Gen 1 Japan-only event moves
Fixes #7516
2020-10-26 15:30:47 +00:00
Annika
099346ee1e Tools: Modernize modlog entries for blacklists 2020-10-25 16:13:46 -07:00
The Immortal
381c8190c6 Fix Dragon Ascent Rayquaza validation 2020-10-24 04:58:05 +04:00
Leonard Craft III
4e6ff7e72c
Validator: Allow Hidden Ability Entei/Raikou/Suicune in Gen 8 natively (#7563) 2020-10-23 15:28:12 +04:00
Leonard Craft
db2a55a1bb Clarify Neutralizing Gas + Imposter test 2020-10-22 11:53:11 -05:00
Leonard Craft
4e3c8bd3cc Consolidate Neutralizing Gas tests; add Gluttony/Slow Start NGas tests 2020-10-22 11:49:11 -05:00
Guangcong Luo
d6eeb197c1 Improve Chat.toDurationString
- Default precision is now 3.

  (Instead of "3 months 25 days 17 hours 46 minutes 40 seconds", it'll
	say "3 months 25 days 17 hours". You can still set the precision to
	`Infinity` if you actually prefer that.)

- Now displays "forever" for Infinity or overflow durations

- No longer skips blank precision levels

  (Shows "3 hours 0 minutes 10 seconds" instead of
	"3 hours  10 seconds")
2020-10-21 13:05:08 +01:00
Leonard Craft
993a5cc645 Unskip passing validator test 2020-10-20 21:36:28 -05:00
Leonard Craft
07a721dd96 Unskip passing move self-target test 2020-10-19 19:57:37 -05: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
Ben Davies
6f26265ff9 Tests: simplify Dashycode transcodeWithSets helper 2020-10-19 05:15:02 -03:00
Leonard Craft III
1081a4423f
Add various mechanics tests (#7506) 2020-10-16 21:07:05 -07:00
The Immortal
7638f8238a Fix Present healing vs Substitute 2020-10-15 18:46:58 +04: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
Guangcong Luo
67a4e9f185 Add validator for Pokestar event moves
See #7412
2020-10-13 18:01:32 -07:00
Kris Johnson
510ab4ecb3
Fix typo 2020-10-13 16:55:31 -06:00
Guangcong Luo
7fc498ff88 Add validator for evoItem
See also #7412
2020-10-13 04:40:38 -07:00
Kris Johnson
d9b3a510ad
TextFormatter: Support replacing \n without trusted (#7507) 2020-10-11 13:38:34 -07:00
Guangcong Luo
e40ab96db7 Update Mocha dependency version 2020-10-09 22:33:17 -07:00
Kris Johnson
b107236dc5
Repeats: Refactor storing and deleting repeats, let people repeat room FAQs (#7488) 2020-10-07 23:42:30 -07:00
Leonard Craft III
2ed8a97ff8
Add skipped failing event validator tests (#7472) 2020-10-06 16:06:05 -07:00
Mia
4279d1f3bc
Update attributions in various locations (#7354) 2020-10-06 15:55:26 -07:00
Annika
216e4a7354
Add a plugin to repeat phrases in chatrooms (#7338) 2020-10-05 14:25:18 -07:00
Annika
0877f0ae1e
Modlog: Fix entries with an IP address and no user (#7446) 2020-09-30 17:55:41 -07:00
The Immortal
ca3a106815 Learnsets: Sort V before S 2020-10-01 04:26:23 +04:00
Annika
b3a5f9e59f
Moderation: Refactor room promotions to a function (#7426) 2020-09-28 15:49:26 -07:00
Annika
f1b4e3d43a
Modlog: Refactor to use ModlogEntry objects (#7403) 2020-09-28 11:06:30 -07:00
The Immortal
2b0c77939f Correct Weakness Policy mechanics
And added relevant Burning Jealousy tests.
2020-09-26 00:56:41 +04:00
Annika
1e20f6a96f
Trivia: Add leaderboard management commands (#7402) 2020-09-20 16:33:03 -07:00
Annika
6d8d0bd93a
Trivia: Use Chat.ErrorMessage more (#7384) 2020-09-18 16:19:26 -07:00
Annika
422649dca7
Trivia: Add a new game called Mastermind (#7368) 2020-09-14 16:03:50 -07:00
Annika
83e8262d12
Users: Fix bug with IP handling (#7305) 2020-09-05 08:18:42 -07:00
Kris Johnson
8656d633ac
Format volatiles consistently (#7314) 2020-09-05 08:12:24 -07:00
Annika
c9fa3fc389
Refactor User#prevNames and User#ips to arrays (#7267) 2020-08-29 10:27:03 -07:00
Guangcong Luo
ba4998350a Fix more bugs in /hiderank 2020-08-22 16:03:10 -07:00
Annika
05065dbdb8
IPTools: Support wildcards in string ranges (#7223) 2020-08-18 13:37:58 -07:00
Mia
d8ecdb5f83
Help: Only write state when relevant to the room (#7207) 2020-08-18 13:06:52 -07:00
Kirk Scheibelhut
39c14e0868 Remove EBC staleness from abilities upon switching 2020-08-17 12:59:10 -07:00
Leonard Craft III
53dd591819
Skip failing modlog test (#7197) 2020-08-11 05:58:59 -07:00
Annika
ce8a1dd975
IPTools: Remove '-nohost' suffix and make minor improvements (#7108) 2020-08-07 14:47:18 -07:00
Mia
deeed6c789
Remove sim/ and data/'s globals (#7091) 2020-08-07 06:44:15 -07:00
Annika
f563252418
Modlog: Fix bugs and support hotpatching (#7163) 2020-08-06 22:05:13 -04:00
Leonard Craft III
9e82f05ebb
Gen 3-4: Fix Camouflage to change to Normal-type (#7130) 2020-08-06 14:54:57 -04:00
Annika
f34ffa9e74
Refactor Modlog into one file (#7127) 2020-08-06 00:39:37 -07:00
Mia
fbe5d90dd0
Youtube: Add tests (#7081) 2020-08-06 00:34:18 -07:00
Mia
647d5af76f
Add a filter for auto-answering questions in the Help room (#7100) 2020-08-05 23:44:46 -07:00
Annika
577b858994
Tests: Allow requiring Config at the top level (#7109)
This solves issues like https://github.com/smogon/pokemon-showdown/pull/7100#discussion_r463922425 and makes it easier to test chat plugins.
2020-08-02 22:10:22 -07:00
Annika
cd85cd7a9d
Hosts & IPTools: Refactor to remove hardcoded ranges (#7078) 2020-07-29 23:04:50 -07:00
Guangcong Luo
fe2eb27860
Refactor ip and modchat permissions (#7076)
- `ip` and `ipself` are now separate permissions. This means that `ip`
  is now a generalized permission for viewing IPs (no more need to use
  `globalban`, since `ipself` now controls the ability to see your own
  IP address)

- `alts` and `altsself` are now also separate (all users used to be
  able to `altsself`).

- `modchat`, `modchatall`, and `manageroom` are now just one `modchat`
  permission whose jurisdiction controls how high you can set modchat.
2020-07-29 00:38:52 -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
Kris Johnson
00b88b521d
Handle Gigantamaxing properly (#7001) 2020-07-23 13:27:42 -07:00
Guangcong Luo
4628575b17 Add regression test for Aerial Ace Kubfu in LC 2020-07-23 12:48:08 -07:00
Kirk Scheibelhut
d3b898ef7c Normal |t:| protocol message in Runner's DualStream 2020-07-21 13:35:53 -07:00
Guangcong Luo
eb78b5981e Remove timestamps in state tests 2020-07-21 13:08:16 -07:00
Kris Johnson
77e4a8ad6f
Add type and category support for <psicon> (#6983) 2020-07-18 18:05:19 -07:00
The Immortal
e2d268747c Remove Gmax restrictions
Closes #6954
2020-07-18 21:04:09 +04:00
Jacob McLemore
30e420204a
Fix Fusion Bolt + Fusion Flare interaction when first move fails (#6991) 2020-07-10 16:29:53 -07:00
Kris Johnson
127a04b19e
Make improvements to the UNO game (#6980) 2020-07-08 15:12:14 -07:00
Kirk Scheibelhut
eea2196280
Server side changes to support persistent user settings and privacy changes (#6947)
NOTE: This is changes the semantics of `hidenext`/`ionext` from
applying to the next created *battle* to applying to the next
created *search*/*challenge*.
2020-07-06 21:18:38 -07:00
Guangcong Luo
d7ba455e2b Update permissions
Permissions have gotten out-of-date, so this commit syncs them.
Default permissions are now matched with Main, in particular including
the new & rank as admin (removing the old Leader rank and ~ symbol).

Relevant changes:
- Admin (~) and Leader (&) have been merged into Admin (&)
- The 'ban' permission was split into 'globalban' and 'ban'
- The 'broadcast' permission was renamed 'show' (going forward,
  "broadcast" should only refer to the big red/blue/green
  announcement bars.)
- Bots no longer have global moderation abilities, making it
  easier to give untrustworthy bots the "bot" rank.
2020-07-03 17:32:49 -04:00
Guangcong Luo
46c9afa2f3
"Remove" the global room (#6885)
I couldn't completely remove the global room in one commit, but this
solves basically every problem with it by making it no longer a `Room`.

In particular, this means:

- It's no longer of type `Room`
- It's no longer in the `Rooms.rooms` table
- Its class name is now `GlobalRoomState` rather than `GlobalRoom`
- It no longer tracks its own user list (online user count is now
  provided by `Users.onlineCount`)
- It's no longer a socket channel (there's new syntax for "send this
  message to every user")
2020-07-02 11:31:34 -07:00
The Immortal
6ef15d4a9b Fix Adrenaline Orb 2020-06-19 16:52:56 +04:00
Guangcong Luo
51344c6d3f Fix BattleStream test 2020-06-18 22:40:01 -07:00
Guangcong Luo
dffd9dbff8 Fix stream destroying
`SubprocessStream` wasn't getting properly destroyed.
2020-06-18 21:47:03 -07:00
Kris Johnson
e20178d69d
Isle of Armor: Pokemon (#6839) 2020-06-17 23:37:14 +04:00
Guangcong Luo
e0f97dcf6b Replace Chat.uncache* with Utils.clearRequireCache
This replaces the old approach with a new "clear everything except a
whitelist" approach, which should overall involve much less code and
lead to fewer bugs of the "the path changed for a module and I forgot
to update the uncache paths" variety.

I considered a lot of other approaches, but they seem to have more
flaws without any advantages in exchange for them. (We moved away
from `uncacheTree` because it only tracks the first require: there's
no way to get a full list of dependents for a module, only its first
dependent.)
2020-06-12 22:02:32 -07:00
Mia
6839a1f4db
Add a library for utility functions (#6817) 2020-06-09 22:06:43 -07:00
Mia
15fed24b40
Refactor auth and room.settings (#6777)
This implements two big changes:

- All settings shared between `room.chatRoomData` and `room` have been
  merged into `room.settings` (so, for instance, `room.slowchat` is now
  only `room.settings.slowchat`).

  This makes it so we never have to worry about them getting "out of
  sync".

  - Checking to see if a room is persistent is now `if (room.persist)`
    instead of `if (room.chatRoomData)`

  - `Rooms.global.writeChatRoomData()` is now rarely called directly;
    there's a new `room.saveSettings()` which will handle it for you.

  - All properties of `room.settings` are now optional (except
    `title`).

- There's a new file `user-groups.ts` which handles authority.

  - `room.auth` and `Users.globalAuth` are now
    `Auth extends Map<ID, GroupSymbol>` objects.

  - `room.auth` is now always defined, removing the need for
    `room.auth?.[userid]` workarounds.

  - A lot of code relating to usergroups and permission checks have
    been refactored.

Co-authored-by: Guangcong Luo <guangcongluo@gmail.com>
2020-06-09 08:22:25 -07:00
Kris Johnson
73a84a43ec
Fix remaining learnsets inconsistencies (#6795) 2020-06-02 21:31:48 -07:00
Guangcong Luo
4f790cf04f Validate learnset order 2020-06-02 01:02:01 -07:00
Guangcong Luo
36941fe898 Add Learnsets validator
I didn't have time to fix all the errors the validator found, but I
fixed half of them.
2020-06-02 00:38:56 -07:00
Kirk Scheibelhut
54026a5cf7 Only check for EBC after 100 turns have passed
Per DaWoblefets suggestion to avoid interfering with regular play
2020-05-30 20:46:17 -07:00
Kris Johnson
18fbcbc914
Typescript Trivia (#6768) 2020-05-29 23:53:52 -07:00
urkerab
fc6e4b82ae
Disguise breaking prevents critical hits (#6766) 2020-05-29 18:57:39 -07:00
urkerab
d3a3666e85
Fix bugs caused by not specifying effectiveness priority (#6765)
Inverse Mod needs to go first, to calculate the negated effectiveness.
Disguise goes second, to suppress effectiveness.
Delta Stream goes third, to weaken moves super-effective against Flying types.
Tar Shot goes last, to make its victim weak to Fire type moves.

This allows the existing test for Delta Stream with Tar Shot to pass.
Additionally a new test for Delta Stream with Inverse Mod now passes.
A test for Flying Press with Inverse Mod is also included.
2020-05-29 16:55:42 -07:00
urkerab
7dd6e8bd64
Fix doubled effectiveness for victims of Tar Shot (#6566) 2020-05-29 01:27:53 -07:00
Kirk Scheibelhut
adfc77246b EBC: Entrainment/Skill Swap inflicts staleness 2020-05-28 12:05:16 -07:00
The Immortal
df8b99d244 Fix Kyurem learnset validation 2020-05-28 00:41:31 +04:00
HoeenHero
148570ddb5 Fix Emergency Exit Bug
Fixes 0450e8cb65
2020-05-27 10:11:04 -04:00
Leonard Craft III
27efca0f32
Add EE tests for new bugged behavior (#6752) 2020-05-27 10:00:16 -04:00
fart
0450e8cb65
Fix Life Orb + Emergency Exit interaction (#6738) 2020-05-25 14:14:59 -07:00
Leonard Craft III
c249a8f0be
Add various mechanics tests (#6714) 2020-05-18 12:19:18 -07:00
Leonard Craft III
576e0c7d0f
Add forme-exclusive move validator tests (#6709) 2020-05-16 18:27:50 -07:00
Leonard Craft III
4e4261267c
Add a few G-Max Chi Strike tests (#6631) 2020-05-14 11:34:09 -07:00
Marty-D
c8c048a645 Update Curse targeting 2020-05-14 13:23:37 -04: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
9f5d1bc681
Fix Dynamax Clause validation (#6674) 2020-05-10 14:42:53 -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
291f891309 Fix mod loader test 2020-05-08 07:25:09 -07:00
Guangcong Luo
c76ea9a497 More thoroughly remove old sockets tests
I don't want to remove them completely because they can still be used
for inspiration for writing new tests, but to me, "skipped test"
implies "bug that needs to be fixed", and these aren't bugs so much as
outright outdated code.

Closes #6665
2020-05-08 07:11:05 -07:00
Leonard Craft III
1dbb1a280b
Unskip passing tests (#6662) 2020-05-07 16:53:10 -07:00
Marty-D
339f516a2b Gen II: Fix residual damage when opponent is KOed 2020-05-06 15:41:18 -04:00
Guangcong Luo
5aa5f53089 Fix Shields Down for cosmetic formes 2020-05-01 23:30:04 -07:00
Guangcong Luo
6d5ea45adf Fix misc bugs preventing build 2020-05-01 12:48:54 -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
Kirk Scheibelhut
b05e1941e2 Ensure explosion halves defense in Gen 3&4 2020-05-01 11:03:54 -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
9209201f1c Improve pokedex changesFrom/battleOnly validation 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
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
urkerab
8476a24318
Shell Trap should not power up if hit by a Z- or Max move (#6622) 2020-04-27 08:04:49 -07:00
Guangcong Luo
5d57aaaedf Fix Imprison test
I'm pretty sure the old Imprison test was straight-up wrong, and based
on the old bugged behavior.
2020-04-26 18:21:02 -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
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
urkerab
554cb570a7
Dancer should not activate if the holder fainted (#6613) 2020-04-25 09:55:13 -04:00
Guangcong Luo
f6f4467265 Turn on prefer-const for .js files
Not having prefer-const on the JS side makes JS -> TS refactors really
unreadable. This commit just auto-fixes it so we're using
`prefer-const` everywhere.
2020-04-23 11:37:47 -07:00
Kris Johnson
28bf388b98
Typescript data (#6553) 2020-04-23 09:16:09 -07:00
Luc Moussiegt
be4ff58260
Fix Sky Drop Wonder Guard interaction (#6593) 2020-04-20 12:14:37 -04:00
Marty-D
d9d345d8df Correct power modifier priorities
Thanks @dawoblefet!
2020-04-18 20:33:13 -04:00
Luc Moussiegt
4a749aff3e
Fix Technician interaction with Battery/Auras/PowerSpot (#6587) 2020-04-18 12:46:19 -04:00
Guangcong Luo
776ccf9796
Refactor Sockets to ProcessManager+TypeScript (#6584) 2020-04-17 04:05:45 -07:00
Guangcong Luo
80634c6918 Fix Dazzling
I don't like using Bulbapedia as a source, but our researchers are all
asleep and TI said this was high-priority.
2020-04-16 03:12:40 -07:00
Leonard Craft III
6792b82a21
Add Teatime tests (#6582) 2020-04-15 21:27:45 -07:00
Leonard Craft III
2a07102281
Add G-Max move validator illegality test (#6580) 2020-04-15 21:27:16 -07:00
Kirk Scheibelhut
79ea998a93 Skip failing dazzling test 2020-04-15 16:17:37 -07:00
Kirk Scheibelhut
ea601caf6c Add tests for Dex edgecases 2020-04-15 16:15:13 -07:00
The Immortal
01aac3b491 Add Dazzling tests 2020-04-15 22:22:56 +04:00
Leonard Craft III
3842e03d60
Fix residual order for G-Max Volcalith / Wildfire (#6565) 2020-04-15 12:20:27 -04: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
urkerab
19be262793
Fix Pastel Veil mechanics (#6571)
Makes Pastel Veil pass the tests from #6568
2020-04-13 15:18:14 -07:00
urkerab
9c8c1e1468
Fix Fell Stinger after redirection (#6572) 2020-04-13 14:20:37 -07:00
Leonard Craft III
be3a396bf7
Add Pastel Veil, Emergency Exit, and Fell Stinger tests (#6568) 2020-04-12 23:06:36 -07:00
Kirk Scheibelhut
ca69c8e6e3
Fix Minior-Meteor forme not being allowed in Gen 7 (#6563) 2020-04-12 16:25:13 +04:00
Kirk Scheibelhut
2b8c03fe04 Increase test timeout in test/sim/misc/state.js
This is already marked as '(slow)' so could be timeout(0), but this
shouldn't be *that* slow, so increasing it from 2000 to 5000 seems
sufficient.
2020-04-11 12:04:17 -07:00
Guangcong Luo
091f764681 Fix rule inheritance 2020-04-08 13:25:11 -07:00
Guangcong Luo
40783b7dc6 Fix spread moves vs Unaware 2020-04-07 10:56:20 -07:00
Guangcong Luo
ff0b80f297 Fix triples shift priority 2020-04-07 10:56:20 -07:00
Guangcong Luo
33fa9d56ef Fix mega evolving into self
A hacked-in Megazard X can mega evolve into Megazard Y, but not into
Megazard X.
2020-04-07 10:56:19 -07:00
Marty-D
ff3ca6783a Fix Imposter activation 2020-04-05 14:56:42 -04:00
Leonard Craft III
d8cf01bee1
Add Primal weather phazing test (#6525) 2020-04-05 08:50:17 +04:00
Kirk Scheibelhut
d17a48cc47 Fix Dex#getForme for Flabebe 2020-04-04 21:36:58 -07:00
Waleed Hassan
855899b330
Fix Battle#switchIn (#6521)
Regression caused by: 47b55f96bc

`Battle#dragIn` used to run the `SwitchOut` event among other functions
but were accidentally left off in the refactor. This commit adds them back.

The main bug caused by this is Natural Cure not curing status aliments when
phased out by Roar.
2020-04-03 09:22:55 -07:00
urkerab
76a78f46b3
Add test for priority of shift action in Triples battles (#6509) 2020-04-01 06:17:21 -07:00
Leonard Craft III
dbf7d33e50
Add test for Unaware & spread moves (#6506) 2020-04-01 00:46:45 -07:00
Marty-D
2aae13ff62 Fix Round and Pledge move interaction with Z- and Max Moves 2020-03-31 16:33:42 -04:00
Guangcong Luo
75bff1cbb7 Fix validation for event-only VC Pokémon
Previously, we had a weird carved-out exception for Celebi from
74143b652d

But it actually applies to all VC Pokémon (most importantly Suicune).
2020-03-30 07:09:12 -07:00
Guangcong Luo
2d78044604 Fix activeTurns/activeMoveActions bugs
`activeTurns` was previously a horrible hack, used for "first full turn
only" effects like Speed Boost as well as "first move action" effects
like Fake Out.

In addition to being a huge hazard for API users such as OMs, this also
means weird bugs such as Speed Boost not working if you get hit by
Sky Drop on your first turn.

This commit fixes them by splitting these counters into two - an
`activeTurns` counter for Speed Boost, and an `activeMoveActions`
counter for Fake Out.
2020-03-30 04:07:05 -07:00
Guangcong Luo
60effa1838 Fix DW move validation 2020-03-30 02:29:13 -07:00
Leonard Craft III
296c308e62
Add test for when Dynamax should revert (#6502) 2020-03-30 01:03:37 -07:00
Marty-D
7a09037213 Validator: Fix Gen 2 event move tradebacks 2020-03-26 13:54:14 -04:00
The Immortal
81891546b9 Rename Missingno. to MissingNo. 2020-03-26 18:37:35 +04:00
Kris Johnson
994fc60aed
Rename Template to Species (#6478) 2020-03-25 23:29:27 -07:00
Leonard Craft III
380b4ac1cd
Add tests for Pledge moves modified by Z/Dynamax (#6489) 2020-03-25 19:14:48 -07:00
Guangcong Luo
2534753325 Fix Hidden Ability validation 2020-03-24 23:55:54 -07:00
Guangcong Luo
f562a18a26 Update tests for new targeting syntax 2020-03-24 02:56:39 -07:00
Guangcong Luo
5108a62f5e Standardize on using + for move targeting
Move targets are now intended to be +1 +2 +3 for foes. The old syntax
of using 1 2 3 is still supported, but is not recommended.

(The old syntax will still be used in the old client, but the Preact
client will support the new syntax going forward.)

This makes the difference between move number and move target
clearer.

This also fixes the Conversion 2 ambiguity (although for backwards
compatibility, we do still need to special-case it).
2020-03-23 23:50:46 -07:00
Guangcong Luo
90c503724f Support and document /move max mindstorm
Dynamax and Z move decisions can now be input by naming the max move
or z-move involved.

Fix #6425
2020-03-21 23:38:04 -07:00
The Immortal
2ad5525e8b Fix Parting Shot mechanics 2020-03-20 21:23:33 +04:00