-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Legendary Mon Fusion Compatibility Added #2621
Conversation
Kyurem, Calyrex, and Necrozma Fusions have been implemented, however, the animation for the the process is incomplete, the party menu screen needs to be updated while the screen is whited out and it has proved beyond me right now. Smh
Handles cases for learning the fusion moves from the other fused mon and deleting the move when you unfuse (plus learning confusion (well a set choice in the data struct) if there are no moves left after deleting one)
If the main fusion came after the fused mon in the party order it would try to teach the move to the next member in the party
static void SpriteCB_FormChangeIconMosaic(struct Sprite *sprite); | ||
static void Task_TryItemUseUnfuseChange(u8 taskId); | ||
|
||
u8 IsFusionMon(u16 species) // Helps with control flow, probably not ideal |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I recommend a SpeciesInfo flag
u8 DoesMonHaveAnyMoves(struct Pokemon *mon) | ||
{ | ||
struct BoxPokemon *boxMon = &mon->box; | ||
u8 i; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
u32 i
void DeleteMove(struct Pokemon *mon, u16 move) | ||
{ | ||
struct BoxPokemon *boxMon = &mon->box; | ||
u8 i, j; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
u32
u16 i; | ||
struct Task *task = &gTasks[taskId]; | ||
u16 species = GetMonData(&gPlayerParty[gPartyMenu.slotId], MON_DATA_SPECIES); | ||
const struct Fusion *itemFusion = gFusionTablePointers[species]; | ||
|
||
PlaySE(SE_SELECT); | ||
switch(IsFusionMon(species)){ | ||
case FALSE: // Cancel if Not a Fuse Mon | ||
break; | ||
case UNFUSE_MON: | ||
if(task->fusionType == FUSE_MON) // Cancel if An already Fused Mon Is Chosen For The Second Fusion Mon | ||
break; | ||
if(gPlayerPartyCount == 6) | ||
{ | ||
gPartyMenuUseExitCallback = FALSE; | ||
DisplayPartyMenuMessage(gText_YourPartysFull, TRUE); | ||
ScheduleBgCopyTilemapToVram(2); | ||
task->func = taskFunc; | ||
return; | ||
} | ||
for (i = 0; itemFusion[i].targetSpecies1 != FORM_CHANGE_END; i++) // Loops through fusion table and checks if the mon can be unfused | ||
{ | ||
if(gPokemonStoragePtr->fusions[FusionStorageIndex(itemFusion[i].targetSpecies2)].level == 0) | ||
continue; | ||
if((itemFusion[i].itemId == gSpecialVar_ItemId) && (itemFusion[i].targetSpecies1 == species) | ||
&& (GetMonData(&gPokemonStoragePtr->fusions[FusionStorageIndex(itemFusion[i].targetSpecies2)], MON_DATA_SPECIES) == itemFusion[i].targetSpecies2)) | ||
{ | ||
task->fusionType = UNFUSE_MON; | ||
task->firstFusion = species; | ||
task->firstFusionSlot = gPartyMenu.slotId; | ||
task->fusionResult = itemFusion[i].fusingIntoMon; | ||
task->unfuseSecondMon = itemFusion[i].targetSpecies2; | ||
task->moveToLearn = itemFusion[i].fusionMove; | ||
task->forgetMove = itemFusion[i].unfuseForgetMove; | ||
TryItemUseFusionChange(taskId, taskFunc); | ||
return; | ||
} | ||
} | ||
break; | ||
case FUSE_MON: | ||
if(task->fusionType == FUSE_MON) // Cancel If Second Mon is Another First Fusion Mon | ||
break; | ||
for (i = 0; itemFusion[i].targetSpecies1 != FORM_CHANGE_END; i++) // Run through the Fusion table for each species and check if the item matches one of the entries | ||
{ | ||
if(itemFusion[i].itemId == gSpecialVar_ItemId) | ||
{ | ||
task->fusionType = FUSE_MON; | ||
task->firstFusion = species; | ||
task->firstFusionSlot = gPartyMenu.slotId; | ||
task->func = Task_HandleChooseMonInput; | ||
gPartyMenuUseExitCallback = FALSE; | ||
sPartyMenuInternal->exitCallback = NULL; | ||
PartyMenuRemoveWindow(&sPartyMenuInternal->windowId[0]); | ||
DisplayPartyMenuStdMessage(PARTY_MSG_CHOOSE_SECOND_FUSION); | ||
return; | ||
} | ||
} | ||
break; | ||
case SECOND_FUSE_MON: | ||
if(task->fusionType != FUSE_MON) // Cancel if Secondary Fusion Mon Chosen First | ||
break; | ||
if(gPokemonStoragePtr->fusions[FusionStorageIndex(species)].level != 0) | ||
break; | ||
for (i = 0; itemFusion[i].targetSpecies1 != FORM_CHANGE_END; i++) // run through fusion table and check if the fusion works | ||
{ | ||
if((itemFusion[i].itemId == gSpecialVar_ItemId) && (itemFusion[i].targetSpecies2 == species) && (itemFusion[i].targetSpecies1 == task->firstFusion)) | ||
{ | ||
task->fusionResult = itemFusion[i].fusingIntoMon; | ||
task->secondFusionSlot = gPartyMenu.slotId; | ||
task->moveToLearn = itemFusion[i].fusionMove; | ||
// Start Fusion | ||
TryItemUseFusionChange(taskId, taskFunc); | ||
return; | ||
} | ||
} | ||
break; | ||
} | ||
// No Effect Exit | ||
gPartyMenuUseExitCallback = FALSE; | ||
DisplayPartyMenuMessage(gText_WontHaveEffect, TRUE); | ||
ScheduleBgCopyTilemapToVram(2); | ||
task->func = taskFunc; | ||
return; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please fix all the syntax inconsistencies here?
Empty spaces between each if
or switch
and the opening parentheses, and in the case of the switch
, the curly bracket needs to go in the next line, not at the end of the same line.
[SPECIES_SPECTRIER] = sCalyrexFusionTable, | ||
[SPECIES_GLASTRIER] = sCalyrexFusionTable, | ||
#endif | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add an empty line at the end of the file.
{SPECIES_KYUREM, SPECIES_RESHIRAM, SPECIES_KYUREM_WHITE, ITEM_DNA_SPLICERS, 0, 0}, | ||
{SPECIES_KYUREM, SPECIES_ZEKROM, SPECIES_KYUREM_BLACK, ITEM_DNA_SPLICERS, 0, 0}, | ||
{SPECIES_KYUREM_BLACK, SPECIES_ZEKROM, SPECIES_KYUREM, ITEM_DNA_SPLICERS, 0, 0}, | ||
{SPECIES_KYUREM_WHITE, SPECIES_RESHIRAM, SPECIES_KYUREM, ITEM_DNA_SPLICERS, 0, 0}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unused parameters can be left out, as they'll default to 0 anyway.
Co-authored-by: LOuroboros <[email protected]>
Replaced by #3274 |
Kyurem, Calyrex, and Necrozma Fusions have been fully implemented according to what I have seen from the later Generation games. The Fusion can only be started with the main Legendary in the fusion who's stats stay, there can only be one fusion per item, and a few of the mons learn or forget a move after a fusion/unfusion. However, the animation for the process is incomplete, the party menu screen needs to be updated while the screen is whited out and it has proved beyond me right now. I am calling it for this feature from me. I left comments where the party menu updating should go in the Fusion Task.
I apologize to whoever has to read this and finish the final touches to the animation. I'm not a professional programmer, I studied math, soooo it's a little cursed I'm sure. I won't feel bad if it gets torn apart for optimization, I just wanted to contribute something.
Archie#5000