Commit Graph

17 Commits

Author SHA1 Message Date
André Bastos Dias
dc7294ed6e Remove unused code (#11215)
Some checks failed
Node.js CI / build (18.x) (push) Has been cancelled
* Remove unused Move#negateSecondary
* Remove unused 'SubDamage' event
* Remove unused Move#pressureTarget
* Partially remove unused Move#spreadModifier
2025-06-22 08:21:19 -07:00
André Bastos Dias
6513f4b18a Activate Wonder Guard if the target is immune (#11130)
* Activate Wonder Guard if the target is immune

* Lint

* Correctly check for immunities

* Refactor runImmunity

* Change all move.type to move

For example, this fixes Thousand Arrows vs Air Ballon Terapagos. Tera Shell was not activating.

* Remove unnecessary cast
2025-05-31 01:28:46 -06: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
Karthik
e218cb9dbb Properly implement Chloroblast recoil (#9648) 2023-07-15 14:54:49 -05:00
pyuk-bot
e3b791f310 Fix changing, blocking, and reacting to stat boosts (#9322) 2023-01-21 12:17:22 -05:00
livid washed
289ff26038 Gen 1: Fix Bide's implementation (#9201)
* Remove lastDamage as a field for Bide + remove some useless fields

* Bide: use time instead of duration, so that it doesn't get changed with slp/frz/etc

* Bide totalDamage should be adjusted before reducing Bide time. Damage counting should be done when the Bide user moves, not when the foe attacks it

* Call the stored damage 'damage' rather than 'totalDamage'

* Fix Bide target, Bide can hit substitutes, add test
s

* Add test for Bide vs switching / using moves that don't reset lastDamage

* Bide damage is reset to 0 when a Pokemon faints

* Add test for Bide when asleep

* Add Desync messages for Bide clearing stored damage when a Pokemon faints

* Mention Desync Clause Mod in test

* Specify 'in gen 1' in hint messages

* Bide is paused if disabled

* Improve Bide-Disable test

* Further adjust the Bide-Disable test
2022-12-20 15:02:27 -08:00
kittenchilly
30c41dcfbf Fix Last Respects and Supreme Overlord (#9111) 2022-12-04 12:46:28 -05:00
livid washed
335de05c6c Gen 2: Fix Metal Powder and other Pokemon-dependent items (#8993) 2022-11-17 21:01:16 -08:00
livid washed
7c5de2bd7c Fix typos in comments (#8964) 2022-11-03 18:09:05 -05:00
Rezzo64
6d21795b10 Gen II: Make Spikes work against semi-invulnerable targets (#8757)
Co-authored-by: Marty-D <Marty-D@users.noreply.github.com>
2022-06-20 12:47:54 -04:00
EvGym
5d8117302c Refactor overriding stats used for damaging moves (#8373) 2021-11-08 13:48:26 -08:00
Guangcong Luo
d0ea290992 Rename pokemon to source in getDamage
This has been split off from #8373 to improve diff readability.
2021-11-02 18:05:53 -04:00
Leonard Craft III
4771a9db55 Gens I-II: Remove unneeded checks for spread moves 2021-10-28 18:52:28 -05:00
InAShellnut
8faa194521 Stadium 2: Fix Destiny Bond, Perish Song, and recoil (#8398)
Co-authored-by: Marty-D <Marty-D@users.noreply.github.com>

Bugs documented here: https://www.smogon.com/forums/threads/pok%C3%A9mon-stadium-2-simulators-bugs-glitches-and-other-mistakes.3685286/
2021-07-17 16:08:53 -04:00
Karthik
c32d9aecfe Stadium 2: Send -unboost for stat drops (#8403) 2021-07-17 13:37:39 -04:00
Guangcong Luo
f9fdc73133 Support per-pokemon Residual handlers in Side/Field conditions (#8222)
For side conditions, `onStart`/`onRestart`/`onResidual`/`onEnd`
have been renamed `onSideStart`/`onSideRestart`/`onSideResidual`/`onSideEnd`,
with the `onResidualOrder` properties renamed `onSideResidualOrder`.

For field conditions, `onStart`/`onRestart`/`onResidual`/`onEnd`
have been renamed `onFieldStart`/`onFieldRestart`/`onFieldResidual`/`onFieldEnd`,
with the `onResidualOrder` properties renamed `onFieldResidualOrder`.

(The `onField` and `onSide` part helps make it clear to the type system
that the first argument is a Field or Side, not a Pokemon.)

Side and field conditions can now use `onResidual` to tick separately
on each pokemon in Speed order. `onResidualOrder` (the per-pokemon
tick) can be timed separate from `onSideResidualOrder` (the
per-condition tick), allowing conditions to end at a different priority
than they tick per-pokemon.

Relatedly, `onTeamPreview` and `onStart` in formats now need to be
`onFieldTeamPreview` and `onFieldStart`.

Unrelatedly, `effectData` has been renamed `effectState`, and the
corresponding state containers (`pokemon.statusData`,
`pokemon.speciesData`, `pokemon.itemData`, `pokemon.abilityData`,
`field.weatherData`, `field.terrainData`) have been similarly renamed. I
renamed the types a while ago, but I was holding off renaming the fields
because it would be a breaking change. But this is a breaking change
anyway, so we might as well do it now.

Note: `onResidual` will tick even on `onSideEnd` turns, although
`onSideResidual` won't. When refactoring weather, remember to
check `this.state.duration` so you don't deal weather damage on the
ending turn.

Intended as a better fix for #8216
2021-04-25 10:55:54 -07:00
InAShellnut
9ab4c86fe3 Add Stadium 2, Nintendo Cup 1997, and Nintendo Cup 2000 (#8195)
An implementation of Nintendo Cup 1997, Nintendo Cup 2000, and Pokemon Stadium 2, for Pokemon Showdown. The only thing which has not been implemented was showing the exact health of both Pokemon in Pokemon Stadium 2, however implementing that requires changes to the showdown client. The Nintendo Cup 1997 code was done by Enigami, and the rest was by myself (Shellnuts).

This should fulfill the requirements asked by the following accepted suggestions:
https://www.smogon.com/forums/threads/please-add-a-pok%C3%A9mon-stadium-2-simulator-in-showdown.3679486/
https://www.smogon.com/forums/threads/add-nintendo-cup-1997-and-2000-as-challenge-only-formats.3653454/
2021-04-22 00:54:14 -07:00