Commit graph

30 commits

Author SHA1 Message Date
Sirz Benjie
5854b21da0
[Refactor] Remove circular imports part 1 (#5663)
* 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
2025-04-19 11:57:03 +00:00
Sirz Benjie
54ce58411b
[Bug] Fix forced switch bugs in enemy partner trainer battles (#5644)
Some checks are pending
Deploy Beta / deploy (push) Waiting to run
Biome Code Quality / Run linters (push) Waiting to run
Tests / Run Tests (push) Waiting to run
* Add isPartner method to trainer class

* Ensure force switches cannot pull pokemon from the wrong trainer

* Add override for battle type

* Fixup tests and broken assumptions

* Make move fail override semi-invuln check

Bandaid fix because move effect phase does not allow for the move to fail if all of its conditions fail

* Restore overrides

* Apply kev's suggestions from code review

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

* Fix illusion test battle type invocation

* Update struggle and healer tests to use battleStyle

---------

Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
2025-04-18 09:35:46 +00:00
Sirz Benjie
3a46aae687
[Bug] Fix beak blast: not applying if user faints and not respecting long reach (#5639)
* Add test for beak blast applying after user faints

* Rewrite tags for contact protected and check moveFlags.doesFlagEffectApply

* Add test to beak blast ensuring a long reach user does not get burned

* Re-add DamageProtectedTag to relevant inheritance chains

* Move resetSummonData to faintPhase instead of pokemon.apply

* Remove passing of grudge and destiny bond tags to faint phase
2025-04-17 15:25:38 -05:00
damocleas
8d311e65cf
[Bug] [Ability] Fixed wrong Sheer Force interactions and multiplier from ~1.33 -> 1.3 (#5515)
* sheer force #, sheer force and burning jealousy test fix, and move chance fixes

* removed order up sheer force interaction mention and test - updated comments

* remove electro shot from changes
2025-04-16 19:31:53 -07:00
Sirz Benjie
ae588ebff9
[Bug][Move] Struggle no longer gets STAB (#5643)
Some checks are pending
Deploy Beta / deploy (push) Waiting to run
Biome Code Quality / Run linters (push) Waiting to run
Tests / Run Tests (push) Waiting to run
* Struggle no longer gets STAB

* 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-04-16 16:05:40 -05:00
Stephen Kelman
18c4dddcf0
[Bug] Fixing Tera Starstorm for first turn of terastallization (#5658)
Some checks are pending
Deploy Beta / deploy (push) Waiting to run
Biome Code Quality / Run linters (push) Waiting to run
Tests / Run Tests (push) Waiting to run
* Updating tera starstorm targeting condition so that it is a spread move on the turn that terastallization happens

* added new unit tests to verify behavior of tera starstorm under non-tera conditions as well as on terastallization turns
2025-04-15 14:19:19 +00:00
Sirz Benjie
ff44cbfa97
[Refactor] Refactor ability file part 1 (#5589)
* Move ability.ts to subfolder

* Extract types out of ability.ts

* Update imports in ability.ts and friends

* Cleanup imports in ability.ts

* Re-add imports lost during sort

* Update imports forgotten during rebase

* Re-import proper type from enums

* Update biome.jsonc

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

* Add commit to force tests to rerun

---------

Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
2025-04-15 14:08:35 +00:00
damocleas
b41eee3c7f
Revert "[Refactor] Move many interfaces and enums to their own file" (#5661)
Revert "[Refactor] Move many interfaces and enums to their own file (#5646)"

This reverts commit c82e01eed3.
2025-04-14 12:28:36 -04:00
Sirz Benjie
c82e01eed3
[Refactor] Move many interfaces and enums to their own file (#5646)
* Move LearnMoveSituation to its own file

* Remove unused selfStatLowerMoves array

* Move all-moves to its own file

* Move TurnMove interface to its own file

* move AiType to its own file

* Move PokemonMove to its own file

* Move DamageCalculationResult interface to its own file

* Move fieldPosition to its own file

* Move hit-result to its own file

* Move DamageResult to its own file

* Move SpeciesWildEvolutionDelay to its own file

* move EvolutionItem to its own file
2025-04-14 08:31:26 -07:00
NightKev
6f56dce771
[Biome] Add and apply lint/style/noNamespaceImport (#5650)
Some checks are pending
Deploy Beta / deploy (push) Waiting to run
Biome Code Quality / Run linters (push) Waiting to run
Tests / Run Tests (push) Waiting to run
* Add `lint/style/noNamespaceImport` Biome rule

* Apply Biome rule, add exception for `*.test.ts` files
2025-04-12 01:31:56 -04:00
Diogo Cruz Diniz
0479b9dfcc
Fix #2735: Hazard moves incorrectly require targets (#5635)
Some checks are pending
Deploy Beta / deploy (push) Waiting to run
Biome Code Quality / Run linters (push) Waiting to run
Tests / Run Tests (push) Waiting to run
* Fix #2735: Hazard moves incorrectly require targets
Hazard moves should no longer require targets to successfully execute

* Apply suggestions from code review made by NightKev

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

---------

Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
2025-04-07 08:50:52 -05:00
Dean
1229bfe004
[Bug][Hotfix] Fix Parental bond + Pollen Puff softlock (#5607)
* Fix parental bond softlock

* Add test for pollen puff

---------

Co-authored-by: Sirz Benjie <142067137+SirzBenjie@users.noreply.github.com>
2025-04-01 12:10:59 -07:00
damocleas
4f19e4a126
[Move] False Swipe/Hold Back don't fail if the target has 1 HP (#5577)
* Remove condition from `SurviveDamageAttr`

* Add test for False Swipe

---------

Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
Co-authored-by: EmberCM <kooly213@hotmail.com>
2025-03-29 17:10:07 +00:00
NightKev
25b9fa7933
[Biome] Add "no unused imports" rule (#5580)
Some checks are pending
Deploy Beta / deploy (push) Waiting to run
Biome Code Quality / Run linters (push) Waiting to run
Tests / Run Tests (push) Waiting to run
* Apply Biome to files

* Add `lint/correctness/noUnusedImports` rule

* Apply rule

* Remove obsolete eslint directives

* Fix variable naming in `game-speed.ts`
2025-03-29 10:24:23 +00:00
Sirz Benjie
5f01caffae
[Refactor] Minor refactor of trainer-config files (#5573)
Some checks are pending
Deploy Beta / deploy (push) Waiting to run
Biome Code Quality / Run linters (push) Waiting to run
Tests / Run Tests (push) Waiting to run
* Move trainer-config.ts

* move TeraAIMode enum to its own file

* Move TrainerPoolTier enum to its own file

* Move TrainerSlot enum to its own file

* Reorder and group imports

* Move TrainerPartyTemplate to its own file

* Remove speciesPoolPerEvilTeamAdmin method

* Apply kev's suggestions from code review

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

* Fix typo in zinzolin's name

---------

Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
2025-03-29 00:19:35 -04:00
Sirz Benjie
35e733e87a
[Test] [Refactor] [GitHub] Enable no isolate for vitest (#5566)
* Reuse global scene between tests

Co-authored-by: PigeonBar <56974298+PigeonBar@users.noreply.github.com>

* Add missing each method to mockContainer

* Fix select-modifier-phase test

* Sanitize overrides before tests

Co-authored-by: PigeonBar <56974298+PigeonBar@users.noreply.github.com>

* Sanitize overrides before tests

Co-authored-by: PigeonBar <56974298+PigeonBar@users.noreply.github.com>

* [WIP] fix things

* Fix tests not working with --no-isolate

* Update npm tests to use no isolate

* Update test-shard-template

* Update package.json

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

---------

Co-authored-by: PigeonBar <56974298+PigeonBar@users.noreply.github.com>
Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
2025-03-28 17:30:38 -04:00
Amani H.
6316218bd3
[Item] Add Weather and Terrain Extender Item (#4799)
* [Item] Add Weather and Terrain Extender Item

* Add Documentation

* Clean Up Unit Tests

* Add Weight Function

* Include Suggestions
2025-03-26 22:40:46 -04:00
NightKev
db850c79cd
[Refactor] Moveset arrays can no longer hold null values (#4919)
* Pokemon movesets no longer allow `null` values

* Clean up all the bangs caused by movesets allowing `null`

* Pokemon movesets no longer allow `null` values

* Clean up all the bangs caused by movesets allowing `null`

* Fix merge issues

* Remove various unnecessary `?`

* Apply biome

* Fix `global-trade-system-encounter.ts`

* Fix merge issue

* Remove unnecessary parentheses

* Remove missed `?`

* Match formatting of `pokemon.ts`
2025-03-26 19:12:54 -07:00
schmidtc1
40e1e7fd4e
[Bug] Fix Reviver Seed and endure triggering on indirect damage (#5182)
* Create new turnData field for tracking damageResults, check for HitResult in Reviver Seed modifier

* Optional chaining for cases like stealth rock

* Adds HitResult.SELF for confusion to distinguish from indirect damage

* Adds HitResult.SELF to damage sound effect switch

* Cover edge case of salt cure, insert HitResult for ALL damage regardless of optional variable

* Change Liquid Ooze HitResult to OTHER from HEAL

* Adjust OHKO moves to not bypass endure or RSeed

* Add tests for reviver seed

* Fixes endure to no longer block indirect damage, updates weather damage to be HitResult.OTHER, adds/fixes unit test

* Change destiny bond to HitResult.OTHER so it doesn't trigger rseed

* Adds destiny bond unit test

* Creates additional unit tests for endure

* Rename SELF hitresult to CONFUSION

* Update CONFUSION enum

* Refactors implementation per Wlowscha's suggestions: removes damageSources array and preventEndure variable

* Rename HitResult.OTHER to INDIRECT, create INDIRECT_KO for PSong/DBond, add functionality for INDIRECT_KO to damageanim/number handler

* Fixes hit result for stealth rock

* Removes unnecessary check, makes DamageResult default to EFFECTIVE, updates remaining damageAndUpdate calls to use INDIRECT

* Refactors damageAndUpdate to replace optional parameters with object parameter

* Fixes based on Kev's suggestions

* Updates tsdocs for damageAndUpdate

* Fix merge conflict

---------

Co-authored-by: Wlowscha <54003515+Wlowscha@users.noreply.github.com>
2025-03-23 22:59:19 +00:00
Dean
817095d895
[Bug] Fix #2769 Revival Blessing Softlock in doubles (#5141)
* Properly handle cases where enemy switches in due to revival

* Fix user ally using move when revived

* Move revival blessing function to move.ts

* Properly filter for the right switch phase to remove

* Re-add bug fix

* Add test
2025-03-23 20:47:51 +00:00
José Serrado Marques
1e876ec595
[BUG] fixes #5472 - transform on reload (#5508)
* [BUG] fixes #5472 - transform on reload

* Fix the bug where transformed pokemon failed to load sprite on reload if it was not the base form

* Now properly loads the transformed sprite assets during summon phase
2025-03-23 12:07:14 -07:00
Dean
585f040057
[Test] Fix Chilly Reception Test Ability Overrides (#5543)
Some checks are pending
Deploy Beta / deploy (push) Waiting to run
Biome Code Quality / Run linters (push) Waiting to run
Tests / Run Pre-test (push) Waiting to run
Tests / Run Tests (push) Blocked by required conditions
* Fix ability overrides

* Remove extraneous resets
2025-03-19 23:25:14 +00:00
NightKev
b2848af899
[Test] Add ability overrides to Tailwind tests (#5541)
Some checks are pending
Deploy Beta / deploy (push) Waiting to run
Biome Code Quality / Run linters (push) Waiting to run
Tests / Run Pre-test (push) Waiting to run
Tests / Run Tests (push) Blocked by required conditions
2025-03-18 23:00:46 -05:00
Dean
1d7f916240
[Refactor] Align ability display with mainline (#5267)
Some checks are pending
Deploy Beta / deploy (push) Waiting to run
Biome Code Quality / Run linters (push) Waiting to run
Tests / Run Pre-test (push) Waiting to run
Tests / Run Tests (push) Blocked by required conditions
* Stop ShowAbilityPhase from ending until the bar has popped out

* Remove ability bar hiding from messagePhase

* Remove abilityBar reference from base Phase class

* Add HideAbilityPhase to hide ability bar after effects

* Add willSucceed to ability attrs

* Update AbAttrs and PostInitAbAttrs

* Update PreDefendAbAttrs

* Update postDefend, postMoveUsed, StatStage, postSetStatus, and PostDamage

* Update preAttack and fieldStat

* Partially implement postAttack

* Finish PostAttack

* Update PostSummon

* Update PreSwitchOut

* Update preStatStageChange

* Update PostStatStageChange, PreSetStatus, PreApplyBattlerTag

* Update postTurn and preWeatherEffect

* Update postWeatherChange

* Update postWeatherChange

* Update PostTerrainChange

* Update CheckTrapped and PostBattle

* Update postFaint

* Update PostItemLost

* Bug fixes from test cases

* Fix intimidate display

* Stop trace from displaying itself

* Rename to canApply

* Fix ability displays using getTriggerMessage

* Ensure abilities which are mistakenly shown are still hidden

* Fix ability bar showing the wrong ability with imposter

* Add canApply for imposter

* Update abilities using promises and `trySet...` functions

* Committing overrides changes is bad

* Document apply and canApply

* Update PreLeaveFieldAbAttr

* Remove boolean return type apply functions

* Remove redundant  assignment

* Remove ability display from abilities that shouldn't have it

* Move queueAbilityDisplay to battlescene

* Remove unused shown variable

* Minor changes

* Fix using id instead of battlerindex in queueAbilityDisplay

* Fix PostBattleInitFormChangeAbAttr displaying

* Prevent crashes in case an ability for a pokemon not on the field is shown

* Stop more abilities from displaying

* Move enemy ability bar to the right side

* Automatically reload bar if shown while already out, fix specific abilities

* Remove duplicate call to clearPhaseQueueSplice

* Remove ShowAbilityPhase import from ability.ts

* Update PostDefendTypeChangeAbAttr to use PokemonType

* Update PostSummonAddArenaTagAbAttr

* Minor changes
2025-03-16 02:51:02 +00:00
Sirz Benjie
408b66f913
[Misc][Refactor][GitHub] Ditch eslint for biome, and add a formatter (#5495)
Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
2025-03-09 14:13:25 -07:00
Sirz Benjie
60a4db7059
[Refactor] Refactor moves.ts part 1 (#5420) 2025-03-07 19:10:29 -06:00
schmidtc1
7a9b1e5033
[Bug] Fix critical hits not bypassing screens (#5470)
Some checks are pending
Deploy Beta / deploy (push) Waiting to run
ESLint / Run linters (push) Waiting to run
Tests / Run Pre-test (push) Waiting to run
Tests / Run Tests (push) Blocked by required conditions
2025-03-06 09:14:22 +00:00
Wlowscha
89e8085c39
[Bug] Display Pokémon name in Focus Punch lost focus message (#5448)
Some checks are pending
Deploy Beta / deploy (push) Waiting to run
ESLint / Run linters (push) Waiting to run
Tests / Run Pre-test (push) Waiting to run
Tests / Run Tests (push) Blocked by required conditions
2025-02-28 23:22:51 -05:00
Esca
883bf45bc0
[Bug][Move] Shed Tail now rounds incurred damage up, not down (#5219)
Some checks are pending
Deploy Beta / deploy (push) Waiting to run
ESLint / Run linters (push) Waiting to run
Tests / Run Pre-test (push) Waiting to run
Tests / Run Tests (push) Blocked by required conditions
* Shed Tail rounds incurred damage up

* Altered Substitute/Shed Tail success condition to account for rounding up

* Altered the test to match correct functionality

* Update src/data/move.ts

Removed default value in constructor due to it having become redundant

Co-authored-by: NightKev <34855794+DayKev@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-02-26 00:45:29 -08:00
Sirz Benjie
a51a504155
[Test] Move test folder out of src (#5398)
* move test folder

* Update vitest files

* rename test/utils to test/testUtils

* Remove stray utils/gameManager

Got put back from a rebase
2025-02-22 22:52:07 -06:00