Commit Graph

1462 Commits

Author SHA1 Message Date
Guangcong Luo
0cb51158aa
Make "All Pokemon" rules more convenient (#10932)
Some checks are pending
Node.js CI / build (18.x) (push) Waiting to run
* Make "All Pokemon" rules more convenient

Previously, "+All Pokemon" did nothing except override "-All Pokemon",
which switched from a default-allow to default-deny system.

They still do that, but they now also override all previous pokemon
bans/unbans. This makes it easier to replace a banlist/whitelist
from an inherited ruleset without needing to reverse every previous
ban/unban.

This also adds an error if you use `+All Pokemon` in a ruleset where
it doesn't do anything.

Fixes #10772
2025-03-02 14:47:30 -08:00
Guangcong Luo
557ed5008b Correctly support Node 18 2025-02-26 21:42:14 -08:00
Guangcong Luo
d8a051e364 It turns out Web Crypto isn't in Node 18
I was deceived by `crypto.getRandomValues` working in the repl, but
that's just because the repl has the Node standard library
pre-imported.

Anyway, this new code should work correctly in all of Node 18, newer
Node, and the browser.
2025-02-26 21:33:16 -08:00
Guangcong Luo
c0fcb03f4c Ugh I forgot why we can't update @types/node
(Newer versions don't play well with CommonJS modules. And there isn't
really even anywhere I can comment this to remind me not to do it...)
2025-02-26 20:21:10 -08:00
Guangcong Luo
d4fc262f7f Remove Node crypto dependency from sim 2025-02-26 18:03:08 -08:00
André Bastos Dias
bfc79b4043
Don't send upkeep if battle ended (#10927) 2025-02-26 15:29:01 -08:00
Guangcong Luo
66c90ebd29 Make sure CI correctly stops warnings
`full-test-ci` doesn't run on push to master, only `full-test`, so both
need the `--no-warnings` eslint flag.
2025-02-26 15:18:46 -08:00
Guangcong Luo
73a04cdcba TypeScript: Enable noImplicitOverride
Some checks are pending
Publish to npm / test (push) Waiting to run
Publish to npm / get-version (push) Waiting to run
Publish to npm / npm-publish (push) Blocked by required conditions
Node.js CI / build (18.x) (push) Waiting to run
2025-02-26 14:38:32 -08:00
Guangcong Luo
f301e930f6 Fix NPM publishing 2025-02-26 14:15:16 -08:00
Guangcong Luo
72bd8baf9e Add TypeScript types for sim requests 2025-02-26 00:00:23 -08:00
Guangcong Luo
e25bec3620 Remove some implicit conversions
boolean -> number and number -> string should be explicit. Probably
string -> number should be, too, but I'm not ready to turn on the lint
option yet.

This was supposed to be part of the big ESLint refactor but I forgot
to push it. <_<
2025-02-25 22:55:01 -08: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
6ab8e0da4c
Fix getUpdatedDetails default parameter (#10870) 2025-02-09 20:37:34 -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
Kris Johnson
519fe2eb37 Add February 2025 rotational ladders 2025-02-01 00:27:11 -07:00
pyuk-bot
bafd84ff10
Don't let leftover handlers from consumed items call eatItem/useItem (#10853)
Some checks are pending
Node.js CI / build (16.x) (push) Waiting to run
2025-01-31 14:46:42 -06:00
André Bastos Dias
dd4f69c168
Fix Illusion Level Mod (#10850)
Some checks failed
Node.js CI / build (16.x) (push) Has been cancelled
2025-01-30 09:26:55 -07:00
Karthik Bandagonda
f36cc3aee8
Fix Illusion Level Mod (#10849)
Some checks are pending
Node.js CI / build (16.x) (push) Waiting to run
* Fix Illusion Level Mod

* go back to just sending the level as the argument
2025-01-30 00:25:20 -07:00
HiZo
fce693795c
Fix bug where Wish and Future Sight ignore fainted pokemon (#10847) 2025-01-29 08:17:02 -06:00
pyuk-bot
d286478fe0
OMs: Fix innate abilities and items when switching in (#10844) 2025-01-28 20:24:13 -06:00
pyuk-bot
98ce87e636
Fix improper duplication of cached dex data (#10843)
Some checks are pending
Node.js CI / build (16.x) (push) Waiting to run
2025-01-28 18:37:29 -06:00
pyuk-bot
7bb2fd1869
Overhaul 'SwitchIn' event for more accurate effect resolution order (#10766) 2025-01-28 16:51:17 -06:00
HiZo
d5c4fb5730
Remove Crazyhouse Rule (#10841)
Some checks are pending
Node.js CI / build (16.x) (push) Waiting to run
* Remove Crazyhouse

Causes too many problems/crashes when mashed up.

* lint
2025-01-27 17:50:29 -07:00
larry-the-table-guy
97e70cb13f
PRNG: Address 'TODO: benchmark' comment (#10822)
Some checks failed
Node.js CI / build (16.x) (push) Has been cancelled
The alternative big-endian read impl is indeed slower.
2025-01-25 14:20:36 -07:00
André Bastos Dias
ce76114c12
Implement fainted forme regression (#10810) 2025-01-25 14:06:40 -06:00
André Bastos Dias
1dbe4f8aef
Tera Shell doesn't activate if the move is already resisted (#10815)
* Don't activate Tera Shell if resisted

* Fix for Hackmons

Relevant if Terapagos-Terastal transforms and terastallizes, keeping Tera Shell

* Update comment
2025-01-25 11:39:18 -07:00
André Bastos Dias
6d5970829a
Fix inherit for in-game mods (#10834) 2025-01-25 11:38:30 -07:00
Mia
1bdecae604 PRNG: Ensure seeds are generated securely
Some checks failed
Node.js CI / build (16.x) (push) Has been cancelled
2025-01-19 21:32:49 -06:00
Guangcong Luo
fde2b1187f
PRNGSeed is now a string (#10826)
Some checks are pending
Node.js CI / build (16.x) (push) Waiting to run
This makes it so we no longer need to ad-hoc convert seeds from strings
to arrays when we get them from text protocols like the command line or
BattleStream's `reseed` command.

It also has the side benefit of making inputlogs very slightly smaller.
2025-01-15 15:51:28 -08: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
Mia
d3e60b31f7
Sim: Use a CSPRNG (#10806)
* Sim: Use a CSPRNG

* Add test

* fix test prng

* move prng test to others

* fix slight hack

* tf?

* Fuck this

* fucking lol

* fix crap

* i'm going to kill someone

* i hate state

* fix test

* Good work genius

* typo

* Fix exportinputlog

* Refactor for inputlog backwards compatibility

This is a pretty major refactor which is mostly unrelated to the
feature, but it does make the code a lot simpler.

* Readability pass

* Readability (again)

* Remove sodium-native dependency

* Refactor to serialize seeds in hex strings

(Also removes the Buffer dependency from PRNG, and slightly improves
comments.)

* Apparently << is 32-bit signed

* Readability

---------

Co-authored-by: Guangcong Luo <guangcongluo@gmail.com>
2025-01-11 13:56:34 -06:00
André Bastos Dias
328e20dde1
Fix Gen 1 Substitute + Confusion interaction (#10802) 2025-01-10 13:49:11 -06:00
André Bastos Dias
dfcb64ec4c
Redo: Fix [from] message (#10798) 2025-01-10 00:36:13 -06:00
André Bastos Dias
041bf6a8b2
Fix Terastallization base power buff for priority moves called by Encore (#10808)
* Fix: Tera priority bump and Encore

* Line

* Fix check for multihit
2025-01-09 22:55:30 -07:00
Kris Johnson
392ab2df4a
Revert "Fix [from] message (#10796)" (#10797)
Some checks failed
Node.js CI / build (16.x) (push) Has been cancelled
This reverts commit 5468a36da1.
2025-01-05 22:24:11 -07:00
André Bastos Dias
5468a36da1
Fix [from] message (#10796) 2025-01-05 22:23:06 -07:00
larry-the-table-guy
b790eb8309
Remove dead code for dex initialization (#10793)
As of PR #10641, these are no longer necessary.
2025-01-04 13:14:22 -07: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
Karthik Bandagonda
8f2e1cb0d2
Always show OTS to spectators (#10767)
Some checks failed
Node.js CI / build (16.x) (push) Has been cancelled
2024-12-18 23:45:43 -06:00
bingingem
602e1d872f
/weakness: Add fuzzy matching (#10316)
* Weakness: add fuzzy matching to command

* fix linting errors

* removing `any` so TypeScript infers typing

* merge master branch properly

* push each species type individually instead  of string array
2024-12-16 22:30:54 -06:00
HiZo
f27bf860d3
Twisted Dimension: Fix Trick Room interaction (#10725)
Some checks failed
Node.js CI / build (16.x) (push) Has been cancelled
* Twisted Dimension: fix Trick Room interaction

* Update scripts.ts

---------

Co-authored-by: Kris Johnson <11083252+KrisXV@users.noreply.github.com>
2024-12-04 14:29:38 -07:00
Karthik Bandagonda
b68fc72b24
Add [Gen 9] Draft Factory (#10702)
Some checks are pending
Node.js CI / build (16.x) (push) Waiting to run
* Add [Gen 9] Draft Factory

* lint

* show tera types of captains

* fix tests

* why did it pass locally

* Update data/random-battles/gen9/teams.ts

* Update formats.ts

---------

Co-authored-by: Kris Johnson <11083252+KrisXV@users.noreply.github.com>
2024-12-03 17:30:24 -07:00
Kris Johnson
acd4858aec MnM Doubles: Allow >1 Mega Evolution per turn 2024-12-01 09:59:19 -07:00
Kris Johnson
068890e5c2 Add December 2024 OMotM/LCotM 2024-12-01 09:37:48 -07:00
Leonard Craft III
a8cdef75c2
Implement turn counter overflow with Wish / Future moves (#10700)
* Implement turn overflow with Wish / Future moves

* Improve hints
2024-12-01 09:08:00 -07:00