Commit Graph

68 Commits

Author SHA1 Message Date
André Bastos Dias
1091524b94
Gen 1: Fix underflow glitch applied to mimicked duplicate moves (#11746)
Some checks failed
Node.js CI / build (18.x) (push) Has been cancelled
* Fix underflow glitch applied to mimicked duplicate moves

* Remove flags

* Remove console.log
2026-02-17 18:36:37 -07:00
Sergio Garcia
13aa6355af
Fix various typos (#11607) 2025-12-08 18:38:02 -06:00
André Bastos Dias
5eee238838
Fix Transform and Mimic PP in Gen 1 (#11323)
Some checks are pending
Node.js CI / build (18.x) (push) Waiting to run
2025-08-03 18:16:20 -07:00
André Bastos Dias
f24d648c8a
Fix accuracy of Gen 1 trapping moves (#11305)
* Fix accuracy of Gen 1 trapping moves

* Fix tests

* Update data/mods/gen1/scripts.ts

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

* Update data/mods/gen1stadium/scripts.ts

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

* Update data/mods/gen3/scripts.ts

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

---------

Co-authored-by: Kris Johnson <11083252+KrisXV@users.noreply.github.com>
2025-07-29 17:47:49 -06:00
André Bastos Dias
fd21559ba8
Refactor Gen 1 partial trapping (#11189) 2025-07-22 02:12:20 -07:00
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
HiZo
75533cca60
Fix Gen 1 PP underflow (#10967)
Some checks are pending
Node.js CI / build (18.x) (push) Waiting to run
PP is now deducted after the move rather than before, which is more
accurate and also simplifies the code.

Co-authored-by: Guangcong Luo <guangcongluo@gmail.com>
2025-03-12 21:59:30 -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
pyuk-bot
7bb2fd1869
Overhaul 'SwitchIn' event for more accurate effect resolution order (#10766) 2025-01-28 16:51:17 -06:00
André Bastos Dias
6d5970829a
Fix inherit for in-game mods (#10834) 2025-01-25 11:38:30 -07:00
larry-the-table-guy
196b72ad50
Dex: Don't deepClone Pokedex during load (#10611)
Some checks are pending
Node.js CI / build (16.x) (push) Waiting to run
The only issue came from gen1 not using modData. After fixing that, everything just works.
You can test this by deepFreezing dataCache right after running Scripts.init and
then loading all the species for all the mods and running the test suite.
2024-10-12 18:50:04 -06:00
livid washed
8c3da840ba
Gen 1: Fix Hyper Beam's interaction with partial trapping moves (#10517) 2024-09-28 12:56:51 -06: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
livid washed
f880451f0a
Apply Inverse Mod to Gen 1 (#9621) 2023-07-01 01:21:11 -06:00
AnnikaCodes
ffb4eb3163
Gen I: Moves can deal 0 damage 2023-03-29 17:15:44 -07:00
Annika
7750a264da Gen I: OHKO checking should not rely on cached action speed 2023-03-28 15:39:15 -07:00
livid washed
915dcc16f5
Gen 1: Stat drop shouldn't recalculate stats if the Pokemon has a stat of 1 (#9475) 2023-03-24 17:24:13 -07:00
Annika
b03a2b47d2 Gen I: Fix |-mustrecharge| messages 2023-03-11 18:10:40 -08:00
livid washed
0f2853306d
Gen 1: Fail message should appear when a boosting move fails (#9454) 2023-03-10 15:16:29 -08:00
livid washed
bfff1adf3a
Gen 1 Thrash: Confusion from thrashing should be silently added (#9345)
* Gen 1 Thrash: Confusion from thrashing should be silently added

* cleaner code
2023-01-22 13:39:19 -08:00
pyuk-bot
e3b791f310
Fix changing, blocking, and reacting to stat boosts (#9322) 2023-01-21 12:17:22 -05:00
livid washed
6573f468bc
Gen 1: Fix Thrash and Rage mechanics (#9315)
* Copy everything from Gen 2 thrashing condition and stop inheriting

* Remove residual and MoveAborted events (don't occur in gen 1)

* effectState.duration --> effectState.time, so that thrashing pauses on slp/frz/flinch/partial trapping. Also, confusion is now applied before the final Thrash hits (but after confusion check, so the final Thrash won't be interrupted)

* Confusion is only applied if Thrashing effect ends naturally, not due to full para/confusion

* Thrash should lock the user in, even if it misses/hits a Ghost/etc

* Add Thrash tests: duration and locking in the user when it misses

* Thrash locks in the user even if it breaks a sub

* Remove unnecessary events for thrashing moves

* Thrash is paused when the user is asleep, frozen, partially trapped, or flinching

* Thrash is paused when disabled

* Rage duration is permanent, not 255

* Implement Rage/Thrash accuracy bug (need to change when lockedmove volatile is removed

* Move location of applying thrashing effect, so that the final turn will be subject to accuracy bug

* Add test for Thrash accuracy bug

* Add test for Rage accuracy bug

* Remove useless line

* Use an event for obtaining accuracy of Rage/Thrash

* Revert last change
2023-01-14 14:47:58 -08:00
livid washed
57f00f2c24
Gen 1: Fix battle log for charging moves, add hint for stat overflow (#9294)
* Gen 1: Fix battle log for charging moves

* Add hint for stat overflow
2023-01-08 17:49:19 -08:00
livid washed
a1cb1f23fc
Gen 1: Implement Dig/Fly invulnerability glitch, partially fix charging moves and Mirror Move (#9243)
* Protect/Detect/Endure don't exist in gen 1

* Add twoturnmove condition to gen 1

* Gens 1-2: Mirror Move fails immediately after a switch

* Fix first Mirror Move test: Fearow was getting OHKO'd by Hyper Beam

* pokemon.lastMove (for Mirror Move) isn't updated with the charging turn

* Remove unnecessary code

* Add onTryMove for each two-turn move with removeVolatile('twoturnmove')

* Sleep, Freeze, partial trapping, flinch don't stop two turn moves

* Para/confusion stops thrashing moves + copy over lockedmove condition details instead of inheriting

* Remove some unnecessary code

* Add Dig/Fly invulnerability glitch

* Add hint for Dig/Fly invulnerability glitch

* Gen 1 Japanese and Stadium

* put Dig before Fly

* Self-targeted moves (e.g. Recover) will work while semi-invulnerable

* Revert changes to lockedmove, do them in a future patch

* move ends if it fails due to disable

* Two-turn moves use PP in their second turn

* restore mocharc

* Remove unnecessary code

* Fix PP usage for Metronome/Mirror Move calling two-turn moves
2022-12-29 18:35:59 -08:00
livid washed
dc29389347
Gen 1: Actually fix Metronome calling Counter (#9156)
* Actually fix Metronome calling Counter

* Use set instead of array for lastDamage skipping moves

* Add Metronome-Counter test
2022-12-11 14:31:43 -08:00
livid washed
d59bce51c6
Gen 1: Fix more Counter bugs (#9136)
* Gen 1: SonicBoom can be Countered

* OHKO moves do 65535 damage (matters for Counter against sub)

* Move damage comparison with target hp outside getDamage()

* Remove a blank line

* Move damage comparison with target hp outside getDamage() (Stadium)

* Add counter test

* Fix Metronome not failing if calling Counter (move setting lastDamage before tryMoveHit)

* Do the same for Stadium

* Start phasing out pokemon.lastDamage from Gen 1 code

* Failed Counter doesn't zero lastDamage

* When a move misses, battle.lastDamage is set to 0

* Remove all pokemon.lastDamage

* Remove a couple of comments
2022-12-08 16:07:39 -08:00
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