Commit Graph

126 Commits

Author SHA1 Message Date
Dmitriy K
0970c2cd4e
[Refactor] Replace forceBypass with bypassFaint flag (#1839)
* replace forceBypass with bypassFaint flag

* add another path alias for src/test

* make form override work for the whole party instead of the first pokemon

* add tests for all abilities that are touched by this change

* remove unnecessary overrides from tests

* move SpeciesFormChangeTimeOfDayTrigger outside arena reset logic

* remove alll resetMock calls, rename it to test
2024-06-13 11:36:12 +02:00
Dmitriy K
777a8ad9ea
update gameManager switchPokemon to match other menu utilities (#2147) 2024-06-12 20:49:07 +02:00
Zach Day
31406b35fd
[Move] Fix type immunities granted by abilities only applying to attacks (#2145)
* Fix type immunity given by abilities only applying to attacking moves

* Add tests for type immunity granted by abilities

* Use Sap Sipper as base for testing
2024-06-12 14:46:45 -04:00
Greenlamp2
f57798fd1d
[Bug Fix] Correct PostSummonPhase Timing for Abilities and Entry Hazards (#2108)
* added test for spikes + forceOpponentToSwitch

* added conditionalQueue && pushConditionalPhase to fix entry hasard and abilities at post summon

* reduce timeout time to default
2024-06-12 00:55:16 +02:00
Greenlamp2
a2d0a9ece3
[CI] Add GitHub Action to Run Silent Tests on PRs to Main (#2100)
* github action to run tests in PR

* fix the CI name

* fix comment

* fix divergent tests + cut some useless long test + fix versions
2024-06-11 19:13:02 +02:00
Greenlamp2
1263ff3af2
fix opponent triggering abilities each turn (#2094) 2024-06-11 17:13:40 +02:00
Greenlamp2
0faccad49e
[Bug Fix] Corrected PostSummonPhase Trigger Timing for Accurate Stat Changes (#2057)
* fix postSummonPhase when opponent does not summon and fix the statsChange from push to unshift

* added switch pokemon helper method

* added on switch tests for intimidate

* fix test by overriding passive in tests

* remove a test not needed

* cleanup imports
2024-06-11 16:12:46 +02:00
Dmitriy K
ee4d130ebb
[Test(refactor)]: Refactor tests game manager (#2062)
* refactor tests game manager

* add setPosition to Mock Text class
2024-06-10 23:35:24 +02:00
Greenlamp2
e29c08ba1f
[Test] Add Tests for Zen Mode Ability (#1978)
* added tests for zen mode - change form in battle

* added tests to run some battle against trainer/rival & boss

* added a test with a method to kill a pokemon

* added an override in the clock mocked to reduce the time of fainting pokemon and thus reducing test time from 5s to less than 1s

* added some more tests + doAttack, doKillOpponents, toNextWave, toNextTurn helper

* added some more tests + doAttack, doKillOpponents, toNextWave, toNextTurn helper + fix some tests
2024-06-10 10:10:23 -04:00
Greenlamp2
d03c75c2f9
[QoL] Improve Input Accuracy by Refactoring Button Handling (#1936)
* refactored inputs-controller for better hold button management

* refactored the touch controls file to use a class and add holding button system

* added a method to deactivate pressed key for touch on focus lost

* better lost focus management
2024-06-09 19:15:37 -04:00
Greenlamp2
dd40c8caa2
added silent option to run tests and added a missing properties in the MockText (#1967) 2024-06-08 21:24:57 +01:00
Greenlamp2
c301a54039
[Improvement] Refactored Test Phase Management with Error Handling (#1962)
* better phase management in tests

* cleanup runFrom/to

* first step of async error handling

* second step of async error handling, halt await, still an issue with select-starter test

* added back whenAboutToRun

* added back full run suite for starter-select.test.ts
2024-06-08 20:54:20 +01:00
Xavion3
696ff6eae3
Add Challenges (#1459)
* Initial challenge framework

* Add type localisation

* Change how challenges are tracked

Also fixes the difficulty total text

* MVP

Renames challenge types, temporarily hides difficulty, and implements challenge saving.

* Attempt to fix one legal pokemon in a double battle

* Make monotype ignore type changing effects

* Make isOfType correctly detect normal types

* Try to fix double battles again

* Make challenge function more like classic

* Add helper function for fainted or not allowed

* Add framework for fresh start challenge and improve comments

* Try to fix evolution issues

* Make form changing items only usable from rewards screen

* Update localisation

* Additional localisation change

* Add achievements for completing challenges

* Fix initialisation bug with challenge achievements

* Add support for gamemode specific fixed battles

Also make monogen challenges face the e4 of their generation

* Add better support for mobile in challenges

* Localise illegal evolution/form change message

* Update achievement names

* Make alternate forms count for monogen

* Update monotype achievement icons

* Add more comments

* Improve comments

* Fix mid battle form changes

* Reorder mode list

* Remove currently unused localisation entry

* Add type overrides for monotype challenges

Meloetta always counts for psychic and castform always counts for normal

* Change how form changes are handled

Now attempts a switch at the start of each turn instead of immediately

* Add start button to challenge select screen

* Make starter select back out to challenge screen if using challenges

* Fix daily runs

* Update tests to new game mode logic
2024-06-08 01:07:23 -04:00
Matthew
9c97e37c27
initVouchers correctly (#1940) 2024-06-07 23:50:07 -04:00
Greenlamp2
1a149bfa04
[Testing] Flexible Testing Wrapper for Phaser-Based Battle-Scenes (#1908)
* refactor executed code while importing and initializing all of these in loading-scene

* reset to main

* fix server url

* added rule no-trailing-spaces

* made progress

* test somme data from a session save is working

* trying to launch a battle

* added fetch wrapper to load data locally

* trying to mockAllSettled

* pushPhase & shiftPhase

* check integrity of exported session

* set toke + loggedInUser in tests

* progress on starting new battle

* tring to test phase but it's async

* mocking fetch

* working mock fetch

* need to handle pile of data

* attempt to use real phaser classes

* reorder overrides

* refactored to use some real classes from phaser

* removed useless things

* started to work on some container mock

* finished the mockContainer time to add some logic

* some more mock containers

* removed addMethods since there is the mock classes now

* commented issues

* attempt to create mockTextureManager

* fix tests

* mockSprite & mockText

* yes but not really

* yes but not really

* fix tutorial callback

* reached mode title

* added achievement tests

* fix test achievements with current state of mock

* correct sequence loading for BattleScene with mockLoader !

* deep dive into next step

* working wait until starter selection screen

* added newGame method into wrapper

* expect to save_slot

* trying to manage pokemon sprite for getAll without success yet

* added test for egg output

* fixed egg test for June

* fix tests + locate next issue to fix

* we are in battle baby

* added new game in one-line

* export is working but export only what's in the fetch

* fix start game as guest

* refactored how we start a battle + cleanup

* overrided mewtwo but issue with currentBattle

* refactor: rename InitAchievements to initAchievements

* added missing mock method

* override level and pokemon forms working as intended

* bringToTop Obj

* remove launch battle in achivement test

* fix getIndex when same pokemon

* can run all tests

* first attack, faint, and shop modifiers, MockClock

* on method for container

* added doAttack one-liner

* one-line export data

* removed throw error

* feat: Make `scenes` property of `GameWrapper` class public

The `scenes` property of the `GameWrapper` class was changed from private to public. This change allows external access to the `scenes` map, which is used to store Phaser scenes. This modification was made to enable easier manipulation and interaction with the scenes in the game.

* correction

* removed CanvasRenderer

* added a param to remove console.log and added a param to preven scene create call

* fix encounter wave 30 when it's a trainer

* test double-battle

* test fight without KO

* test double fight no ko

* fix crashing texture + added Text wrapper to log fight

* fix tests on boss - trainer - rival

* chore: Refactor BattleScene initialization and add new phases

Refactor the BattleScene initialization code to remove unnecessary delay and improve performance. Also, add new phases for the title and unavailable states to enhance the game experience.

* rework of Game tests

* skipFn is working

* added onNextPrompt and restore Og Start

* better newGame

* added skipFN in remove

* not yet working test but updated interceptors

* do attack work but not on PostSummonPhase phase when there is mention of silcoon and wurmple

* error located, it's just a double fight, i was not there yet

* single OHKO & double no OHKO

* added expirationFn into next prompt

* all tests are passing

* working test on non damaging move from opponent

* cleaned a bit

* removed phaser initialisation on every tests

* renamed test file

* added load system data

* added some ability support

* added onKill & onSummon abilities test

* removed useless test + cleanup

* removed useless test + cleanup

* fixed tests after merge main

* added itemHeld endTurn trigger test (toxic orb)

* added runFrom..To

* added mustRun to assert currentPhase

* added no-miss move to test things

* cleaner restore mock

* fix test

* fix moxie test + game speed

* improve test speed

* added onOurself and onOpponent mvoe test

* added onDamage test for tackle

* removed timeout in intervals to run tests faster

* cleanup

* added never crit override + separate file per test + remove randomness in randBattleSeedInt

* move folders

* better org

* renamed itemHeld folder to items

* fix deploy.yml

* cleanup

* simplified the gameManager start battle and allow single pokemon in party

* remove the need of mode development

* added input handler to test inputs + remove time from phaser into inputController

* added keyboard support

* added fakeMobile support

* added details

* removed a console.log + added logUp

* move test to folder

* fixed canvas issue

* added starter select tests

* added some more test on starter-select

* added battle-order tests

* added battle-order tests

* fixing Phaser RNG

* ordering stats for better reading

* fix tests for main

* adapt battle-order test to be more readable

* fix merge

* fix some errors and silent all errors from gameWrapper since it's not possible to avoid them

* fix mocks to manage childs & stuffs

* added some docs

* fix achievement test

* removed an unused file

* separate misc tests to clean battle.test file

* added a basic french lokalization test

* added i18n where it needs to be used only

* revers extracted method

* removed unused method

* removed handler fetch since we do not test anything server related

* fix test with handlers removed

* added intrepid sword test

* fix enum exp party

---------

Co-authored-by: Frederico Santos <frederico.f.santos@tecnico.ulisboa.pt>
2024-06-07 18:33:45 -04:00
Matthew
69da96d543
Settings Refactor (#1771) 2024-06-03 19:57:47 -04:00
José Ricardo Fleury Oliveira
c7de17a46e
Achievements localization, organized some locales files and ptBR translations (#1150)
* organizing, translations and achv localization

* localized for all languages

* minor fix

* minor fix 2

* minor fix 3

* Fixed Achivment Localization, Added german localization and fixes some issues with german localization at other parts

* fix pickup description

* Update French achv.ts

* French typo correction achv.ts

* eslint fixes

* added zhTW

* minor fix

* Achivment Bar is localized and gets bigger when using german

* Changed some things to make it not as Big

* The Achivment Bar now grows with the context

* Updated Achivment Names in german

* Update French achv.ts

* Vouchers now will show the correct descrption again

* minor fix

* minor fixes

* "sub" to "semi"

* minor fix

* fixes warning and organizes some files

* forgot about english

* korean translations

* test fix

---------

Co-authored-by: Jannik Tappert <tappertjannik@googlemail.com>
Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com>
Co-authored-by: Lugiad <adrien.grivel@hotmail.fr>
2024-06-02 00:53:13 +01:00
Greenlamp2
060b1b2ccc
Menu - Controls Rebind - Gamepad & Keyboard (Cleaner git log) (#1666)
* squased merge rebind_menu

* azerty to qwerty

* add a check to preven a crash in firefox

* reset navigation menu on quit

* removed dual lock mekanism

* navigation display update icons on new bind

* added submit binding

* removed attribute no longer used

* change protected to abstract

* remove last bind protection since action and cancel are protected + renamed default controller to controller

* removed default alt qwerty keys in config

* fix some errors for doc

* fix tests

* fix some more errors for docs

* fix some more errors for docs final ?

* added alt bind for menu navigation + update icons on delete/home
2024-06-01 13:56:32 +01:00
flx-sta
48f2ecf39a
tests: add mock for FontFace and it to vitest setup (#1591) 2024-05-30 04:44:36 +01:00
Greenlamp2
b170478119
fix conflict without rebase (#1186) 2024-05-25 21:36:09 -04:00
Greenlamp2
c1a7df913a
refactor executed code while importing and initializing all of these in loading-scene (#1125) 2024-05-24 13:46:30 -04:00
Greenlamp2
622885767d
Enforce Consistent Spacing with ESLint's space-before-blocks and keyword-spacing Rules (#1308)
* added rule no-trailing-spaces

* added rule space-before-block

* added rule keyword spacing
2024-05-23 19:19:20 -05:00
Greenlamp2
bac6c22973
ESLint - The Essential Linter and Formatter for JavaScript and TypeScript (#1224)
* eslint config + packages

* updated eslint config

* fix the issue eslint adding ;;;; at interfaces

* first round with eslint --fix .

* removed config for unused export

* Revert "first round with eslint --fix ."

This reverts commit 77a88e0895.

* removed config for camelCase

* for real this time, first round of eslint --fix .

* halfway to manual eslint fix

* eslint done

* added "how to setup" the hook to eslint --fix each new file before commit (if wanted)

* removed eslintrc config file duplicat

* fix human error + ignore build folder + merge overrides

* added curly brace style + eslint

* applied double quote linter rule

* added lefthook

* test precommit

* test precommit

* test precommit

* test precommit

* test precommit

* test precommit

* test precommit

* github action to run eslint

* added node_modules to ignore eslint

* different action for typescript

* no need for different glob (default src)

* node 20

* node 20

* removed no longer needed install file

* remove hooks part from README

* eslint fixes

---------

Co-authored-by: Frederico Santos <frederico.f.santos@tecnico.ulisboa.pt>
2024-05-23 11:03:10 -04:00
Greenlamp2
136afa6b00
Tests - Check if something is wrong with the variant's sprite (#1175)
* return a list of errors if something is wrong with the variant's sprite

* reformat

* added data in error message

* added read comfort + detection of missing json for existing variant

* fix an error of message display
2024-05-20 14:40:40 -05:00
Greenlamp2
d2e455cdad
Tests - Check if something is wrong with the variant's sprite (#1162)
* return a list of errors if something is wrong with the variant's sprite

* reformat
2024-05-20 07:31:16 -05:00
Devin Korb
53def01b51
Add unit testing support with vitest (#18)
* update loose files and add vitest

* update test scripts

* more support for vitest

* more test support

* update vscode settings
2024-03-30 20:47:47 -04:00