Commit graph

31 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
Lylian BALL
82cd492117
[Bug] Pokemon with illusion imitate the cry of the illusion (#5675) 2025-04-18 09:33:28 +00:00
Sirz Benjie
b2bab46e1c
[Bug][Ability] Fix healer queueing its message when its ally is fainted (#5642)
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 check against faint status effect

* Add tests for healer

* Remove redundant portions of the tests

* Fix broken test
2025-04-17 04:47:49 +00: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
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
Lylian BALL
15e535a1a0
[Ability] Implement Illusion (#3273)
Some checks failed
Deploy Beta / deploy (push) Has been cancelled
Biome Code Quality / Run linters (push) Has been cancelled
Tests / Run Tests (push) Has been cancelled
* implement illusion ability with unit test and localizations

* try removing whitespace change on unnecessary files

* nit corrections

* nit update src/field/pokemon.ts

Co-authored-by: Adrian T. <68144167+torranx@users.noreply.github.com>

* nit update src/phases.ts

Co-authored-by: Amani H. <109637146+xsn34kzx@users.noreply.github.com>

* illusion test correction

* unexpected error correction

* refactor property pokemon.illusion to pokemon.battleData.illusion

* nit

* nit

* update unit test up-to-date

* add docs

* merge up to date

* bugfix

* bugfix

* merge up to date

* refactor field illusion out of battleData

* fix nit

* fix nit

* Zoroark change illusion after lastPokemon update

* Zoroark change illusion after lastPokemon update

* refactor bug fix

* bugfix

* bug fix on tests

* Update src/field/pokemon.ts

Co-authored-by: innerthunder <168692175+innerthunder@users.noreply.github.com>

* use GetFailedText

* remove useless import

* add condition 'no illusion' into transform move

* wild Zoroark creates an illusion according to the current biome

* wild Zoroark creates an illusion according to the current biome

* delete console.log()

* add doc

* Update src/field/pokemon.ts

Co-authored-by: innerthunder <168692175+innerthunder@users.noreply.github.com>

* fix tests

* update locales submodule

* update Illusion interface

* bug fix

* bug fix

* bugfix

* rename some params for future implementations

* Zoroark keep illusion between battles

* Zoroark keep illusion between battles

* delete draft

* merge up-to-date

* bugfix

* merge

* merge

* implement canApplyPresummon method

* Update test/abilities/illusion.test.ts

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

* Update src/data/ability.ts

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

* Update src/data/ability.ts

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

* Update test/abilities/illusion.test.ts

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

* Update test/abilities/illusion.test.ts

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

* nit

* review corrections

* nit

* type hints affected by enemy illusion

* type hints affected by enemy illusionin fight-ui-handler

* nit

* rename some parameters back in useIllusion

* Update src/field/pokemon.ts

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>

* refactor battleData.illusion as summonData.illusion and delete oncePerBattleClause

* add comments

* illusion will break before evolution

* Update src/field/pokemon.ts

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

* Update src/data/ability.ts

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

* Update src/data/ability.ts

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

* Update src/data/ability.ts

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

* Update src/data/ability.ts

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

* bug fix

* g

* get submodule back

* get submodule back

* bug fix to save illusion status

* add pokemon.getPokeball()

* Update src/field/pokemon.ts

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

* Update src/field/pokemon.ts

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

* Update src/field/pokemon.ts

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

* Update src/data/ability.ts

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

* Update src/field/pokemon.ts

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>

* Update src/field/pokemon.ts

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: Adrian T. <68144167+torranx@users.noreply.github.com>
Co-authored-by: Amani H. <109637146+xsn34kzx@users.noreply.github.com>
Co-authored-by: innerthunder <168692175+innerthunder@users.noreply.github.com>
Co-authored-by: flx-sta <50131232+flx-sta@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-04-12 21:22:04 -04:00
Dean
31835e6d53
[Bug] Fix #4972 Status-Prevention Abilities do not Cure Status (#5406)
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 PostSummonHealAbAttr and give it to appropriate abilities

* Add attr to insomnia

* Remove attr from leaf guard (it does not activate on gain with sun up)

* Add tests and remove attr from shields down

* Add PostSummonRemoveBattlerTag and give it to oblivious and own tempo

* Add tests for oblivious and own tempo

* Fix oblivious test sometimes failing

* Remove Comatose changes as it doesn't reapply

* Remove unused tagRemoved field

* Fix tests checking status instead of tag

* Fix attr comments

* Add PostSetStatusHealStatusAbAttr

* Add ResetStatusPhase

* Modify pokemon.resetStatus to use ResetStatusPhase

* Move post status effects to ObtainStatusEffectPhase

* Ensure status overriding (ie rest) works properly

* Add PostApplyBattlerTagRemoveTagAbAttr for own tempo and oblivious

* Guard removeTag call in PostApplyBattlerTagRemoveTagAbAttr

* Commenting

* Handle Mold Breaker case in MoveEndPhase

* Remove PostSummonHealStatusAbAttr from purifying salt

* Fix not passing overrideStatus to canSetStatus

* Apply suggestions from code review

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

* Add isNullOrUndefined import

* Add canApply to new attrs

* Add followup argument back

* Remove guard around new MoveEndPhase

---------

Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
2025-04-07 16:32:10 -07:00
Sirz Benjie
9e4162d429
[Bug] Fix super luck implementation (#5625)
* Fix super luck implementation

* Use numberholder instead of booleanholder

* Update tsdoc for getCritStage
2025-04-04 17:40:25 -07:00
Sirz Benjie
e31bf91223
[Bug][Ability] Fix mold breaker effect lingering if the user's move runs out of PP (#5265)
* Fix mold breaker pp bug

* Update Dancer test to account for changed phase behavior

* Update doc comment for move-phase's `end` method

* Add null handling for pokemon in `move-end` phase

---------

Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
2025-04-04 23:57:39 +02:00
Sirz Benjie
b364bb1899
[Bug][Ability] Fix wimp out and emergency exit skipping waves in double battles (#5261)
Fix wimp out causing battles to skip
2025-04-04 14:39:53 -07: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
Dean
b33d95d27d
[Bug][Refactor] Fix Unsuppressable Abilities being Unreplaceable (#5547)
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
* Switch unsuppressable to unswappable

* Update test

* Change suppress/replace/copy flags

* Make flower gift unreplaceable

* Make forecast unreplaceable

* No holding hands

* [Sprite] Reduce Mystical Rock sprite's size (#5570)

* Updating the size to be smaller

* Update item atlas

* Fix Malicious Armor missing outline

Noticed when exporting atlas that the item sprite broke

---------

Co-authored-by: Madmadness65 <blaze.the.fireman@gmail.com>
Co-authored-by: damocleas <damocleas25@gmail.com>

* Switch unsuppressable to unswappable

* Update test

* Change suppress/replace/copy flags

* Make flower gift unreplaceable

* Make forecast unreplaceable

* No holding hands

* Apply suggestions from code review

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

* Remove trivial type annotations

---------

Co-authored-by: Unicorn_Power <189861924+Unicornpowerstar@users.noreply.github.com>
Co-authored-by: Madmadness65 <blaze.the.fireman@gmail.com>
Co-authored-by: damocleas <damocleas25@gmail.com>
Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
2025-03-30 05:37:35 +00:00
Sirz Benjie
66bc83fce4
[Ability] Flower Veil implementation (#5327)
* [WIP] flower veil implementation

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

* Remove promises

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

* Fully implement Flower Veil

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

* Fix ally interaction for battler tag

* Condense and cleanup test files

* Remove a console.log message

* Remove stray excess import

* Update doc comments and apply kev's suggestions from code review

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

* Remove duplicated test

---------

Signed-off-by: Sirz Benjie <142067137+SirzBenjie@users.noreply.github.com>
Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
2025-03-29 21:32:35 -07:00
schmidtc1
27a1638243
[Bug] Fix interactions for Pollen Puff Parental Bond, Multi-Lens, Grip Claw Ally Healing (#5550)
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
* Checks for hit result status on Grip Claw application

* Adds a boolean check for the Pollen Puff edge case in canBeMultiStrikeEnhanced

* Adds parental bond test

* Adds grip claw and multi lens tests
2025-03-29 18:25:34 +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
fac20ca97a
[Ability] Fully implement Flower Gift and Victory Star (#5222)
* Fully implement Flower Gift and Victory Star

* Fully implement Flower Gift and Victory Star

* Update src/field/pokemon.ts

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>

* Update src/data/ability.ts

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

* Update src/data/ability.ts

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

* Accept suggested change

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

* Accept suggested change

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

* Update src/data/ability.ts

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

* Update src/data/ability.ts

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

* Update src/data/ability.ts

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>

* Fix check for ignore_abilities move flag

* Fix missing argument to getBaseDamage in getAttackDamage

* Fix merge conflict due to same changed import line

* Fix call to getAttackDamage that was reset after merge

* Update calls to getEffectiveStat

---------

Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
2025-03-28 22:24:19 -05: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
Dean
dbc8ac26af
[Bug] Fix #5422 Neut. Gas and Primal Weather Persist After Flee (#5496)
* Add applyPreLeaveFieldAbAttrs call to AttemptRunPhase

* Update tests
2025-03-23 23:27:20 +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
b298138157
[Bug] Fix NG crash when ability is reactivated for a Pokemon off the field (#5478)
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-11 03:20:00 +00:00
Dean
929392fe8b
[Bug] Fix #5358 Abilities that Redirect Moves Consider Move-Typings before Ability Modifiers (#5464) 2025-03-11 03:02:51 +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
Dean
905fec92e9
[Bug] Fix Neutralizing Gas not Deactivating on Faint and Capture (#5423) 2025-02-26 22:39:08 +01:00
Dean
870bff0e6e
[Bug][Ability] Fix Neutralizing Gas interactions #5381
* Add neutralizing gas arena tag

* Add PostSummonAddArenaTagAbAttr

* Add PreLeaveField attr for neutralizing gas

* Remove old SuppressFieldAbilitiesAttr

* Fix ability suppression logic

* Add basic tests

* Reapply onGain abilities when neutralizing gas ends

* Untodo ability remval test

* Add more tests

* Modify gastro acid to call onLose attributes when suppressing

* Properly cancel abilities on switch in

* Add documentation

* Remove partial designation

* Update locale key usage

* Reactivate the last source's other abilities when it becomes the last remaining

* Fix loop vars

* Add access modifiers for SuppressAbilitiesTag

* Minor changes

* Move test to reflect new location

* Remove promises from abattr function signatures
2025-02-25 18:38:17 -05: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