Commit Graph

243 Commits

Author SHA1 Message Date
Wlowscha
3a5c932a31
Merge branch 'beta' of https://github.com/pagefaultgames/pokerogue into ssui-refactor 2025-09-22 20:11:44 +02:00
Wlowscha
2fe99cc3bf
[Refactor] Refactor Starter and its handling (#6477)
* Reworked `Starter` interface with more explicit information

* Use Starter in ssui

* Fixed some bugs

* Passing starter.ivs to playerPokemon

* Using speciesIds

* Fixed getTestRunStarters

* Reverted some parameter changes

* Initialize starters in ssui

* Don't clear starters before starting run

* Fix to game manager

* Apply suggestions from code review

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

* Set ivs to 0 in part timer test

* Setting the right ivs

* Moved ssui to handlers folder

* Ran biome all

* Fixed broken imports

---------

Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
2025-09-21 11:07:08 -07:00
Dean
87e6095a00
[Misc/Feature] Add dynamic turn order (#6036)
* Add new priority queues

* Add dynamic queue manager

* Add timing modifier and fix post speed ordering

* Make `phaseQueue` private

* Fix `gameManager.setTurnOrder`

* Update `findPhase` to also check dynamic queues

* Modify existing phase manager methods to check dynamic queues

* Fix move order persisting through tests

* Fix magic coat/bounce

* Use append for magic coat/bounce

* Remove `getSpeedOrder` from `TurnStartPhase`, fix references to `getCommandOrder` in tests

* Fix round queuing last instead of next

* Add quick draw application

* Add quick claw activation

* Fix turn order tracking

* Add move header queue to fix ordering

* Fix abilities activating immediately on summon

* Fix `postsummonphases` being shuffled (need to handle speed ties differently here)

* Update speed order function

* Add `StaticSwitchSummonPhase`

* Fix magic coat/bounce error from conflict resolution

* Remove conditional queue

* Fix dancer and baton pass tests

* Automatically queue consecutive Pokémon phases as dynamic

* Move turn end phases queuing back to `TurnStartPhase`

* Fix `LearnMovePhase`

* Remove `PrependSplice`

* Move DQM to phase manager

* Fix various phases being pushed instead of unshifted

* Remove `StaticSwitchSummonPhase`

* Ensure the top queue is always at length - 1

* Fix encounter `PostSummonPhase`s and Revival Blessing

* Fix move headers

* Remove implicit ordering from DQM

* Fix `PostSummonPhase`s in encounters running too early

* Fix `tryRemovePhase` usages

* Add `MovePhase` after `MoveEndPhase` automatically

* Implement an `inSpeedOrder` function

* Merge fixes

* Fix encounter rewards

* Defer `FaintPhase`s where splice was used previously

* Separate speed order utils to avoid circular imports

* Temporarily disable lunar dance test

* Simplify deferral

* Remove move priority modifier

* Fix TS errors in code files

* Fix ts errors in tests

* Fix more test files

* Fix postsummon + checkswitch ability activations

* Fix `removeAll`

* Reposition `positionalTagPhase`

* Re-add `startCurrentPhase`

* Avoid overwriting `currentPhase` after `turnStart`

* Delete `switchSummonPhasePriorityQueue`

* Update `phase-manager.ts`

* Remove uses of `isNullOrUndefined`

* Rename deferral methods

* Update docs and use `getPlayerField(true)` in turn start phase

* Use `.getEnemyField(true)`

* Update docs for post summon phase priority queue (psppq)

* Update speed order utils

* Remove null from `nextPhase`

* Update move phase timing modifier docs

* Remove mention of phases from base priority queue class

* Remove and replace `applyInSpeedOrder`

* Don't sort weather effect phases

* Order priority queues before removing

- Add some `readonly` and `public` modifiers

- Remove unused `queuedPhases` field from `MoveEffectPhase`

* Fix linting in `phase-manager.ts`

* Remove unnecessary turn order modification in Rage Fist test

---------

Co-authored-by: Bertie690 <136088738+Bertie690@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-09-20 17:49:40 -05:00
Dean
d02980dd4e
[Move] Fully implement Healing wish (/Lunar Dance) and remove nextCommandPhaseQueue (#6027)
* Remove NCPQ

* Implement PendingHealTag

* Fix test

* Code review

* Use message directly instead of as key in tag

* Update tag for serialization

* Update test import

* Update src/data/arena-tag.ts

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

* Remove isNullOrUndefined uses

* Fix arena tag type(o)

* Fix pendinghealtag

* Fix hwish tests

* Arena tag denesting

---------

Co-authored-by: Bertie690 <136088738+Bertie690@users.noreply.github.com>
Co-authored-by: Sirz Benjie <142067137+SirzBenjie@users.noreply.github.com>
2025-09-20 17:32:31 -05:00
Bertie690
1691951c87
[Test] Added Map key matcher; enforced strong typing on matchers (#6561)
* Added `toHaveKey` matcher + fixed imports

* Broke up the test matchers into multiple smaller interfaces

* Added restricted typing on matchers

Now we can't call `expect(game).toHaveFullHp()`!!!!!

* Updated comment

* Renamed `toEqualArrayUnsorted` into `toEqualUnsorted`

* Moved comment at top of file

* Fix `@module` doc comment

* Remove extra space

* Fix typo

* Fixed key ssue in matchers

* Update to-have-key.ts

* Update test/@types/vitest.d.ts

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

* Fixed missing braces inside comment

---------

Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
2025-09-20 17:24:27 -05:00
Dean
405b1d389d
[Bug] Apply Supreme Overlord only once on summon (#6575)
* Implement supreme overlord as a battler tag

* Make ability a conditionalattr

* Add tag to map

* Update test

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

* Add edgeCase marker

* Extend from AbilityBattlerTag

* Run biome

---------

Co-authored-by: Bertie690 <136088738+Bertie690@users.noreply.github.com>
2025-09-19 23:08:02 -05:00
Bertie690
3d9e493e5f
[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
Sirz Benjie
da766f364c
[Tests] Cleanup getCookie and add many unit tests (#6562)
Cleanup `getCookie` and add many unit tests
2025-09-18 12:52:15 +00:00
Fabi
37e6371eef
[Dev] Allow forcing all trainer variants in trainer override (#6391) 2025-09-16 10:48:19 -05:00
Sirz Benjie
0c921cdb4a
[Tests][Bug][Beta] Fix ditto bug and add unit tests (#6559)
* Fix ditto bug and add unit tests

Co-authored-by: Bertie690 <136088738+Bertie690@users.noreply.github.com>
2025-09-15 23:26:57 -05:00
NightKev
de94e738fb [Docs] Add blank space to prevent incorrect comment attachment
Biome will "attach" comments to imports if there is no space between
them when it sorts imports (this allows suppression comments to work)
2025-09-14 20:45:01 -07:00
Sirz Benjie
793dea0024
[Bug] [Docs] Fix @module tags (#6557)
Fix `@module` tags
2025-09-14 22:35:12 -05:00
Bertie690
465f0c2ced
[Refactor] getPokemonById returns undefined instead of null
https://github.com/pagefaultgames/pokerogue/pull/6544

* [Refactor] Make `BattleScene.getPokemonById` return `undefined` instead of `null`

* fixed substitute unit test :(

* Update src/phases/obtain-status-effect-phase.ts

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

* Update src/phases/pokemon-phase.ts

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

* Update battle-scene.ts comment for dean

* Add todo comment

---------

Co-authored-by: Sirz Benjie <142067137+SirzBenjie@users.noreply.github.com>
Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
2025-09-12 22:19:48 -07:00
Sirz Benjie
c7a2c666af
[Refactor] Remove isNullOrUndefined in favor of loose check against null (#6549)
* Remove `isNullOrUndefined` in favor of loose check against null

* Fix missing method call

* Remove isNullOrUndefined import
2025-09-12 14:53:27 -05:00
Wlowscha
1d4ee7d7c8
Fixed bugs, ran biome 2025-09-11 19:02:02 +02:00
Wlowscha
531eb887d8
Merge branch 'beta' of https://github.com/pagefaultgames/pokerogue into ssui-refactor 2025-09-11 18:58:44 +02:00
Sirz Benjie
90d58c4457
[Docs] [Bug] Fix types for PhaseInterceptor 2025-09-11 08:33:45 -05:00
NightKev
a5f80ab490 [Misc] Delete useless test file 2025-09-11 00:32:11 -07:00
Wlowscha
559ca8610a
[Misc] Simplifying imports of UI files (#6542) 2025-09-11 00:30:17 -07:00
Bertie690
76d163e666
[Test] Moved test setup code to its own folder (#6297)
* Made default boilerplate show off some test utils

* Moved all the setup files into their own folder

* fixed relative path bug

* Update i18n.ts

Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
2025-09-10 14:13:48 -05:00
Wlowscha
9a92f98f63
[Refactor] Move type definitions away from game-data.ts (#6487)
* Move type definitions away from game-data.ts

* Update src/@types/data-types.ts

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

* Renamed file to save-data.ts

* Fixed broken import

* Moved some ui files

* Run biome, fix broken import

* Fixed one more broken input
2025-09-10 14:09:33 -05:00
Bertie690
496d9a10d7
[Test] Added matcher to check message contents; added tests for Splash, Celebrate, Laser Focus (#6299)
* Fixed laser focus test to not whiff instruct

* fix test checking last hit twice in row lul
2025-09-10 13:40:21 -05:00
Sirz Benjie
c0b3b0c55e
[Docs] Fixup typedoc warnings (#6540)
* Replace `@return` with `@returns`

* Remove extends tags

* Remove `@overrides` tag

* Remove `@abstract` tags

* Remove `@overload` tags

* Remove `@description` tags

* Remove `@static` tags

* Remove `@private` tags

* Remove `@warning`

* Remove `@PokemonSpecies`

* Remove {} appearing after `@returns`

* Remove {} appearing after `@param`

* Bump typedoc version

* Remove ...args in `@param` and replace with args

* Cleanup docs in challenge.ts

* Adjust hyphens

* Remove parenthesis in `@see` tags

* Remove old `@see` references
2025-09-10 13:35:55 -05:00
Wlowscha
6f3f6026a8
[UI/UX][Refactor] Moved and renamed some ui files (#6538)
* Moved and renamed some ui files

* Renamed two handlers to helpers
2025-09-10 10:42:38 -05:00
Wlowscha
c2d68d48e2
Merge branch 'beta' of https://github.com/pagefaultgames/pokerogue into ssui-refactor 2025-09-08 18:20:14 +02:00
Bertie690
e202cb63ac
[Dev] Remove useless noDoneCallback linting rule (#6520)
* [Dev] Remove useless `noDoneCallback` linting rule

* Removed disable comments
2025-09-08 10:53:59 -05:00
Bertie690
c0da686ba0
[Dev] Migrated to Biome 2.2.3, added more rules (#6259)
* Added more biome rules

* Fixes

* Added a few more rules

* Added global phaser to biome

* Fix tpyo

* Updated biome to 2.1.4; improved docs on linting/localization; added vcs support

Also added `.build` to gitignore cuz reasons

* Fixed tpyo

* dd

* Applied linter fixes

* Partially fixed some private property issues

* Upgraded to Biome 2.2.0; added `operatorLinebreak` and a few new rules

* Moved operator linebreaks before lines

* Applied kev's suggestions

* Update biome.jsonc

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

* added like all the rules and then some

* modify biome.jsonc

* apply biome formatting

* Reverted changes to balance folder

* fixed stuff

* Fixed biome stripping trailing globstars from everything

* made `noInvertedElse` an error rule

* Add & apply fixes for `useExplicitLengthCheck`, `useAtIndex` and `noNonNullAssertedOptionalChain`

* Bumped biome to 2.2.3

* Fixed a few syntax errors

* Removed trailing globstars since biome actually fixed their shit

* Final clean up

* foobarbaz

* Fixed remaining issues

* Fixed a few errors in SSUI

* fixed rounding issue

* Fixed test to not round funky

* Fixed biome false positive for vitest hooks

* Apply biome:all

---------

Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
Co-authored-by: Sirz Benjie <142067137+SirzBenjie@users.noreply.github.com>
2025-09-08 10:35:18 -05:00
Wlowscha
1a4de942f7
Renamed fields in StarterPreferences 2025-09-08 16:09:20 +02:00
Wlowscha
5a803f80eb
[UI/UX][Refactor] Starter select UI refactor (#6390)
* Moved some functions to utility file

* Moved some process input code to its own functions

* Moving processinput for cycle buttons to its own function

* Moved pokemon menu to its own function

* Replaced setSpecies(null) with setNoSpecies (still some code duplication)

* Hide sprite when moving to random starter button

* Renamed `StarterAttributes` to `StarterPreferences` and related changes

* Cleaned up redundancy; no need to set ivs to `null` since the container is hidden anyway

* Refactoring caughtAttr / seenAttr / no switch in `setSpecies`

* Reducing complexity

* Setting sprite correctly for seen mons

* Extracting logic for seen species from setSpeciesDetails

* Separate setup function for filter bar and instruction buttons

* Moved preferences and other info to their own containers

* Setup function for starter column

* Reduced number of containers; cursor is broken

* Fixed cursor movement

* ??= {}

* Split up statistics from permanent info

* Removed "forSeen" variable

* Function which updates displayed moves

* updateCanCycle function

* set passive details to its own function

* Removed pointless conditionals from setSpeciesDetails

* Added some comments

* Small adjustments

* Splitting up starter summary

* Finished splitting off starter summary (minor bugs)

* Added some comments

* Introduced `getSpeciesPropsFromPreferences` utility function

* Moved some constants and functions around

* Moved ssui to handlers folder

* Also moved some other files

* Formatting

* Fixed wrong input

* Fixed another broken import
2025-09-08 13:36:22 +02:00
NightKev
d8fa0ff083 Merge branch 'beta' into hotfix-1.10.7 2025-09-07 18:21:37 -07:00
Wlowscha
e175bbfb28
[UI/UX] Use pointer events instead of touch events in TouchControl (#6506)
* Use pointer events instead of touch events in `TouchControl`

* Marked some touch-related tests as todo

* Changing test mocker to send pointer events

* Also updated the ui to change the position of touch controls

Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
2025-09-07 17:35:49 -05:00
Wlowscha
d0f5b3f613
[Refactor][UI/UX] Reorganize UI files (#6503) 2025-09-07 13:05:40 -07:00
Bertie690
8b95361d61
[Dev] Added egg move parse script & script type checking (#6116)
* Added egg move parse utility script

* Update interactive.js

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

* Update interactive.js

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

* Update interactive.js

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

* Applied kev's reviews

* Removed `basePath` from tsconfig

the docs literally recommend against using it so yeah

* Fixed up configs so that script folder has its own file

* Reverted changes to egg move contents

* renamed boilerplate so biome doesn't lint it

* Fix `jsconfig.json` so that it doesn't typecheck all of `node_modules`

See https://github.com/microsoft/TypeScript/issues/50862#issuecomment-1565175938 for more info

* Update tsconfig.json

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

* Updated workflows and fixed issues

* Removed eslint from linting workflow

* Fixed type error in d.ts file to shut up linters

* Reverted test-filters.yml

* Update biome.jsonc

* Update decrypt-save.js comment

* Update interactive.js

* Apply Biome

* Fixed type errors for scripts

* Fixed biome from removing tsdoc linkcodes

* Update test/@types/vitest.d.ts

---------

Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
2025-09-07 11:35:52 -07:00
Bertie690
9815c5eebf
[Test] Revamped MockConsoleLog with color support (#6218)
* Added mock console and fixed up many many things

* Cleaned up handling of colors and such

* Added minor comment

* Fix Focus Punch test

* Fix typo

* Remove redundant comment

* Update vitest.setup.ts

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

* Added color map inside new folder

* Made constants not object bc i was told to

* Update src/constants/colors.ts

* Removed all moves init check

* Removed import

* Fixed up some stuff + added aquamarine color to settings helper

* Added logging for test end

* Removed intentionally failing test

* Fixed console log to use inheritance to not override vitest's wrapping

* Added a custom Vitest reporter to not log the test name every 2 lines

* Moved coloration to a hook to prevent misplacing things

* Fixed import issue by copypasting vitest soure

* Removed intentionally failing test

look i need to check that `test:silent` works on github ok

* Added REUSE annotations to copied parts of source

* Fixed import issue

---------

Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
2025-09-07 09:18:47 -05:00
Anthony
ad61a28e88
[Bug] Moody Can't Lower Stats at +6 (#6481) 2025-09-06 06:46:13 +00:00
Bertie690
d630c106e0
[Test] Improved typing on BattlerTagData and ArenaTagData; improved test matchers (#6338)
* Improved typing on `BattlerTagData` and `ArenaTagData`
* Added dragon cheer/focus energy tests
* Cleaned up descs
2025-09-05 21:50:37 -05:00
Bertie690
02bfaf9ad3
[Test] Added/cleaned up tests for Pastel/Sweet Veil (#6374)
* [Test] Added/cleaned up tests for Pastel/Sweet Veil

* Fixed extra import + tests

* Fixed type import

* Update move.ts

* reverted abstract constructor stuff
2025-09-05 21:42:44 -05:00
Bertie690
309e31e196
[Bug] Future Sight no longer crashes after catching the user (#6479) 2025-09-05 14:38:01 -04:00
Bertie690
d5e6670456
[Refactor] Remove null from PhaseManager.currentPhase signature
https://github.com/pagefaultgames/pokerogue/pull/6243

* Added `toBeAtPhase` + removed `null` from phase manager current phase signature

* Removed bangs from various calls to phase manager

* Update phase-manager.ts

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

* ran biome

* Fix missing bang

* Simplify TSDoc

---------

Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
2025-09-05 09:28:35 -07:00
Sirz Benjie
4a28773929
[Bug] [Move] Fix poltergeist crash when no remaining enemies (#6473)
* fix: poltergeist crash with no target

* fix: adjust move phase history
2025-09-03 02:44:43 +00:00
Fabi
4dc067daa2
[Bug] [UI/UX] Fix options during item transfer (#6425) 2025-08-29 23:52:39 +00:00
Sirz Benjie
6745ce7839
Fix starterpref reset (#6430)
* Prevent an empty starterpreferences object from being saved

* Fix ssui nullish coalescing

* Update src/utils/data.ts

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

* Fix starter preferences clearing, add tests

---------

Co-authored-by: Wlowscha <54003515+Wlowscha@users.noreply.github.com>
Co-authored-by: Dean <69436131+emdeann@users.noreply.github.com>
2025-08-26 12:11:16 -05:00
Wlowscha
63c1c34746
[Hotfix] Fix tyrogue evo (#6414)
* Fixed tyrogue evo condition

* Added test for tyrogue evolution

* Update src/data/balance/pokemon-evolutions.ts

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

* Update src/data/balance/pokemon-evolutions.ts

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

* Update src/data/balance/pokemon-evolutions.ts

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

* Added missing typeof in suggestion

---------

Co-authored-by: Bertie690 <136088738+Bertie690@users.noreply.github.com>
2025-08-26 06:57:11 +00:00
Bertie690
0f8b1f63b5
[Bug/Ability] Fixed bugs with Intimidate triggers after reload/initial switch (#6212)
* Added TODO test case + documentation for failing intim test

* Fixed comment

* Fixed intimidate bugs fr fr

* Update src/data/phase-priority-queue.ts

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

* Update src/data/phase-priority-queue.ts

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

* Cleanup remove phase logic

* Do not add unnecessary activateAbilityPhases for pokemon that do not have their passive enabled

* Remove leftover log messages

* Add TODO comment

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

---------

Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
Co-authored-by: Sirz Benjie <142067137+SirzBenjie@users.noreply.github.com>
2025-08-24 14:09:16 -05:00
Sirz Benjie
049932c001
[Bug] Fix status effects overwriting each other (#6392)
* Ensure status effects from same source interaction cannot override each other

* Update test/status-effects/general-status-effect.test.ts

Co-authored-by: Bertie690 <136088738+Bertie690@users.noreply.github.com>
2025-08-24 12:51:16 -05:00
Fabi
1b2c694084
[bug/i18n] Fix stealth rock message (#6377)
replace pokemonName with pokemonNameWithAffix
2025-08-23 17:26:12 -05:00
Sirz Benjie
a8b54eba6d
[Test] Mark failing test/ui/manage-item-button.test.ts as TODO (#6375)
* Ensure hotfix runs tests

* Unnest promise

* ensure workflows run when pushed to hotfix

* Mark test todo
2025-08-23 16:56:58 -05:00
Dean
d2eb3dba53
[Test] Fix leftovers test not running heal phase (#6370)
Fix leftovers test
2025-08-23 16:02:36 -05:00
Sirz Benjie
99bf639ea7
[Bug] [Move] Fix pollen puff (#6363)
* Ensure pollen puff does not heal enemy after damage

* Add test to ensure pollen puff does not heal enemy
2025-08-23 11:42:10 -05:00
Fabi
3b290ee9a2
[UI/UX][Bug] Prevent switch to discard mode while transferring item (#6358) 2025-08-23 10:05:48 -05:00