Commit Graph

41 Commits

Author SHA1 Message Date
livid washed
cdb10c9016
Gen 1: Minor corrections for stat down overflow (#9099)
* Minor fixes for stat down overflow gen1

* Remove clamping from above for screens

* Add space for hint
2022-12-01 20:47:08 -08:00
livid washed
6cc75a6f88
Gen 1: Fix some more Counter inaccuracies (#9091)
* Move Gen 1 Counter tests into its own section

* Confusion damage, (h)jk recoil, and draining can be countered in gen 1

* Recoil and Drain round down in gen 1 (against substitute)

* Add tests for Counter + fix linting issue

* lastSelectedMove is updated when Mirror Move or Metronome calls another move

* Move pokemon.side.lastMove setting into a (more) correct location

* move pokemon.lastMove as well

* Remove unnecessary seed in test
2022-11-30 13:14:03 -08:00
livid washed
153377a5b8
Gen 1: Fix stat modification, implement stat overflow glitch (#9071)
* The volatiles don't actually do anything

* Gen 1: implement stat down overflow glitch

* Change the wording of the hint slightly

* Add hint for division by zero avoidance
2022-11-30 12:55:47 -08:00
livid washed
534cd35119
Gen 1: Fix inaccuracies in damage calculation (#9054) 2022-11-25 16:48:37 -08:00
livid washed
0c0fb305b2
Gen 1: Remove unnecessary RNG rolls for secondaries (#9062)
* Gen 1: remove unnecessary RNG rolls for secondaries

* remove a check that is now unnecessary
2022-11-25 16:48:12 -08:00
livid washed
fc6050ae78
Gen I: Clean up screens implementation (#9053) 2022-11-24 13:08:47 -06:00
livid washed
017c5557d0
Gen 1: Fix Confusion/Psybeam confusion chance and substitute interaction (#9044)
* Gen 1: Confusion/Psybeam can confuse enemies with substitute, and with probability 25/256 (not 26/256)

* Add explanatory hint for secondary effect confusion against Substitute
2022-11-23 12:45:45 -08:00
livid washed
66a930d4fe
Gen 1: Fix Explosion not fainting user when target is semi-invulnerable (#9034)
* Gen 1 Stadium: fix battle crash when Wrap KOs an enemy

* Fix explosion against semi-invulnerable enemies + shift disable-rage message location

* Add relevant Explosion test

* Add explanatory hint for Disable/Explosion boosting Rage

* Move rage interaction back to where it was
2022-11-23 12:44:55 -08:00
livid washed
52a77a5e79
Gen 1: Fix Wrap when hitting a substitute (#9015)
* Gen 1: Fix Wrap against a substitute

* Gen 1: Fix Wrap when it hits Ghosts behind a substitute

* Remove unnecessary 'else' statement

* Fix Stadium as well

* Fix Gen 1 Japanese as well
2022-11-19 18:13:35 -08:00
livid washed
ebdda4f691
Gen 1: Fix Rage not being triggered by missed Disable/Explosion (#8991)
* Gen 1: Fix Rage not being triggered by failed Disable/Explosion

* Gen 1 Stadium doesn't have the same behavior
2022-11-17 21:01:45 -08:00
livid washed
2947318816
Gen 1: Fix probabilities for 2-5 hit multihit moves (#8992) 2022-11-17 21:01:31 -08:00
Leonard Craft III
5842e1d56d Fix toID crash in Gen 1 mods 2022-11-17 20:42:14 -06:00
Kris Johnson
d50c8c249b
Add Gen 9 (#8997) 2022-11-17 20:46:29 -05:00
Mia
fb5f5d884c Fix last TS issue 2022-11-17 17:00:37 -06:00
Mia
37fc3ccc89 Fix TSC issues 2022-11-17 16:41:30 -06:00
livid washed
133212043b
Gen 1: Fix Counter interaction with Substitute (#8969)
* Gen 1: Fix Counter interaction with Substitute

* reverse an unintentional empty line delete

* reverse an unintentional empty line delete

* updating a couple of comments

* Update gen 1 Japanese version as well

* Update test/sim/moves/counter.js

Co-authored-by: pyuk-bot <msaimrkon@gmail.com>

* Update test/sim/moves/counter.js

Co-authored-by: pyuk-bot <msaimrkon@gmail.com>

Co-authored-by: pyuk-bot <msaimrkon@gmail.com>
2022-11-06 18:09:03 -08:00
Annika
c1718e0a2b Don't use the nullish coalescing assignment ??=
This is not supported by Sucrase and would break Node 14 attempts to build the client: https://github.com/alangpierce/sucrase/issues/550
2022-11-05 13:57:24 -07:00
livid washed
40cd8b41ff
Gen 1: Fix Mirror Move Hyper Beam interaction (#8966)
* (Partially) fix Mirror Move after move behavior

* typo
2022-11-04 18:40:47 -07:00
livid washed
7c5de2bd7c
Fix typos in comments (#8964) 2022-11-03 18:09:05 -05:00
livid washed
abb03d7531
Gen 1: Make Hyper Beam-Substitute interaction more accurate (#8963) 2022-11-02 19:26:09 -07:00
livid washed
4d3656ab80
Gen 1: Fix Twineedle poison chance (#8961) 2022-11-01 10:10:08 -07:00
livid washed
62c14cd024
Gen 1: Fix multiple Transform bugs (#8952)
* Gen 1: Fix multiple Transform bugs

* Modify partners in crime transformInto to be consistent with pokemon.ts changes

* undoing accidental sync of different branch
2022-10-27 19:55:31 -07:00
Kris Johnson
33a722e82d
Gen I: Properly fix Mist (#8836) 2022-07-18 18:44:19 -05:00
Karthik
a442790709
Gen I: Fix Transform bugs (#8732) 2022-04-24 17:59:37 -05:00
Karthik
993a48f584
Gen 1: Fix Haze (#8587) 2021-12-27 16:50:07 -05: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
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
Annika
c2e97aaaed
Use optional chaining in more places (#8063) 2021-02-22 11:42:05 -08:00
urkerab
80d652d59b Sturdy should trigger before Focus Sash but after False Swipe 2021-01-05 16:58:03 +00: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
Guangcong Luo
3d68248efa Update to latest eslint
We're skipping two major typescript-eslint versions, so there are a
bunch of changes here, including:

- it's catching a lot of things it didn't catch in the past, for
  reasons unclear to me

- no-unused-vars has to be explicitly disabled in global-types now

- a lot of `ts-ignore`s were never necessary and have been fixed

- Crashlogger can now handle being thrown things that aren't errors.
  This has never been a problem in the past, but to satisfy TypeScript
	we might as well not die in a fire on the off chance someone tries to
	`throw null` or something.
2020-09-29 15:28:08 -07:00
urkerab
5d714fbb56
Replace @ts-ignore with type assertions or other less unsafe constructs (#7390) 2020-09-19 02:07:48 -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
Mia
6839a1f4db
Add a library for utility functions (#6817) 2020-06-09 22:06:43 -07:00
Guangcong Luo
42f949a0ed Remove egg group info from Gen 1 Pokédex 2020-04-28 16:25:35 -07:00
Guangcong Luo
bfe651bd12 Fix Gen 1 gender
It was apparently broken by the TypeScript refactor.
2020-04-26 17:52:06 -07:00
Guangcong Luo
31a81a91a2 Fix @type in .ts files
Some JSDoc type assertions failed to get converted during various .ts
refactors. This commit takes care of them.
2020-04-24 14:19:08 -07:00
Kris Johnson
28bf388b98
Typescript data (#6553) 2020-04-23 09:16:09 -07:00