Commit Graph

24 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
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
Kris Johnson
068890e5c2 Add December 2024 OMotM/LCotM 2024-12-01 09:37:48 -07:00
Kris Johnson
44b0f7d8c1 Battle Actions: Clean up runMove and useMove function args (#10492)
* Battle Actions: Clean up `runMove` and `useMove` function args

* sdfsdf
2024-08-18 09:00:13 -06:00
Kris Johnson
10e6529eeb Revert "Redo #8134"
This reverts commit 1e8c0c183f.
2024-01-31 09:48:15 -07:00
Guangcong Luo
1e8c0c183f Redo #8134
We usually do data changes in scripts rather than in Dex, so the
changes in #8134 were a nonstandard approach. I think I just
was not thinking when I merged that PR.
2024-01-29 12:35:24 +09:00
Karthik
06d88748a5 Refactor STAB (again) (#10099) 2024-01-13 23:48:47 -06:00
Karthik
e218cb9dbb Properly implement Chloroblast recoil (#9648) 2023-07-15 14:54:49 -05:00
Leonard Craft III
156a39405f Refactor some move lists to move flags (#9396) 2023-03-18 22:21:00 -05:00
Marty-D
b341b8323d Gen III: Perform damage variance in the right place 2022-05-20 16:35:15 -04:00
Marty-D
b830ceb818 Gen II, III: Implement Quick Claw properly 2021-06-07 12:26:50 -04: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
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
Kris Johnson
5e6c259dec Gen 3/4: Remove HAs in getSpecies (#8134) 2021-03-23 10:19:50 -07:00
Dawnofares
e7f7260927 Show OHKO message if OHKO move breaks substitute (#7171) 2021-01-12 12:16:17 -05:00
Marty-D
a228f9eded Gen II-III: Fix Conversion 2 2021-01-08 13:40:48 -05:00
urkerab
0cbfeeba09 Fix Snatch in Gen 3 (#7812) 2020-12-15 19:25:59 -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
Kris Johnson
6699a57f4d Fix spread move mechanics in ADV Doubles (#7523) 2020-10-16 11:22:48 -04: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
Mia
6839a1f4db Add a library for utility functions (#6817) 2020-06-09 22:06:43 -07:00
Kris Johnson
28bf388b98 Typescript data (#6553) 2020-04-23 09:16:09 -07:00