Commit Graph

144 Commits

Author SHA1 Message Date
Acelynn Zhang
2e3a7d47e0
[Bug] Fix Thrash continuing on caught Pokemon (#6144)
Fix Thrash continuing on caught Pokemon
2025-07-25 23:55:13 +00:00
NightKev
7b7edbb474
[Test] MoveHelper#changeMoveset disables moveset overrides (#5915)
Also fix Assist tests and add `expect` for max moveset length
2025-07-25 16:22:52 -07:00
Acelynn Zhang
fc128a2f4c
[Bug] Fix when variable move power is called (#6126)
* Apply variable power attribute before type boost

* Update test/abilities/normal-move-type-change.test.ts

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

* Minor test improvements

---------

Co-authored-by: Sirz Benjie <142067137+SirzBenjie@users.noreply.github.com>
Co-authored-by: Bertie690 <136088738+Bertie690@users.noreply.github.com>
Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
2025-07-24 23:16:23 -07:00
Bertie690
6ad11015f7
[Dev] Remove sanitizeOverrides, consolidate initialization code into 1 file
https://github.com/pagefaultgames/pokerogue/pull/6134

* Removed `sanitizeOverrides`

* Moved initialization code to its own file

* Hopefully fixed test contamination

* Actually listened to people now

* fixed the thingy

* Run stub setup on init because

* Update testFileInitialization.ts

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

---------

Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
2025-07-25 01:23:13 +00:00
Acelynn Zhang
6211fbd471
[Bug] Unblock priority spread under Psychic Terrain (#6136)
Unblock priority spread under Psychic Terrain

Co-authored-by: Acelynn Zhang <acelynnzhang@Acelynns-MacBook-Pro.local>
2025-07-25 01:05:14 +00:00
Sirz Benjie
51d4c33de0
[Misc] Standardize-file-names (#6137)
* Standardize filenames to kebab-case

Co-authored-by: pymilkmaiden <cassiopeiamahler56@gmail.com>

* Move script outside of public folder

* Move update_exp_sprites to scripts

* Add ls-lint to lint file and directory names

* Update lefthook.yml to skip merge / rebase on all pre-commit commands

---------

Co-authored-by: pymilkmaiden <cassiopeiamahler56@gmail.com>
2025-07-24 16:38:31 -04:00
Sirz Benjie
ef843debee
[UI/UX] Allow adjustable column count in stats-ui-handler
https://github.com/pagefaultgames/pokerogue/pull/6087

* Make column count modular

Co-authored by: ShinigamiHolo <128856544+ShinigamiHolo@users.noreply.github.com>

* Make game stats ui handler use phaser method chaining

* Adjust max cursor calculation

* Make arrowUp start invisible

* Add implementations for setFlip methods in MockSprite

* Misc cleanup

* Address kev's review comments

* Address kev's review comments

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

* improve clarity of doc comment

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

---------

Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
Co-authored-by: Bertie690 <136088738+Bertie690@users.noreply.github.com>
2025-07-23 23:06:17 -04:00
Bertie690
6aa5c03b75
[Test] Removed unnecessary calls to PhaseInterceptor.to("CommandPhase") (#6108)
* [Test] Removed unnecessary calls to `PhaseInterceptor.to("CommandPhase")`

* minor cleanup to final_boss.test.ts

* Made run to final boss encounter actually go to command phase

* fix final_boss.test.ts select bug

* actually fixed test fr this time

* Fix magnet_rise.test.ts

* Fixed test

* Update test/moves/stockpile.test.ts

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

* Update stockpile.test.ts

---------

Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
2025-07-21 17:44:39 +00:00
Bertie690
a382554256
[Test/Ability] Cleaned up Magic Guard/battle tests; fixed innards out interaction (#5911)
* Fixed tests for Magic Guard, Battle phase; fixed innards out stuff

* Fixde magic guard aftermath

* fixed tests

* Fixed innards out

* fixed using sizzly slide instead of will o wisp to inflict burn

* ran boime

* Readd simulated oopsie

* Fix HJK test to use protect + docs and such

* Apply Biome

---------

Co-authored-by: Sirz Benjie <142067137+SirzBenjie@users.noreply.github.com>
Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
2025-07-21 17:42:27 +00:00
Madmadness65
1428d8b870
[Balance] Add faint trigger to various form changes (#6122)
* [Balance] Add faint trigger to Battle Bond Greninja's form change

The form change functionality will now be slightly closer to Generation 7/8, as the Greninja will now revert from Ash form to Battle Bond form upon fainting.

* Change how the form change on faint is triggered

It is no longer directly handled by the faint phase, and is instead part of the abilities now, as more than Battle Bond Greninja revert via this method (Disguise Mimikyu, Power Construct Zygarde).

* Adjust Disguise test
2025-07-20 18:59:01 +00:00
NightKev
4dca988823
[Dev] Update packages (#6088)
* Update packages

* Add default values for tweens

* Add mocks for `InputText` and `BBCodeText`

* Delete deprecated `vitest.workspace.ts`

* Replace `new InputText` with `globalScene.add.rexInputText`

* Disable broken Magic Bounce test

* Disable broken test in `stockpiling.test.ts`
2025-07-16 22:28:17 -07:00
NightKev
fcdbf16bc3 [Test] Fix first-attack-double-power.test.ts tests
The trainer type overrides appear to be bugged currently
2025-07-15 23:40:27 -07:00
AJ Fontaine
583b3758c0
[Dev] Move Fixed Battle Configs to own file (#6054) 2025-07-15 21:54:15 -07:00
Bertie690
e05d85977e
[Dev] Updated enum utils to have strong typing (#6024)
* Updated enum utils to refuse non-enum values;
added strong typing on return values

* Moved Enum functions to own file; added type helpers for enums

* Cleaned up some code

* Fixed up tests

* Fix training-session-encounter.ts
2025-07-15 01:14:02 -07:00
NightKev
2e06b10f40 [Test] Fix Bolt Beak/etc test 2025-07-15 00:34:03 -07:00
Sirz Benjie
de8491505b
[Test] Address flaky tests and add Metronome mock helper (#6093)
- Fix `copycat`, `first-attack-double-power` and `ability-ignore-moves`

* Add utility method for forcing metronome move

* Stop bolt beak / fiscious rend flakiness
2025-07-13 22:20:09 -07:00
NightKev
22e399be8b [Test] Disable flaky test 2025-07-13 21:23:34 -07:00
NightKev
6863044698 [Test] Fix Intimidate test 2025-07-13 20:14:59 -07:00
NightKev
8cf1b9f766
[Dev] Enable Biome import sorting (#6052)
* [Dev] Enable Biome import sorting

Additional changes:

- Implement import aliases

- Convert default exports to named exports

- Remove relative imports

* Apply changes

* Misc fixes

* Merge cleanup
2025-07-13 00:21:25 -07:00
Jonathan Bankston
22c386ea9e
[BUG] Fix Transform and Imposter issues (#6008)
* Fixed Transform and Imposter Bug

* Updated Comments

* Revised Comments

* Revised Changes on how tranformed pokemon are referenced to align with reviewer's suggestions

* Removed unused BattlerTag type for transform

* Removed addition of the transform tag to a pokemon in the PokemonTransformPhase

* Moved the check for whether Transform can be used within the TransformAttr class as suggested and removed uneccesary moveId check

* Consolidated if statement regarding isTransformed

* Removed overrides

* Added move condition to Transform + fixed up imposter target selection

* Condensed tests into 1 file + added more automated tests

This includes a couple regression tests for the fusion shenanigans

* Fixed comment

* Updated override typo for unimplemented methods

* Remove redundant parentheses

* Apply suggestions from code review

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

---------

Co-authored-by: Bertie690 <taylormw163@gmail.com>
Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
Co-authored-by: Sirz Benjie <142067137+SirzBenjie@users.noreply.github.com>
Co-authored-by: Bertie690 <136088738+Bertie690@users.noreply.github.com>
2025-07-12 23:39:48 -07:00
Bertie690
664f2fab0d
[Refactor/Bug] Fix Protean not applying due to terrain + minor cleanup of move phase (#5855)
* Squashed protean/libero changes

* Update protean-libero.test.ts

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

* Update protean-libero.test.ts

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

* Update ability.ts

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

* Update move-phase.ts

* Fixed counter move logic using inverted conditional

* Update move-phase.ts

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

* Update move-phase.ts

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

* Update ability.ts commentfix

* Update src/data/abilities/ability.ts

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

---------

Co-authored-by: Sirz Benjie <142067137+SirzBenjie@users.noreply.github.com>
Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
2025-07-13 05:59:38 +00:00
Bertie690
12fbff71d2
[Test] Added tests for Intimidate, Fishious Rend/Bolt Beak, Payback and Moongeist Beam & co. (#5858)
* Added additional tests for intimidate & ability-ignoring moves

* Added a few basic tests for Fishious Rend and Bolt Beak

* Fixed comment

* Fixe test and added commetn

* Update first-attack-double-power.test.ts

* Fixed incorrect ignore-abilities.test.ts test suite description

* Update ignore-abilities.test.ts suite name

* Fix first-attack-double-power.test.ts

* Actually fixed import

* Update intimidate.test.ts

* Fix test imprts

* Added guard dog tests

* Fixed tests

* Renamed test file

* Added Payback tests

* Fixed accidental unusde class

* Fixed tests

* Fixed flaky test due to 1 length trainer thing

* dd

---------

Co-authored-by: Wlowscha <54003515+Wlowscha@users.noreply.github.com>
2025-07-13 05:55:05 +00:00
Bertie690
9958e4fe13
[Test] Remove duplicate tests (#6082)
* Remove duplicate tests from parental bond test file

* Remove duplicate multi lens + pollen puff test
2025-07-11 19:33:15 +02:00
Sirz Benjie
115d63d0c5
[Bug] Fix anger point procing on every hit if first hit in multi hit was a crit
https://github.com/pagefaultgames/pokerogue/pull/6067

* Fix anger point always procing on multi-hit

when first strike was a crit

* Fix comment spacing

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

* Rename PostDefendCritStatStageChangeAbAttr

---------

Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
2025-07-07 18:38:18 -07:00
Bertie690
5f8e665a1e
[Test] Fix incorrect reverse mapping in overridesHelper.ts log message
https://github.com/pagefaultgames/pokerogue/pull/6068
2025-07-06 12:00:33 -07:00
Bertie690
2fe50cb761
[Test] Made game.move.select fail if move not in moveset (#5998)
* Made `game.phaseInterceptor` fail if move not in moveset

also added a few assorted doc fixes

* Fixed fail comment

* added `map` statement

* Fixed tests

* Fixed test

* Fixed test and comment

* Fixed tests

* Fixed test v2

* Fixed various tests

* Update error msg to not use fullcaps

* Fixed remaining tests

* Fixed test 0.5

* Fixed up tetss

* Fixed test

* Fixed imposter tests

* Fixed imposter tests

* Fiexd remainig tests

* Marked test as TODO

wasn't as if it was doing anything beforehand but w/e

* Update moveHelper.ts

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

* Update moveHelper.ts

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

* Apply Biome

* Update comment in `spikes.test.ts`

* Add faint checks to Spikes test

---------

Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
2025-07-02 12:46:26 -07:00
Jonathan Bankston
12aaa31454
[Refactor] Minor run phase rework (#6017)
* Minor Attempt run phase rework to abstract logic to whole team

* Decoupled individual pokemon from run phase logic

* Formatting

* Completed run phase refactor implementation and updated tests

* Updated run phase to extend field phase instead of pokemon phase

* Removed unused phase decleration in tests

* Removed unecessary arg in turn start phase as refactor no longer needs it

* Cleaned up getPlayerField

* Made adjustments based on reviewer suggestions

* Reintrocuded calculateEscapeChance into AttemptRunPhase and removed run utils

* Resolve merge issues

* Minor TSDoc improvement to `BattleScene#getPlayerField`

* Moved early override check to top of calculateEscapeChance

---------

Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
2025-07-02 02:57:08 -07:00
Bertie690
1bd152a738
[Refactor] Moved various classes/interfaces to own files (#5870)
* Split up Pokemon data types to own files

* Moved `AttackMoveResult` and `TurnMove` to own files

* Moved `customPokemonData` into types folder + fixed comments

* Moved files around + fixed stuff

* Moved `DamageResult` into new file

* Fixed imports

* ran biome

* Fix merge issue
2025-06-28 01:55:47 -07:00
NightKev
07f5c3009c
[Dev] Add player and enemy Nature and IV overrides (#6032)
* [Dev] Add player and enemy Nature and IV overrides

* Fix broken tests
2025-06-26 12:01:54 -07:00
NightKev
ecdaac20fa [Test] Fix Gorilla Tactics tests 2025-06-24 18:40:15 -07:00
Sirz Benjie
8afedc33d7
[Refactor] [Ability] Ab attr apply type safety (#6002)
* [WIP] Refactor ability attribute apply args

* [WIP] update ability signatures

* Update callsites in pokemon.ts

* Update callsites in moves.ts

* Update abattr callsites in move-phase

* Update abattr callsites in battler-tags

Also removed stat drop ability application from cancelling ME stat boost effects

* format with biome and remove cancelled from weather lapse

* Update abattr callsites in MEP

* Update callsites in turn-start-phase

* Update abAttr callsites in misc phases

* Remove latent test functionality

* update ability attribute callsite in shield dust test

* update abattr callsite in winstrate challenge encounter

* Fix some tests to mock proper methods

* Remove improper condition in mimicry's ability application

* Fix improper simulated check in moody's apply method

* Pass source to postApplyDamage in pokemon.ts

* [wip] fix cud chew tests

* Make cud chew consumption not subclass postTurnAbAttr

* Fix regression in flower veil

* Update trySetStatus test in pokemon to respect new return value for undefined

* Remove empty, unused file

* Fix blockCrit method broken in merge

* Fix unnecessary attr type cast in move phase

* Address typing issue in safeguard test

* Improve documentation and get rid of ts-expect-error directive

* Minor comment/TSDoc updates and fixes

* Apply suggestions from code review

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

* Apply suggestions from code review

---------

Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
2025-06-22 18:23:08 -07:00
Sirz Benjie
9fd79edcb2
[Refactor] Refactor evo phase (#5735)
* Cleanup evolution phase

* Update evolution phase and types

* Refactor form change phase

* Simplify game-speed.ts and update evo phase

* Move delay in formChangePhase to first element

* Fix mock video object return methods

* Fix tween chain mock

* Add todo comment to mock phaser's tween manager

* Remove jarring flash when evolution begins

* Fix missing method chaining in evo phase

* Apply biome formatting
2025-06-22 18:11:38 -07:00
Bertie690
36c79a9a69
[Bug] Reworked BattlerTag/ArenaTag code to prevent breakage on 0 PIDs
https://github.com/pagefaultgames/pokerogue/pull/5932

* Fixed modifier code, removed instances of "0 ID = no mon"

* corrected casing + dejanked seed tag

* Added test file, added overload to `findModifier` if given type predicate

* fixed test

* Revert predicate stuff for now

going in separate PR

* Fix id check syrup bomb test

Wasn't running phase due to being a turn end effect

* [WIP] Changed test to use destiny bond as proper regression

* Removed `instant` and `ignoreUpdate` parameters from `tryTransferHeldItemModifier`; fixed post-battle loot code to _not_ break type safety

* Fixed up tests

* Reverted unneeded changes

* Removed outdated modifier test

* Fix import

* Apply Biome

* Update battler-tags.ts

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

* Update battler-tags.ts

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

* Update arena-tag.ts

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

* Update arena-tag.ts

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

---------

Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
2025-06-22 17:29:37 -07:00
NightKev
4fc77e4de9
[Dev] Update Biome to 2.0.0 (#6004)
* Run `npm audit fix`

* Update Biome to 2.0.0

* Migrate `biome.jsonc` to 2.0

* Apply Biome and fix some suppression comments

* Fix some suppression comments and update config

* More config updates

Added at "error": `noUnusedLabels`, `noThisInStatic`

Changed `useDefaultParameterLast` from "off" to "warn"

Changed `noDocumentCookie` (from recommended) from "warn" to "off"

Changed `noExcessiveCognitiveComplexity` from "warn" to "info"

* Add a bunch of rules

* Apply Biome safe fixes

* Apply Biome unsafe fixes

* Remove irrelevant `useSelfClosingElements` rule

* Upgrade already followed rules to "error"

* Remove unnecessary type cast

* Disable fixer for `useDefaultParameterLast`

* Disable `useJsonImportAttribute` rule and revert changes

* Fix `mockImage.ts`

* ...there's a `@ts-nocheck` in this file

* Use whole-file lint suppression comment in `version_converter.ts`

* Add a couple comments to `biome.jsonc`

* Remove ESLint packages and GitHub workflow
2025-06-20 23:24:11 -07:00
Bertie690
1e306e25b5
[Move] Fixed Chilly Reception displaying message when used virtually
https://github.com/pagefaultgames/pokerogue/pull/5843

* Fixed Chilly Reception displaying message when used virtually

* Fixed lack of message causing Chilly Reception to fail

* Fixed tests

* Reverted bool change + fixed test

* Fixed test
2025-06-19 17:14:05 -07:00
Bertie690
4119dfbfec
[Test] Fix flaky gastro acid test (#5996) 2025-06-17 13:51:19 -07:00
Sirz Benjie
6ff258fb37
[Bug] Fix weather form changes not changing with weather abilities
https://github.com/pagefaultgames/pokerogue/pull/5857

* Add test for forecast

* Fix PostSummonFormChangeByWeatherAbAttr

* Fix overrides in forecast test

* Remove a test whose trigger conditions can no longer happen

* Update src/data/abilities/ability.ts

Co-authored-by: Dean <69436131+emdeann@users.noreply.github.com>

* Fix missing tsdoc param

* Apply kev's suggestions from code review

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

* Simplify PostSummonFormChangeByWeather's canApplyPostSummon

* Fix unused params that messed up after rebase

* Fix form change import

Messed up due to improper rebase

---------

Co-authored-by: Dean <69436131+emdeann@users.noreply.github.com>
Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
2025-06-16 06:02:09 -07:00
AJ Fontaine
e3108603e3
[Refactor] Rework evolution conditions and descriptions (#5679)
* Refactor evo conditions and descriptions

* Fix test

* Fix Shedinja

* Simplify Gimmighoul evolution

* Primeape and Stantler evolve by using their move 10 times

* Basculin white stripe evolves by taking 294 recoil damage

* Primeape and Stantler use modifiers for tracking

* Basculin uses modifier too

* Remove evo count from pokemon data

* No more evo counter data, Gallade/Froslass

* Fix allmoves import

* Clamperl

* Struggle shouldn't count for Basc recoil

* Change to nicer type

* Apply Benjie's suggestions

Co-authored-by: Sirz Benjie <142067137+SirzBenjie@users.noreply.github.com>

* Address formatting

* Undo new evolution changes

* Remove unused imports

* Fix speciesid

* Fixed up descriptions a little

* Change a key name

* Fix Gimmighoul

* Apply Biome

* Apply Biome unsafe fixes

* Review suggestions

- Convert `EvoCondKey` enum to `const` object

- Use early returns in `SpeciesEvolutionCondition#description`
and `SpeciesFormEvolution#description`

- Replace `!!x.find` with `x.some`
and `y.indexOf() > -1` with `y.includes()`

- Implement `coerceArray`

- Fix Shelmet evolution condition
checking for Shelmet and not Karrablast

- Remove unnecessary type casting in `battle-scene.ts`

* Remove leftover enforce func loop

* Fix circular imports issue

- `getPokemonSpecies` moved to `src/utils/pokemon-utils.ts`
- `allSpecies` moved to `src/data/data-lists.ts`

---------

Co-authored-by: Sirz Benjie <142067137+SirzBenjie@users.noreply.github.com>
Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
2025-06-16 05:57:51 -07:00
Bertie690
ccceaac877
[Test] Reworked crit override to allow for forced crits (#5738)
* Crit override stuff

* Update ability.ts

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

* Update pokemon.ts

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

* Update game-mode.ts

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

---------

Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
2025-06-16 05:36:09 -07:00
Bertie690
5efdb0dc0b
[Refactor] Fix issues with "last move selected" vs "used" (#5810)
* Added `MoveUseType` and refactored MEP

* Fixed Wimp out tests & ME code

finally i think all the booleans are gone
i hope

* Added version migration for last resort and co.

buh gumbug

* Fixed various bugs and added tests for previous bugfixes

* Reverted a couple doc changes

* WIP

* Update pokemon-species.ts

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

* Update pokemon-phase.ts

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

* Fixed remaining tests (I think)

* Reverted rollout test changes

* Fixed command phase bug causing metronome test timeout

* Revert early_bird.test.ts

* Fix biome.jsonc

* Made `MoveUseType` start at 1

As per @DayKev's request

* Fixed a thing

* Fixed bolt beak condition to be marginally less jank

* Applied some review suggestions

* Reverted move phase operations

* Added helper functions complete with markdown tables

* Fixed things

* Update battler-tags.ts

* Fixed random issues

* Fixed code

* Fixed comment

* Fixed import issues

* Fix disable.test.ts conflicts

* Update instruct.test.ts

* Update `biome.jsonc`

* Renamed `MoveUseType` to `MoveUseMode`; applied review comments

* Fixed space

* Fixed phasemanager bugs

* Fixed instruct test to not bork

* Fixed gorilla tactics bug

* Battler Tags doc fixes

* Fixed formatting and suttff

* Minor comment updates and remove unused imports in `move.ts`

* Re-add `public`, remove unnecessary default value in `battler-tags.ts`

* Restore `{}` in `turn-start-phase.ts`

Fixes `lint/correctness/noSwitchDeclarations`

* Remove extra space in TSDoc in `move-phase.ts`

* Use `game.field` instead of `game.scene` in `instruct.test.ts`

Also `game.toEndOfTurn()` instead of
`game.phaseInterceptor.to("BerryPhase")`

* Use `game.field` instead of `game.scene` in `metronome.test.ts`

* Use `toEndOfTurn()` instead of `to("BerryPhase")` in `powder.test.ts`

* Convert `MoveUseMode` enum to `const` object

* Update move-phase.ts

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

* Add `enumValueToKey` utility function

* Apply Biome

---------

Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
2025-06-15 10:52:44 -07:00
Bertie690
0918985a63
[Test] Remove unneeded mockRestore and testTimeout calls in tests
https://github.com/pagefaultgames/pokerogue/pull/5927/

* Removed unnecessary test timeout parameters from test files

We set it in vitest config anyways

* Removed unneeded `mockRestore` calls

We call `restoreAllMocks` after each test runs anyhow

* Removed accidentall forgotten-about timeout

* Revdrt magic bounce test file for now

* Fixed ting

* Fixed bug

* Fixed import

* Update test/data/status_effect.test.ts

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

* Update battle.test.ts

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

* Apply suggestions from code review

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

* Ran bim

---------

Co-authored-by: Sirz Benjie <142067137+SirzBenjie@users.noreply.github.com>
Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
2025-06-15 00:48:16 -07:00
Bertie690
061c987265
[Test] Convert game.override calls into chained line where possible
https://github.com/pagefaultgames/pokerogue/pull/5926

* Condensed all overrides into 1 line where possible

I hope I got them all...

* Fixed tests 0.5

* Cleaned up safeguard test to not use outdated code; fixed rest of errors

* Fixed illusion test

* Revert safeguart etst

* Fixed battle tets

* Fixed stuff

* Fixed things2.0

* Fixed import issues

* Revert changes outside of the tests directory

* Revert changes outside of the tests directory

---------

Co-authored-by: Sirz Benjie <142067137+SirzBenjie@users.noreply.github.com>
Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
2025-06-15 00:40:41 -07:00
damocleas
73e0a2905b
[Beta] Revert "[UI/UX] Default cursor to no when stop trying to teach move" (#5990)
Revert "[UI/UX] Default cursor to no when stop trying to teach move"

This reverts commit ba2158ec64.
2025-06-14 17:40:18 -04:00
NightKev
7cf51d48a7 [Test] Make sure items are removed from enemies in Last Respects test 2025-06-14 05:06:46 -07:00
NightKev
7c6189e812
[Refactor] Create utility function coerceArray (#5723)
* [Refactor] Create utility function `makeArray`

This replaces the `if(!Array.isArray(var)) { var = [var] }` pattern

* Replace `if` with ternary, rename to `coerceArray`

* Add TSDocs

* Improve type inferencing

* Replace missed `Array.isArray` checks

* Apply Biome

* Re-apply changes to phase manager

* Re-apply to `SpeciesFormChangeStatusEffectTrigger` constructor

Apply to new instances in test mocks
2025-06-12 21:30:01 -07:00
Dean
ff9aefb0e5
[Bug] Activate PostSummon Abilities in Speed and Priority Order
https://github.com/pagefaultgames/pokerogue/pull/5513

* Add prependToPhaseWithCondition and use it in SummonPhase to determine speed order

* Move logic to PostSummonPhase

* Add test base

* Pivot to using sort strategy instead

* Add and update tests

* Support priority ability activations

* Ensure priority abilities are still activated on switch in

* Add test for priority

* Update to use priority numbers instead of a boolean

* Add ability priorities to constructors

* Move sorting to BattleScene

* Rename phase file

* Update import

* Move application to applyPostSummonAbAttrs and stop assuming no other phases in queue

* Ensure all PostSummonPhases from encounters are added at the same time

* Switch to priority queue approach

* Ensure that zero/negative priority activations happen after postsummonphase

* Revert 07646fe (not needed due to stable sort)

* Always create separate ability phases for passive and use boolean instead of priority number when applying

* Add test for dynamic updates

* Add BattlerIndex import

* Clear queues for testing

* Benjie suggestion

* Split files

* Update import in battlescene

* Remove extra spaces added by VSCode

* Fix other conflicts

* Update PhaseManager

* Update to use PhaseManager

* Immediately start postsummons

* Fix test

* Fix BattlerIndex import

* Remove unused imports

* Fix postsummon application

* Make priority readonly
2025-06-11 22:28:27 -07:00
Sirz Benjie
1029afcdbf
[Refactor] Remove circular dependencies (part 4) (#5964)
* Add abilityAttr.is methods

* [WIP] move modifier stuff around

* Untangle circular deps from modifiers

* Move unlockables to own file

* Untangle all circular deps outside of MEs

* Move constants in MEs to their own files

* Re-add missing import to battle.ts

* Add necessary overload for getTag

* Add missing type import in weather.ts

* Init modifier types and pools in loading-scene

* Remove stray commented code

* Apply kev's suggestions from code review

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

---------

Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
2025-06-11 19:42:04 -07:00
Dobin Shin
ba2158ec64
[UI/UX] Default cursor to no when stop trying to teach move
https://github.com/pagefaultgames/pokerogue/pull/5924

* [UI/UX] "Stop trying to teach move" Defaulting to "No"

* [Test] setCursor to 0, 'Yes' to end learning move

* Move confirmUIMode to its own file in enums, add docs

---------

Co-authored-by: Sirz Benjie <142067137+SirzBenjie@users.noreply.github.com>
2025-06-11 16:24:27 -07:00
Sirz Benjie
48e911e03c
[Refactor] Remove circular deps 3 (#5959)
* Move game-mode to its own file

Reduces circular imports to 325

* Move battler-index to own file

Reduces circular deps to 314

* Move trainer-variant to own file

Reduces circ deps to 313

* Move enums in pokemon to their own file

* Move arena-tag-type to its own file

* Move pokemon-moves to its own file

* Move command to own file

* Move learnMoveType to own file

* Move form change item to own file

* Move battlerTagLapseType to own file

* Move anim enums to own shared file

* Move enums out of challenges

* Move species form change triggers to own file

Reduces circ imports to 291

* Update test importing pokemon move

* Replace move attribute imports with string names

* Untangle circular deps from game data

* Fix missing string call in switch summon phase

* Apply kev's suggestions from code review

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

* Ensure ChargeMove's is method calls super

* Use InstanceType for proper narrowing

* Apply kev's suggestions from code review

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

---------

Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
2025-06-09 16:24:13 -07:00
NightKev
d2ace47e1e [Test] Add missing ability override to Dancer tests 2025-06-08 15:36:01 -07:00