Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reimplemented Mimicry #2473

Merged
merged 7 commits into from
Jan 9, 2023
Merged

Reimplemented Mimicry #2473

merged 7 commits into from
Jan 9, 2023

Conversation

LOuroboros
Copy link
Collaborator

Description

About a year ago I implemented Mimicry, an ability that changes the user's type based on the active field terrain.
I can't say that I like some of the decisions I took, so I just removed it and reimplemented it.
As far as I tested, it's all working, but extra testing is always welcomed.
Closes #2472.

Discord contact info

Lunos#4026

@AsparagusEduardo AsparagusEduardo linked an issue Jan 1, 2023 that may be closed by this pull request
@ghoulslash
Copy link
Collaborator

This should be redone to be included in the ABILITYEFFECT_ON_TERRAIN case

@LOuroboros
Copy link
Collaborator Author

LOuroboros commented Jan 2, 2023

This should be redone to be included in the ABILITYEFFECT_ON_TERRAIN case

Working on it. It works for the most part, but the game freezes after BattleScript_MimicryActivates_End3 finishes executing, for some reason.

I've been looking at the code to see if I could figure out what's going on, but I can't really spot anything wrong per se 🤔

LOuroboros/pokeemerald@mimicry...LOuroboros:pokeemerald:mimicry_dev

Mimicry is now a proud member of ABILITYEFFECT_ON_TERRAIN.

Misc. changes:
-Ditched the dependency on and usage of gBattlerAttacker for the effects inside ABILITYEFFECT_ON_WEATHER and ABILITYEFFECT_ON_TERRAIN.
-Made Cmd_switchineffects activate ABILITYEFFECT_ON_TERRAIN to take into account overworld weather-induced field terrains.
-Updated the text strings printed by the battle scripts inside the aforementioned AbilityBattleEffects caseIDs.
-Removed constant label of unused VARIOUS_TRY_TO_APPLY_MIMICRY which I forgot about.
-Updated ChangeTypeBasedOnTerrain, partly as a result of the aforementioned changes but also for optimization purposes.
 -There was never a reason to establish an empty scope, or to use GET_MOVE_TYPE and the variables that complemented it.
-Removed case ABILITY_QUARK_DRIVE from AbilityBattleEffects' case ABILITYEFFECT_ON_SWITCHIN.
@LOuroboros
Copy link
Collaborator Author

Alright, solved the issue and made some extra changes involving the new ABILITYEFFECTs since it's all tied to Mimicry.

@LOuroboros LOuroboros mentioned this pull request Jan 3, 2023
src/battle_util.c Outdated Show resolved Hide resolved
src/battle_util.c Outdated Show resolved Hide resolved
src/battle_util.c Outdated Show resolved Hide resolved
src/battle_util.c Outdated Show resolved Hide resolved
-Removed unnecessary special handling of terrain-inducing overworld weather states from ChangeTypeBasedOnTerrain.
-Mimicry now activates normally for terrain-inducing overworld weather states.
-Weather abilities now activate normally when switchineffects is called, and at the beginning of a battle.
-Terrain abilities now activate normally at the beginning of a battle.
@LOuroboros
Copy link
Collaborator Author

Ready for another review 👀

src/battle_main.c Outdated Show resolved Hide resolved
src/battle_script_commands.c Outdated Show resolved Hide resolved
src/battle_util.c Outdated Show resolved Hide resolved
-Foolproofed the ability checks in ABILITYEFFECT_ON_WEATHER and ABILITYEFFECT_ON_TERRAIN
-Made BattleScript_OverworldWeatherStarts and BattleScript_OverworldTerrain call the battle scripts that handle weather form changes, weather abilities, terrain seeds and terrain abilities.
-Consequentially, I removed the activation for weather and terrain abilities that I added to TryDoEventsBeforeFirstTurn, and the activation of Protosynthesis in ABILITYEFFECT_ON_SWITCHIN.
-Added a weatherAbilityDone to prevent abilities that lack self-checks like Protosynthesis from getting stuck in a loop.
-Removed now pointless ABILITYEFFECT_WEATHER_FORM. I think Duke/Sneed69 added it to fix Castform's form change, but it no longer serves a purpose.
@LOuroboros
Copy link
Collaborator Author

Ready for another review 👀

src/battle_util.c Outdated Show resolved Hide resolved
@ghoulslash ghoulslash merged commit cc7c546 into rh-hideout:upcoming Jan 9, 2023
@LOuroboros LOuroboros deleted the mimicry branch January 9, 2023 17:56
@AsparagusEduardo AsparagusEduardo mentioned this pull request Feb 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Mimicry may be broken
2 participants