[Bug] Prevent evolution causing a swap from the second ability to the HA #3138
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What are the changes?
If a Pokémon with their second ability evolves, it will swap to its first ability if the evolution has no second ability, instead of improperly "upgrading" to its hidden ability.
Why am I doing these changes?
I noticed a bug report about the issue
https://discord.com/channels/1125469663833370665/1254274565627187211
cf Bulbapedia
What did change?
src/data/pokemon-species.ts
: If a Pokémon doesn't have a second ability, its second ability is set to be the same as its first ability.The
PlayerPokemon.evolve()
function is updated to account for Pokémon with 3 abilities evolving into a Pokémon with 2 abilities, including an added parameterpreEvolution: PokemonSpeciesForm
. Each instance of the function being called is updated accordingly.Tests were added for the
evolve()
function.The starter select UI was updated to account for the duplicated abilities.
Screenshots/Videos
ui.test.mp4
How to test the changes?
Start a run with an Eevee with Adaptability (its second ability) and evolve it with a Fire/Water/Thunder stone. It should now have its first ability (Flash Fire/Water Absorb/Volt Absorb) rather than its hidden ability (Guts/Hydration/Quick Feet).
Checklist
npm run test
)