Commit Graph

276 Commits

Author SHA1 Message Date
Sergio Garcia
fc23103de1
Fix random typos (#11020)
Some checks are pending
Node.js CI / build (18.x) (push) Waiting to run
2025-04-13 23:59:36 -07:00
dot-Comfey
ee05311e38
Fix underleveled egg Pokemon and validation message error (#10922)
* Fix underleveled event Pokemon and validation message error

https://www.smogon.com/forums/threads/bug-report-validator.3760253/
https://www.smogon.com/forums/threads/bug-report-validator.3760172/

* Update team-validator.ts

* Update team-validator.ts
2025-02-25 22:14:55 -07:00
Guangcong Luo
78439b4a02
Update to ESLint 9 (#10926)
ESLint has a whole new config format, so I figure it's a good time to
make the config system saner.

- First, we no longer have separate eslint-no-types configs. Lint
  performance shouldn't be enough of a problem to justify the
  relevant maintenance complexity.

- Second, our base config should work out-of-the-box now. `npx eslint`
  will work as expected, without any CLI flags. You should still use
  `npm run lint` which adds the `--cached` flag for performance.

- Third, whatever updates I did fixed style linting, which apparently
  has been bugged for quite some time, considering all the obvious
  mixed-tabs-and-spaces issues I found in the upgrade.

Also here are some changes to our style rules. In particular:

- Curly brackets (for objects etc) now have spaces inside them. Sorry
  for the huge change. ESLint doesn't support our old style, and most
  projects use Prettier style, so we might as well match them in this way.
  See https://github.com/eslint-stylistic/eslint-stylistic/issues/415

- String + number concatenation is no longer allowed. We now
  consistently use template strings for this.
2025-02-25 20:03:46 -08:00
dot-Comfey
ff2ab5b61a
Update Pokemon GO data (#10919) 2025-02-18 18:43:52 -06:00
dot-Comfey
08fe70ec3d
Use base species only for learnsetDomain (#10910) 2025-02-15 21:55:05 -06:00
André Bastos Dias
ef97b292fb
Fix Enamorus shiny validity (#10864)
Some checks are pending
Node.js CI / build (16.x) (push) Waiting to run
2025-02-09 23:40:13 -06:00
André Bastos Dias
920a0e0773
Fix Rockruff-Dusk's Pokédex entry (#10871) 2025-02-09 20:17:52 -06:00
dot-Comfey
6bd4963e7a
Fix weird Dream World incompatibilities (#10856)
* Fix move validation involving prevo-only moves

https://www.smogon.com/forums/threads/bug-report-validator.3759104/

This is something that should've always been in #10574. Setting setSources.babyOnly becomes useless here because it eventually gets set after validating a move is complete.

* Actually fix DW
2025-02-01 00:32:14 -07:00
Guangcong Luo
ec7332b498 Import Utils from lib/utils
Some checks are pending
Node.js CI / build (16.x) (push) Waiting to run
This mostly is just a step towards removing sim's dependency on Node's
stdlib.
2025-01-14 23:01:53 -08:00
dot-Comfey
46309cf281
Fix illegality message for underleveled Pokemon (#10773)
Some checks are pending
Node.js CI / build (16.x) (push) Waiting to run
https://www.smogon.com/forums/threads/level-undefined-in-evolution-level-error.3756053/
2024-12-28 10:46:31 -06:00
dot-Comfey
b14054aafe
Properly validate Hidden Power type for events (#10701)
* Properly validate HP type for events

https://www.smogon.com/forums/threads/bug-report-validator.3754044/

* Update team-validator.ts

* Update team-validator.ts

* Update sim/team-validator.ts

Co-authored-by: urkerab <urkerab@users.noreply.github.com>

* Update team-validator.ts

Just some CamelCase...

* Prevent HP Stellar from being usable

https://www.smogon.com/forums/threads/bug-report-validator.3755718/

* Apply suggestions from code review

---------

Co-authored-by: urkerab <urkerab@users.noreply.github.com>
Co-authored-by: Kris Johnson <11083252+KrisXV@users.noreply.github.com>
2024-12-01 09:07:43 -07:00
urkerab
92a3264e77
Improve signature of getValidationSpecies (#10711) 2024-11-30 10:29:47 -07:00
larry-the-table-guy
71fe7bdfcb
Test: Correct several format IDs (#10633) 2024-10-29 05:14:19 -07:00
dot-Comfey
376a51cd55
Exclude unobtainable HM moves from movesearch (#10598)
* Exclude unobtainable HM moves from movesearch

https://www.smogon.com/forums/threads/impossible-hm-moves-in-movesearch.3735989/

* Update dex-species.ts

* Update dex-species.ts

* Update dex-species.ts

* Properly deal with CAP

After doing some digging, I found that 08bca77cf4 is when the isNonstandard check was added to allow CAP Pokemon to know HM moves. This was untouched for over ten years and was inadvertently allowing dexited Pokemon to have HM moves in NatDex that should be illegal in most other formats.

I don't believe this was ever intentional based on knowing the general mechanics of NatDex, nor does it have any impact on the metagame.
2024-10-06 10:05:27 -06:00
Karthik Bandagonda
eed269683e
Validator: Make Stellar tera invalid in pre-DLC formats (#10594)
Some checks are pending
Node.js CI / build (16.x) (push) Waiting to run
2024-10-02 16:52:09 -05:00
dot-Comfey
c55e6f6fde
Properly validate cosmetic forms in learnsetDomain (#10597) 2024-10-02 16:51:41 -05:00
dot-Comfey
d10187162b
Fix display issues with Ursaluna-Bloodmoon's moves (#10584)
* Fix display issues with Ursaluna-Bloodmoon's moves

https://www.smogon.com/forums/threads/bug-report-unsure.3752081/

These issues were probably also affecting Greninja-Ash and Cap Pikachu and this fix should cover them as well. This only fixes the server-side issues in the bug report; a separate fix will be needed for the teambuilder issue.

* Update sim/dex-species.ts

Co-authored-by: Kris Johnson <11083252+KrisXV@users.noreply.github.com>

---------

Co-authored-by: Kris Johnson <11083252+KrisXV@users.noreply.github.com>
2024-09-30 08:27:11 -06:00
dot-Comfey
a528cebce6
Fix Gen 8+ egg move legality (#10576) 2024-09-28 09:58:04 -05:00
dot-Comfey
6c29c905da
Fix prevo/evo move incompatibilities (#10574) 2024-09-26 20:22:11 -05:00
dot-Comfey
c453a59f58
Fix error message for event Pokemon (#10566) 2024-09-22 13:26:01 -05:00
larry-the-table-guy
ddf5848a38
Datasearch: Optimize runDexsearch (#10536)
* add crude profiling to runDexSearch

No behavioral changes (other than console.log spam), this commit is just to establish a baseline and pinpoint the slow portions

* optimize datasearch.ts - pull move filter prep out of loop

Based on preliminary benchmarks, most of the time was spent getting the move validator, even for queries that don't specify a move.
More importantly, the parameters for fetching the move validator are known very early in the function and don't change during the loop.
Pulling that portion out of the loop is an easy win.

* improve profiling for runDexSearch

- add subcategories for filtering on move (the next optimization target)
- report unaccounted time amounts ('known unknowns')
- make grand total stand out more

* optimize dexsearch - fetch move list in outer loop

Move list depends on 'alts', which does not change in the loop over mons. Minor win, but simple.

* optimize dexsearch - filter move list by gen in outer loop

Neither 'mod' nor 'altMoves' changes during the inner loop.

* log pokemonSource in runDexSearch - expose possible leak

pokemonSources, which appears to act as a set, grows with each iteration, adding seemingly redundant items.
Will need to look closely at TeamValidator to identify the problem. My guess is that it's putting object references into a Set,
which, for objects other than strings, only cares about object identity.

* profile runDexSearch - count checkCanLearn calls

Also, semi-fix issue identified in prior commit - the endless growth of the restrictiveMoves list.
Counting the calls to checkCanLearn helps us reason about whether the cost per call is reasonable.

* fix perf bug in TeamValidator.checkCanLearn

use the cached ruleTable, save 100x.

* optimize runDexSearch - only init move filters when needed

For queries that never mention a move, a considerable chunk of time is wasted getting the objects needed for
'checkCanLearn'. I measure ~1ms savings for the relevant queries, which is often a decent percentage.

* profile dexsearch - delete and format

This is to document that they are not the bottlenecks.

* remove nested profiling from dexsearch

We've gotten to the point where we actually *are* measuring microseconds, so the frequent calls
are too expensive. This is a good problem to have! What we can see from running npm test is
that 'filters' and 'unaccounted' still account for a majority of the time. So, there's still
room for improvement, if that's ever a serious concern.
Personally, I think working on the moves API would be more fruitful.

* remove all profiling code

No more console.log or performance.now() calls. Ready to merge.

* Update server/chat-plugins/datasearch.ts

Format the 'format' string in-line.

Co-authored-by: Mia <49593536+mia-pi-git@users.noreply.github.com>

* Remove ts-expect-error from datasearch.ts

* Fix uninit lint in runDexSearch

---------

Co-authored-by: Mia <49593536+mia-pi-git@users.noreply.github.com>
2024-09-17 11:46:35 -06:00
dot-Comfey
a7fd1c1c07
Allow underleveled event Pokemon (#10478) 2024-09-07 18:34:40 -05:00
HiZo
b242595e9d
Remove Tera Type property in past gens (#10505) 2024-08-24 22:09:18 -04:00
dot-Comfey
c98b992f03
Prevent Gen 2 and 3 eggs from being under level 5 (#10444)
https://www.smogon.com/forums/threads/low-level-hatched-pokemon-in-gens-2-3.3747600/
2024-07-24 19:59:47 -05:00
Leonard Craft III
27557e5fdc
Convert noSketch to move flag (#10407) 2024-07-14 23:45:10 -05:00
dot-Comfey
ce760e939c
Fix crash in egg move sources (#10406) 2024-07-09 18:00:18 -05:00
Guangcong Luo
88be8d7b3c
Refactor types for Lowercase<string> (#10377)
TypeScript 4.8+ supports Lowercase for lowercase strings, which isn't
exactly what ID is, but can be used to type IDs in object keys and data
entries that previously required string. I'm calling it IDEntry in places
where it should be an ID but TypeScript doesn't support that.

Very conveniently, no additional casts will be needed when using ID
where IDEntry is expected.

It's caught at least a few bugs, which is also why I'm PRing: I didn't
write the code for the bugs it found, and don't know if it's the right
way to fix them.

This ballooned into several other type refactors.
2024-07-01 15:57:14 -07:00
dot-Comfey
39395fb4cb
Fix egg move legality for some male-only Pokemon (#9895) 2024-06-22 16:28:39 -05:00
dot-Comfey
d954e8f350
Fix crash (#10360) 2024-06-21 07:35:22 -05:00
dot-Comfey
d91ffce482
Add picnic mechanics to Cap Pikachu (#10345) 2024-06-20 18:46:02 -05:00
dot-Comfey
48059af0a2
Add min source gen for event-only Pokemon (#10339) 2024-06-10 21:37:38 -05:00
Karthik
50bbc414ea
Allow using Terapagos formes in teambuilder (#10272) 2024-05-01 21:09:26 -05:00
Karthik
76c2e598c6
Let's Go: Implement itemless megas (#10212) 2024-03-24 22:56:13 -04:00
Leonard Craft III
af950c2cfe
Bandaid fix IV validation for new Gen 9 events (#10107) 2024-01-11 14:24:38 -06:00
dot-Comfey
6bd57f6fde
Fix Unown forme validation in Gen 2 (#10040)
* Fix Unown forme validation in Gen 2

https://www.smogon.com/forums/threads/bug-reports-v4-read-original-post-before-posting.3663703/post-9907946

* Update sim/team-validator.ts

Co-authored-by: Karthik <32044378+Karthik99999@users.noreply.github.com>

* Update sim/team-validator.ts

Co-authored-by: urkerab <urkerab@users.noreply.github.com>

* Update sim/team-validator.ts

Co-authored-by: urkerab <urkerab@users.noreply.github.com>

---------

Co-authored-by: Karthik <32044378+Karthik99999@users.noreply.github.com>
Co-authored-by: urkerab <urkerab@users.noreply.github.com>
2023-12-29 12:23:54 -07:00
Kris Johnson
a0f10ffa51
Add DLC2 data (#9963)
* DLC2 returning Pokemon

* Returning legendaries too

* Partially add Raging Bolt and Iron Crown (#10)

* Add remaining Pre-DLC2 event data

* Fix tests

* Last event before DLC + split learnset files

* Learnsets + secret returning pokemon

* Some DLC 2 stuff (#12)

* Add New Mons

* Add Electro Shot

* Give Dipplin Dex Evo

* Update data/moves.ts

---------

Co-authored-by: Kris Johnson <11083252+KrisXV@users.noreply.github.com>

* More tweaks

* formats

* Revealed moves (#11)

* Add Hard Press

* Add Psychic Noise

* Add Upper Hand

* Apply suggestions from code review

---------

Co-authored-by: Kris Johnson <11083252+KrisXV@users.noreply.github.com>

* more things

* Fix typo

* a lot of other things

* MOVES! kinda

* b

* fickle beam confirmed chance

* Evo Item Undexit + Metal Alloy + Move Fixes (#19)

* Update move data

* Update Item Data

* Apply suggestions from code review

---------

Co-authored-by: Kris Johnson <11083252+KrisXV@users.noreply.github.com>

* Add message for Fickle Beam BP double (#18)

* Add some tests and implement Tera Shell (#15)

* add some tests and draft of tera shell

* add text

* .

* add improvements from feedback, change behavior of terashell

* use AfterMove instead of AfterMoveSecondary

* add confirmation to multi-hit interaction

* improve based on feedback and general cleanup

* Apply suggestions from code review

---------

Co-authored-by: Kris Johnson <11083252+KrisXV@users.noreply.github.com>

* Add Tera Shift and Teraform Zero (#16)

* Add Tera Shift and Teraform Zero

* Add short descriptions

* fixes

* More move changes

* Update unSketchable moves

List from Anubis

* more move things

* oops

* Implement new Neutralizing Gas/Paradox ability interaction (#17)

* Implement new Neutralizing Gas/Paradox ability interaction

* add test

* revert in dlc

* ok

* Update pastgens for Sketch (#20)

* Implement Stellar type (#13)

* Implement Stellar type

* stuff from research

* pain

* add tests for Dragon Cheer (#22)

Co-authored-by: Kris Johnson <11083252+KrisXV@users.noreply.github.com>

* Update move flags (#23)

* Fix flags for new moves

* update old moves

* remove sparkling aria changes

* update metronome description

* update other move descriptions

* more formatz stuff

* Add Poison Puppeteer (#24)

* Add Poison Puppeteer

* i'm bad

* still bad

* Fix build

* oops

* Update data/moves.ts

Co-authored-by: Marty-D <Marty-D@users.noreply.github.com>

* Update data/moves.ts

Co-authored-by: Marty-D <Marty-D@users.noreply.github.com>

* Update data/items.ts

Co-authored-by: Marty-D <Marty-D@users.noreply.github.com>

* Update data/moves.ts

Co-authored-by: Marty-D <Marty-D@users.noreply.github.com>

* Fix Terapagos dex entries (#25)

* Update data/pokedex.ts

Co-authored-by: Marty-D <Marty-D@users.noreply.github.com>

* Update data/pokedex.ts

Co-authored-by: Marty-D <Marty-D@users.noreply.github.com>

* Update data/pokedex.ts

Co-authored-by: Marty-D <Marty-D@users.noreply.github.com>

* FIX BUILD

* Fix Regulation E formats (#26)

* Fix Regulation E formats

* add move bans

* nevermind

* Add Regulation F formats (#27)

* Fix interaction between Adaptability and Tera Stellar (#28)

* reg f bo3 ladder

* Update config/formats.ts

Co-authored-by: Leonard Craft III <leonardcraft64@gmail.com>

---------

Co-authored-by: Smudge <smudgerox@users.noreply.github.com>
Co-authored-by: Leonard Craft III <leonardcraft64@gmail.com>
Co-authored-by: Karthik <32044378+Karthik99999@users.noreply.github.com>
Co-authored-by: tofa <79044321+im-tofa@users.noreply.github.com>
Co-authored-by: Marty-D <Marty-D@users.noreply.github.com>
2023-12-15 21:35:01 -07:00
Guangcong Luo
eb60769cd3
Refactor learnset checking (#9951)
After seeing fifty different ways we use `getLearnset`, most of which
are just "haphazardly assemble a movepool", I decided to write
`getFullLearnset` and `getMovePool`, which centralizes the
implementations and prevents weird bugs like 9713dc6db5 which
we spent two years trying to figure out.
2023-12-08 22:45:47 -06:00
Karthik
d3cb797867
Send Open Team Sheets to client in packed format (#9832) 2023-10-17 21:15:09 -05:00
Karthik
cf5de82523
Fix location of gender randomization from #9839 (#9842) 2023-10-17 18:53:02 -05:00
Karthik
adebe24e5d
Randomize gender in team validator instead of battle (#9839) 2023-10-16 23:11:52 -05:00
dot-Comfey
6bcb9147bf
Fix egg move validation for female-only Pokemon (#9796) 2023-09-24 12:16:31 -04:00
dot-Comfey
cc1c2b7ae9
Fix team validator crash (#9794) 2023-09-21 21:06:30 -05:00
dot-Comfey
fd655af323
Fix egg move legality with past gen tutor moves (#9759) 2023-09-17 20:34:56 -05:00
Karthik
0e9dd94046
Fix Ogerpon Tera Type enforcement (#9779) 2023-09-14 19:39:19 -06:00
Kris Johnson
6bb3879e3a
Add Teal Mask DLC data (#9762)
Co-authored-by: Karthik99999 <bandagondak0217@gmail.com>
Co-authored-by: smudgerox <smudgerox@users.noreply.github.com>
Co-authored-by: Leonard Craft III <leonardcraft64@gmail.com>
Co-authored-by: Marty-D <Marty-D@users.noreply.github.com>
Co-authored-by: Karthik <32044378+Karthik99999@users.noreply.github.com>
2023-09-13 21:08:01 -04:00
dot-Comfey
8d14455fdc
Add recursive chainbreeding (#9751) 2023-09-10 18:54:10 -05:00
Alexander B
8fcff27fd5
Past gens: Fix old move/new Ability compatibility (#9750) 2023-09-08 18:53:59 -05:00
Alexander B
832a24f4bf
Frantic Fusions: Don't hide nicknames when locked (#9748) 2023-09-04 23:55:44 -06:00
dot-Comfey
cbfca624cf
Fix Pomeg glitch for event eggs (#9716) 2023-08-17 00:25:04 -05:00
dot-Comfey
9eebba0e0d
Fix low level egg move legality (#9709) 2023-08-13 21:52:19 -05:00