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

Introduced FORM_BATTLE form changes #2273

Merged
merged 7 commits into from
Sep 9, 2022

Conversation

LOuroboros
Copy link
Collaborator

Description

Form change mechanisms that activate at the beginning and end of a battle, for species such as Xerneas or Zacian.
Big thanks to Lunos from the Past who held the key to complete the fucking puzzle GOD DAMN IT.

Discord contact info

Lunos#4026

For species such as Xerneas and Zacian.
Comment on lines 581 to 585
SetMonData(&gPlayerParty[i], MON_DATA_SPECIES, &targetSpecies);
// Opponent's side
targetSpecies = GetFormChangeTargetSpecies(&gEnemyParty[i], FORM_BATTLE_BEGIN, 0);
if (targetSpecies != SPECIES_NONE)
SetMonData(&gEnemyParty[i], MON_DATA_SPECIES, &targetSpecies);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When setting species, you need to use CalculateMonStats, otherwise the stats stay from the previous form:
image image
Zacian should've had improved attack and speed but it isn't.

Comment on lines 9625 to 9639
if (!isSwitchingOut)
{
// Apply party-wide end-of-battle form changes
for (i = 0; i < PARTY_SIZE; i++)
{
// Player's side
targetSpecies = GetFormChangeTargetSpecies(&gPlayerParty[i], FORM_BATTLE_END, 0);
if (targetSpecies != SPECIES_NONE)
SetMonData(&gPlayerParty[i], MON_DATA_SPECIES, &targetSpecies);
// Opponent's side
targetSpecies = GetFormChangeTargetSpecies(&gEnemyParty[i], FORM_BATTLE_END, 0);
if (targetSpecies != SPECIES_NONE)
SetMonData(&gEnemyParty[i], MON_DATA_SPECIES, &targetSpecies);
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Putting this inside of UndoFormChange will force this change for all mon in both parties in all the places where it's not switching out, which is most of them. Eg: reverting Mimikyu in when a pokemon faints.
I think the correct approach is to get rid of UndoFormChange entirely, have a new macro that handles form change and use it where necessary.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's exactly what I wanted to do yesterday when I talked to you about a FORM_BATTLE_HIT 😅

@LOuroboros LOuroboros marked this pull request as draft September 3, 2022 13:09
-Removed the pointless param1 setting in sXerneasFormChangeTable
-Updated the descriptions of Behemoth Blade and Behemoth Bash
-Added a new parameter to the struct FormChange
-Allowed FORM_BATTLE_BEGIN and FORM_BATTLE_END to replace a move through a new function called "TryToSetBattleFormChangeMoves".
-Added missing calls to "CalculateMonStats".
-Renamed BoxPokemon pointer in GetFormChangeTargetSpeciesBoxMon for consistency's sake
-Optimized check inside UndoFormChange (even though the plan is to get rid of that func entirely.)

Special thanks to Blecoutre who fixed my TryToSetBattleFormChangeMoves function. It just wasn't working correctly at all.
@LOuroboros LOuroboros marked this pull request as ready for review September 6, 2022 13:46
@LOuroboros
Copy link
Collaborator Author

Thanks to blecoutre#8678, this is finally ready for re-review 👀

I also cherrypicked a commit authored by Eduardo at his request, that allows the form change arrays to have multiple form changes of a same method 👀

@AsparagusEduardo
Copy link
Collaborator

Now that we have a third param, can we fold FORM_ITEM_HOLD_ABILITY into FORM_ITEM_HOLD?

@LOuroboros
Copy link
Collaborator Author

Now that we have a third param, can we fold FORM_ITEM_HOLD_ABILITY into FORM_ITEM_HOLD?

That sounds like it'd make sense, I'll look into it later 👀

@LOuroboros
Copy link
Collaborator Author

I asked this inside the Discord server yesterday, but I may as well do it here instead so a proper conversation can be had.

Since I already fused FORM_ITEM_HOLD_ABILITY and FORM_ITEM_HOLD, should I do the same for FORM_ITEM_USE and FORM_ITEM_USE_TIME too? 👀

src/pokemon.c Outdated Show resolved Hide resolved
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.

2 participants