* [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
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
* 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>
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>
* 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>
* Updated doc comments for test-related functions
* Marked `classicMode.runToSummon` and `classicMode.startBattle` without species as deprecated
Having the species being used depend on daily run RNG is both unintuitive, janky and prone to flaking out (as happened with the Gastro Acid tests)
* Fixed the bug
* Update field-helper.ts
Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
---------
Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
* Move phase types out of phase interceptor
* Create isXPhase method and add properties to each phase
* Replace instanceof phase with isXPhase
* Fix missing union types for phaseName
* Update doc comment in phase.ts
* Fix incomplete comment in encounter-phase
* Make phaseName as public and fix more uses
* Move phaseName property declaration before constructor in move anim phase
Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
* Rename isXPhase to is
---------
Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
* Rename `Abilities` to `AbilityId`
* Rename `abilities.ts` to `ability-id.ts`
* Rename `Moves` to `MoveId`
* Rename `moves.ts` to `move-id.ts`
* Rename `Species` to `SpeciesId`
* Rename `species.ts` to `species-id.ts`
* Rename `Biome` to `BiomeId`
* Rename `biome.ts` to `biome-id.ts`
* Replace `Abilities` with `AbilityId` in comments
* Replace `Biome` with `BiomeId` in comments
* Replace `Moves` with `MoveId` in comments
* Replace `Species` with `SpeciesId` in comments
* [Test] Add/update test utils
- Add `FieldHelper` which has methods to mock a pokemon's ability
or force a pokemon to be Terastallized
- Add `MoveHelper#use` which can be used to remove the need
for setting pokemon move overrides by modifying the
moveset of the pokemon
- Add `MoveHelper#selectEnemyMove` to make an enemy pokemon
select a specific move
- Add `MoveHelper#forceEnemyMove` which modifies
the pokemon's moveset and then uses `selectEnemyMove`
- Fix `GameManager#toNextTurn` to work correctly in double battles
- Add `GameManager#toEndOfTurn` which advances to the end of the turn
* Update some tests
- Disable broken Good As Gold test
and add `.edgeCase` to Good As Gold
- Fix Powder test
- Update some tests to demonstrate new methods
* Create battle-info directory and move battle-info.ts to it
* Move player and enemy battle info to their own files
* Move subclass specific parts of constructor to subclass constructor
* Fixup mock gameobject methods to match phaser gameobject returns
* Make statOrder specific to subclass
* Create getShinyDescriptor function in utils
* Move icon construction to its own function
* Cleanup enemybattleinfo constructor to use chaining
* Make flyout exclusive to EnemyBattleInfo
* Move EnemyPokemon specific init Logic to its class
* Break up initInfo into different methods
* Remove hp bar segment dividers from base battle info
* Move setMini to pokemoninfo
* Breakup updateInfo into smaller parts
* Remove hp info handling from base updateInfo
* Use phaser object chaining methods
* Add some docs
* Add missing chain usage
* Use getShinyDescriptor in pokemon-info-container
* Minor cleanup of updatePokemonExp
* Fixup setSizeToFrame mock
* Ensure pokemon hp numbers are not visible during stat display
* Update src/utils/common.ts
Co-authored-by: Wlowscha <54003515+Wlowscha@users.noreply.github.com>
* Make summary-ui-handler use new shinyDescriptor method
* Remove `undefined` parameter pass
Co-authored-by: Amani H. <109637146+xsn34kzx@users.noreply.github.com>
* Address kev's review comments
Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
* Ensure hp number display fades in/out
* Ensure ribbon and caught indicator fade with stat display
* Update src/ui/battle-info/battle-info.ts
Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
* Move construction of stats and type icons to their own methods
* Make setPositionRelative return this
* Improve doc comment on paddingX param
* Fix mock sprite's setPositionRelative
---------
Co-authored-by: Wlowscha <54003515+Wlowscha@users.noreply.github.com>
Co-authored-by: Amani H. <109637146+xsn34kzx@users.noreply.github.com>
Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
* Allow gastro acid to suppress passives if main ability is unsuppressable
* Update gastro_acid.test.ts
* Update src/data/moves/move.ts
Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
* Add test to ensure unsuppressable main ability is not suppressed
---------
Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
* Add Deep Sea Scale & Tooth items
Also changes Clamperl's evolution method from gender-specific to requiring one of the Deep Sea items to be held.
* Move Deep Sea items to Great tier
Also gives every species stat booster item a `rare` boolean to split these items from the rest of the species stat booster items. Updated the existing tests accordingly to account for the split.
* Reduce Great tier species booster item weight
* Fix global scene on evolution conditions
* Merge branch 'beta' into deep-sea-items
* Change how the held item is found in evolution condition
It should no longer look through the entire party's modifiers when seeing if Clamperl is eligible to use a Linking Cord.
* Fix wrong type being boosted
---------
Co-authored-by: damocleas <damocleas25@gmail.com>
Co-authored-by: Sirz Benjie <142067137+SirzBenjie@users.noreply.github.com>
* [BUG] Fixes#5010 Roar and Whirlwind don´t display a fail message
Roar and Whirlwind should now display a fail message when
used against a trainer with only one pokémon left
* Apply suggestions from code review made by SirzBenjie
* Fixed IVs of trainers using the Battle Seed.
* Renamed the randSeedInt functions that use the Battle Seed to randBattleSeedInt functions
* Incorrectly used this in common
* Fixed tests that were still calling the old function name
---------
Co-authored-by: damocleas <damocleas25@gmail.com>
Co-authored-by: Bertie690 <136088738+Bertie690@users.noreply.github.com>
Co-authored-by: AJ Fontaine <36677462+Fontbane@users.noreply.github.com>
Co-authored-by: Dean <69436131+emdeann@users.noreply.github.com>
Co-authored-by: lxy-lxy-lxy <55084073+lxy-lxy-lxy@users.noreply.github.com>
Co-authored-by: Xavion3 <xavion333@gmail.com>
Co-authored-by: Sirz Benjie <142067137+SirzBenjie@users.noreply.github.com>
Co-authored-by: Lylian BALL <131535108+PyGaVS@users.noreply.github.com>
Co-authored-by: Jimmybald1 <147992650+IBBCalc@users.noreply.github.com>
* Make type changing moves change type after abilities but before ion deluge/electrify
* Create unified test file for galvanize, pixilate, and refrigerate
* Make type boost items like silk scarf affect the move after its type change
* Add tests for type boost item interaction
* Remove leftover log messages
* Update spies in type-change ability tests
* Add automated tests for normalize
* Fix test name injection for tera blast
* Add automated test for tera blast normalize interaction
* Restore pokemon as a type-only import in moves.ts
* Add aerilate to type changing tests
* Rename galvanize test file
* Fix utils import
* Apply suggestions from code review
Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
* Remove unnecessary mockRestore
* Remove unnecessary nullish coalescing
Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
* Update src/field/pokemon.ts
Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
---------
Co-authored-by: Madmadness65 <59298170+Madmadness65@users.noreply.github.com>
Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
* Added changes to markdown files, reworked test boilerplate code + comment fixes
* Update comments.md
Removed references to jsdoc.
Removed mention of @extends which doesn't even exist in tsdoc
Increased clarity of documenting `args` parameter.
Moved to using active voice instead of passive voice
* Fix truncated sentence in returns example
* fix create-test-boilerplate.js
Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
* Update gameManager.ts
Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
* Update comments.md
Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
* Update gameManager.ts
Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
* Update gameManager.ts
Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
* Update gameManager.ts
Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
* Update gameManager.ts
* Fixed doc thing
* Fixed the things
Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
* Fixde boilerplate to use snake case
* Update .gitignore to include workspace files
* Update linting.md, fix lefthook etc.
* Fix tpyo
* Update create-test-boilerplate.js
Co-authored-by: Dean <69436131+emdeann@users.noreply.github.com>
* Update create-test-boilerplate.js
Co-authored-by: Dean <69436131+emdeann@users.noreply.github.com>
* Update create-test-boilerplate.js
Co-authored-by: Dean <69436131+emdeann@users.noreply.github.com>
* Reverted boilerplate code fixes and applied review comments
Will now be handled by milkmaiden
* Fixed up documentation for comments.md and linting.md
Comments.md added info pertaining to Kev's review
linting.md i just stopped spouting misinformation
* Update `biome.jsonc` comments
Update `comments.md`
Update docs for `AddSubstituteAttr` in `move.ts` to match example
* Apply suggestions to the suggestions
---------
Co-authored-by: Sirz Benjie <142067137+SirzBenjie@users.noreply.github.com>
Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
Co-authored-by: Dean <69436131+emdeann@users.noreply.github.com>
* isCaught function in Dex now returns the correct result
* Removed log messages
* Added tests to check caught status of battle forms
* Update src/ui/pokedex-page-ui-handler.ts
Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
---------
Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
* Remove unneeded fields from src/ui/filter-text.ts
* Add setOverlayMode to phaseInterceptor
* initialize pokemon starters before running tests
* Add getWrappedText to mockText
* Add initial pokedex test
* Add test for wrapping cursor in pokedex view
* Make pokedex use getPassiveAbility instead of checking passive map
Allows for tests to mock passives
* Add test for filtering double ability combinations
* Add test for filtering by types
* Mark failing test as TODO
* Apply suggestions from code review
Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
Co-authored-by: Madmadness65 <59298170+Madmadness65@users.noreply.github.com>
* Use ts-expect-error instead of ts-ignore in comments
Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
* Add save for pokedex tests
* Add test for filtering by cost reduction
* Add test for filtering by shiny
* Add tests for filtering by cost reductions
* Fix typo in test name
* Update test/ui/pokedex.test.ts
Co-authored-by: Wlowscha <54003515+Wlowscha@users.noreply.github.com>
* Update Mode import in pokedex test
* Replace reference to Mode with UiMode
---------
Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
Co-authored-by: Madmadness65 <59298170+Madmadness65@users.noreply.github.com>
Co-authored-by: Wlowscha <54003515+Wlowscha@users.noreply.github.com>
* Moved SelectBiomePhase in front of NewBattlePhase
* disguise test now has to go to QuietFormChangePhase
---------
Co-authored-by: Jimmybald1 <147992650+IBBCalc@users.noreply.github.com>
* Fix type hint after enemy disappears
* Add automated test for type hint bugfix
* Make onField default to true
* Replace reference to Mode with UiMode and battleType with BattleStyle
* Extract Mode enum out of UI and into its own file
Reduces circular imports from 909 to 773
* Move around utility files
Reduces cyclical dependencies from 773 to 765
* Remove starterColors and bypassLogin from battle-scene
Reduces cyclical dependencies from 765 to 623
* Fix test runner error
* Update import for bypassLogin in test
* Update mocks for utils in tests
* Fix broken tests
* Update selectWithTera override
* Update path for utils in ab-attr.ts
* Update path for utils in ability-class.ts
* Fix utils import path in healer.test.ts