pokerogue/test/abilities
Sirz Benjie ec4ddab8be
[Bug] [Refactor] [Move] Add selection prevention and move failures (#6276)
* Add failure conditions and move failures part 1

* Add second and third failure sequences

* Refactor mostly complete, need to recheck tests

* Adjust status checks to respect ignoreStatus useModes

* Adjust restriction for stuff cheeks

* Address bertie's review comments

* Add counterRedirectAttr to other counter-like moves

* Adjust some documentation for new methods

* Make substitute use the move tag

* Adjust counter attr to use array.find

* Adjust move condition check that occurs in the third failure check sequence

* Insert move failure check sequence part 4 into move phase

* Revert type adjustment to getBattlerIndex

* Make charging moves deduct pp on use instead of on release

* Fix first move condition not using 1 based starting wave

* Tweak charge move handling and protean timing

* Adjust fly tests to expect pp reduction properly

* Add missing attribute to counter

* Adjust revival blessing hardcore test to respect new return value of isUsable

* Adjust copycat test to account for how it actually works

* Play sleep animation and message

* Remove BYPASS_SLEEP battler tag in favor of boolean holder

* Finish unfinished docs

* Ensure move restrictions are only checked for players

* Adjust pollen puff condition, fix docs on `isOpponent`

* Fix failAgainstFinalBossCondition

* Fix dig test

* Adjust dive's test

* Fix missing break in applyConditions

* Fix getBattlerIndex for enemyPokemon

* Adjust type hint test to not rely on teleport

* Minor adjustments from code review

Co-authored-by: Bertie690 <136088738+Bertie690@users.noreply.github.com>

* Add tests for teleport

* Minor adjustments from code review

Co-authored-by: Bertie690 <136088738+Bertie690@users.noreply.github.com>

* PR review changes

Fix type hints test name

Update Dig/Dive test name

Separate TSDoc imports in `pokemon-utils.ts`

Add missing `@returns` in `move-phase.ts`

Fix comment typos

Separate TSDoc imports in `move-phase.ts`

Add return hints to `trySelectMove`

Minor formatting

Remove duplicate `.affectedByGravity()` on Telekinesis

Fix docs for `checkRestrictions`

Manually format method definition

Fix comment spacing

Fix variable naming

* Address kev's review comments

Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>

* Minor adjustments from code review

Co-authored-by: Bertie690 <136088738+Bertie690@users.noreply.github.com>

* Remove optional chaining

* fix: type for InferKeys

* chore: apply biome

* chore: fix merge conflicts from Biome update

* Remove latent isNullOrUndefined

* Drop readonly on timingModifier

* docs: Add class comment

* Address comments from code review

* Drop readonly from timingModifier

* Cleanup proc chance computation

* Move `cureStatus` into the Pokemon class

* Final touchups

---------

Co-authored-by: Bertie690 <136088738+Bertie690@users.noreply.github.com>
Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
2025-09-29 12:08:42 -05:00
..
ability-activation-order.test.ts [Misc] Standardize-file-names (#6137) 2025-07-24 16:38:31 -04:00
ability-duplication.test.ts [Test] Updated more uses of game.scene.getEnemyField and game.scene.getPlayerField to use updated test utils (#6524) 2025-09-18 09:36:08 -05:00
ability-timing.test.ts [Misc] Standardize-file-names (#6137) 2025-07-24 16:38:31 -04:00
analytic.test.ts [Dev] Migrated to Biome 2.2.3, added more rules (#6259) 2025-09-08 10:35:18 -05:00
anger-point.test.ts [Test] Replace game.scene.getXPokemon()! with game.field.getXPokemon() 2025-08-04 21:19:57 -07:00
arena-trap.test.ts [Misc] Simplifying imports of UI files (#6542) 2025-09-11 00:30:17 -07:00
aroma-veil.test.ts [Misc] Standardize-file-names (#6137) 2025-07-24 16:38:31 -04:00
aura-break.test.ts [Misc] Standardize-file-names (#6137) 2025-07-24 16:38:31 -04:00
battery.test.ts [Misc] Standardize-file-names (#6137) 2025-07-24 16:38:31 -04:00
battle-bond.test.ts [Misc] Standardize-file-names (#6137) 2025-07-24 16:38:31 -04:00
beast-boost.test.ts [Test] Replace game.scene.getXPokemon()! with game.field.getXPokemon() 2025-08-04 21:19:57 -07:00
commander.test.ts [Test] Updated more uses of game.scene.getEnemyField and game.scene.getPlayerField to use updated test utils (#6524) 2025-09-18 09:36:08 -05:00
competitive.test.ts [Test] Replace game.scene.getXPokemon()! with game.field.getXPokemon() 2025-08-04 21:19:57 -07:00
contrary.test.ts [Test] Replace game.scene.getXPokemon()! with game.field.getXPokemon() 2025-08-04 21:19:57 -07:00
corrosion.test.ts [Bug] Refactored status code, fixed Rest/Sleep Talk status checks (#5872) 2025-08-20 08:45:09 -05:00
costar.test.ts [Misc] Standardize-file-names (#6137) 2025-07-24 16:38:31 -04:00
cud-chew.test.ts [Bug] [Refactor] [Move] Add selection prevention and move failures (#6276) 2025-09-29 12:08:42 -05:00
dancer.test.ts [Misc/Feature] Add dynamic turn order (#6036) 2025-09-20 17:49:40 -05:00
defiant.test.ts [Test] Replace game.scene.getXPokemon()! with game.field.getXPokemon() 2025-08-04 21:19:57 -07:00
desolate-land.test.ts [Test] Replace game.scene.getXPokemon()! with game.field.getXPokemon() 2025-08-04 21:19:57 -07:00
disguise.test.ts [Refactor] Remove null from PhaseManager.currentPhase signature 2025-09-05 09:28:35 -07:00
dry-skin.test.ts [Test] Replace game.scene.getXPokemon()! with game.field.getXPokemon() 2025-08-04 21:19:57 -07:00
early-bird.test.ts [Test] Replace game.scene.getXPokemon()! with game.field.getXPokemon() 2025-08-04 21:19:57 -07:00
embody-aspect.test.ts [Ability] Embody Aspect now triggers on switch-in while Terastallized (#6294) 2025-08-20 20:10:54 -05:00
flash-fire.test.ts [Test] Replace game.scene.getXPokemon()! with game.field.getXPokemon() 2025-08-04 21:19:57 -07:00
flower-gift.test.ts [Test] Updated more uses of game.scene.getEnemyField and game.scene.getPlayerField to use updated test utils (#6524) 2025-09-18 09:36:08 -05:00
flower-veil.test.ts [Test] Updated more uses of game.scene.getEnemyField and game.scene.getPlayerField to use updated test utils (#6524) 2025-09-18 09:36:08 -05:00
forecast.test.ts [Test] Updated more uses of game.scene.getEnemyField and game.scene.getPlayerField to use updated test utils (#6524) 2025-09-18 09:36:08 -05:00
friend-guard.test.ts [Dev] Migrated to Biome 2.2.3, added more rules (#6259) 2025-09-08 10:35:18 -05:00
good-as-gold.test.ts [Test] Replace game.scene.getXPokemon()! with game.field.getXPokemon() 2025-08-04 21:19:57 -07:00
gorilla-tactics.test.ts [Test] Replace game.scene.getXPokemon()! with game.field.getXPokemon() 2025-08-04 21:19:57 -07:00
guard-dog.test.ts [Misc] Standardize-file-names (#6137) 2025-07-24 16:38:31 -04:00
gulp-missile.test.ts [Docs] Fixup typedoc warnings (#6540) 2025-09-10 13:35:55 -05:00
harvest.test.ts [Test] Replace game.scene.getXPokemon()! with game.field.getXPokemon() 2025-08-04 21:19:57 -07:00
healer.test.ts [Refactor] Remove isNullOrUndefined in favor of loose check against null (#6549) 2025-09-12 14:53:27 -05:00
heatproof.test.ts [Test] Replace game.scene.getXPokemon()! with game.field.getXPokemon() 2025-08-04 21:19:57 -07:00
honey-gather.test.ts [Test] Replace game.scene.getXPokemon()! with game.field.getXPokemon() 2025-08-04 21:19:57 -07:00
hustle.test.ts [Test] Replace game.scene.getXPokemon()! with game.field.getXPokemon() 2025-08-04 21:19:57 -07:00
hyper-cutter.test.ts [Test] Replace game.scene.getXPokemon()! with game.field.getXPokemon() 2025-08-04 21:19:57 -07:00
ice-face.test.ts [Test] Replace game.scene.getXPokemon()! with game.field.getXPokemon() 2025-08-04 21:19:57 -07:00
illuminate.test.ts [Test] Replace game.scene.getXPokemon()! with game.field.getXPokemon() 2025-08-04 21:19:57 -07:00
illusion.test.ts [Test] Replace game.scene.getXPokemon()! with game.field.getXPokemon() 2025-08-04 21:19:57 -07:00
infiltrator.test.ts [Bug] Refactored status code, fixed Rest/Sleep Talk status checks (#5872) 2025-08-20 08:45:09 -05:00
innards-out.test.ts [Misc] Standardize-file-names (#6137) 2025-07-24 16:38:31 -04:00
intimidate.test.ts [Bug/Ability] Fixed bugs with Intimidate triggers after reload/initial switch (#6212) 2025-08-24 14:09:16 -05:00
intrepid-sword.test.ts [Test] Replace game.scene.getXPokemon()! with game.field.getXPokemon() 2025-08-04 21:19:57 -07:00
lightningrod.test.ts [Misc] Standardize-file-names (#6137) 2025-07-24 16:38:31 -04:00
magic-bounce.test.ts [Test] Updated more uses of game.scene.getEnemyField and game.scene.getPlayerField to use updated test utils (#6524) 2025-09-18 09:36:08 -05:00
magic-guard.test.ts [Misc] Standardize-file-names (#6137) 2025-07-24 16:38:31 -04:00
mimicry.test.ts [Test] Replace game.scene.getXPokemon()! with game.field.getXPokemon() 2025-08-04 21:19:57 -07:00
mirror-armor.test.ts [Test] Updated more uses of game.scene.getEnemyField and game.scene.getPlayerField to use updated test utils (#6524) 2025-09-18 09:36:08 -05:00
mold-breaker.test.ts [Misc] Standardize-file-names (#6137) 2025-07-24 16:38:31 -04:00
moody.test.ts [Bug] Moody Can't Lower Stats at +6 (#6481) 2025-09-06 06:46:13 +00:00
moxie.test.ts [Test] Removed deprecated functions from phase interceptor (#6195) 2025-08-19 19:54:40 -05:00
mummy.test.ts [Test] Replace game.scene.getXPokemon()! with game.field.getXPokemon() 2025-08-04 21:19:57 -07:00
mycelium-might.test.ts [Misc/Feature] Add dynamic turn order (#6036) 2025-09-20 17:49:40 -05:00
neutralizing-gas.test.ts [Misc/Feature] Add dynamic turn order (#6036) 2025-09-20 17:49:40 -05:00
no-guard.test.ts [Test] Updated more uses of game.scene.getEnemyField and game.scene.getPlayerField to use updated test utils (#6524) 2025-09-18 09:36:08 -05:00
normal-move-type-change.test.ts [Test] Replace game.scene.getXPokemon()! with game.field.getXPokemon() 2025-08-04 21:19:57 -07:00
normalize.test.ts [Bug] Fix when variable move power is called (#6126) 2025-07-24 23:16:23 -07:00
oblivious.test.ts [Test] Replace game.scene.getXPokemon()! with game.field.getXPokemon() 2025-08-04 21:19:57 -07:00
own-tempo.test.ts [Misc] Standardize-file-names (#6137) 2025-07-24 16:38:31 -04:00
parental-bond.test.ts [Test] Replace game.scene.getXPokemon()! with game.field.getXPokemon() 2025-08-04 21:19:57 -07:00
pastel-veil.test.ts [Test] Added/cleaned up tests for Pastel/Sweet Veil (#6374) 2025-09-05 21:42:44 -05:00
perish-body.test.ts [Test] Replace game.scene.getXPokemon()! with game.field.getXPokemon() 2025-08-04 21:19:57 -07:00
power-construct.test.ts [Dev] Migrated to Biome 2.2.3, added more rules (#6259) 2025-09-08 10:35:18 -05:00
power-spot.test.ts [Misc] Standardize-file-names (#6137) 2025-07-24 16:38:31 -04:00
protean-libero.test.ts [Misc] Standardize-file-names (#6137) 2025-07-24 16:38:31 -04:00
protosynthesis.test.ts [Test] Replace game.scene.getXPokemon()! with game.field.getXPokemon() 2025-08-04 21:19:57 -07:00
quick-draw.test.ts [Misc/Feature] Add dynamic turn order (#6036) 2025-09-20 17:49:40 -05:00
sand-spit.test.ts [Misc] Standardize-file-names (#6137) 2025-07-24 16:38:31 -04:00
sand-veil.test.ts [Misc] Standardize-file-names (#6137) 2025-07-24 16:38:31 -04:00
sap-sipper.test.ts [Test] Replace game.scene.getXPokemon()! with game.field.getXPokemon() 2025-08-04 21:19:57 -07:00
schooling.test.ts [Dev] Migrated to Biome 2.2.3, added more rules (#6259) 2025-09-08 10:35:18 -05:00
screen-cleaner.test.ts [Misc] Standardize-file-names (#6137) 2025-07-24 16:38:31 -04:00
seed-sower.test.ts [Misc] Standardize-file-names (#6137) 2025-07-24 16:38:31 -04:00
serene-grace.test.ts [Misc] Standardize-file-names (#6137) 2025-07-24 16:38:31 -04:00
sheer-force.test.ts [Test] Cleaned up tests to use updated test utils; part 1 (#6176) 2025-08-19 19:21:40 -05:00
shell-armor.test.ts [Misc] Standardize-file-names (#6137) 2025-07-24 16:38:31 -04:00
shield-dust.test.ts [Test] Replace game.scene.getXPokemon()! with game.field.getXPokemon() 2025-08-04 21:19:57 -07:00
shields-down.test.ts [Test] Cleaned up shields down tests; added more tests (#6216) 2025-08-20 08:57:46 -05:00
simple.test.ts [Test] Replace game.scene.getXPokemon()! with game.field.getXPokemon() 2025-08-04 21:19:57 -07:00
speed-boost.test.ts [Test] Replace game.scene.getXPokemon()! with game.field.getXPokemon() 2025-08-04 21:19:57 -07:00
stakeout.test.ts [Misc] Standardize-file-names (#6137) 2025-07-24 16:38:31 -04:00
stall.test.ts [Misc/Feature] Add dynamic turn order (#6036) 2025-09-20 17:49:40 -05:00
status-immunity-ab-attrs.test.ts [Bug] Refactored status code, fixed Rest/Sleep Talk status checks (#5872) 2025-08-20 08:45:09 -05:00
steely-spirit.test.ts [Test] Replace game.scene.getXPokemon()! with game.field.getXPokemon() 2025-08-04 21:19:57 -07:00
storm-drain.test.ts [Test] Updated more uses of game.scene.getEnemyField and game.scene.getPlayerField to use updated test utils (#6524) 2025-09-18 09:36:08 -05:00
sturdy.test.ts [Test] Cleaned up tests to use updated test utils; part 1 (#6176) 2025-08-19 19:21:40 -05:00
super-luck.test.ts [Test] Replace game.scene.getXPokemon()! with game.field.getXPokemon() 2025-08-04 21:19:57 -07:00
supreme-overlord.test.ts [Bug] Apply Supreme Overlord only once on summon (#6575) 2025-09-19 23:08:02 -05:00
sweet-veil.test.ts [Test] Added/cleaned up tests for Pastel/Sweet Veil (#6374) 2025-09-05 21:42:44 -05:00
synchronize.test.ts [Test] Replace game.scene.getXPokemon()! with game.field.getXPokemon() 2025-08-04 21:19:57 -07:00
tera-shell.test.ts [Test] Replace game.scene.getXPokemon()! with game.field.getXPokemon() 2025-08-04 21:19:57 -07:00
trace.test.ts [Test] Replace game.scene.getXPokemon()! with game.field.getXPokemon() 2025-08-04 21:19:57 -07:00
truant.test.ts [Test] Added matcher to check message contents; added tests for Splash, Celebrate, Laser Focus (#6299) 2025-09-10 13:40:21 -05:00
unburden.test.ts [Test] Updated more uses of game.scene.getEnemyField and game.scene.getPlayerField to use updated test utils (#6524) 2025-09-18 09:36:08 -05:00
unseen-fist.test.ts [Test] Replace game.scene.getXPokemon()! with game.field.getXPokemon() 2025-08-04 21:19:57 -07:00
victory-star.test.ts [Misc] Standardize-file-names (#6137) 2025-07-24 16:38:31 -04:00
volt-absorb.test.ts [Test] Replace game.scene.getXPokemon()! with game.field.getXPokemon() 2025-08-04 21:19:57 -07:00
wandering-spirit.test.ts [Test] Replace game.scene.getXPokemon()! with game.field.getXPokemon() 2025-08-04 21:19:57 -07:00
wimp-out.test.ts [Test] Cleaned up tests to use updated test utils; part 1 (#6176) 2025-08-19 19:21:40 -05:00
wind-power.test.ts [Test] Replace game.scene.getXPokemon()! with game.field.getXPokemon() 2025-08-04 21:19:57 -07:00
wind-rider.test.ts [Test] Replace game.scene.getXPokemon()! with game.field.getXPokemon() 2025-08-04 21:19:57 -07:00
wonder-skin.test.ts [Misc] Standardize-file-names (#6137) 2025-07-24 16:38:31 -04:00
zen-mode.test.ts [Test] Replace game.scene.getXPokemon()! with game.field.getXPokemon() 2025-08-04 21:19:57 -07:00
zero-to-hero.test.ts [Test] Cleaned up tests to use updated test utils; part 1 (#6176) 2025-08-19 19:21:40 -05:00