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

Add support for legendary fusion #3274

Merged
merged 34 commits into from
Nov 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
eaa4a91
Legendary Mon Fusion Evolution Compatibility Added
TeamAquasHideout Feb 1, 2023
e523845
Added Fusion Move Prompts
TeamAquasHideout Feb 1, 2023
f3232b5
Fix Bug With Fusion Mon Move Learning
TeamAquasHideout Feb 1, 2023
a344137
Apply suggestions from code review
AsparagusEduardo Mar 27, 2023
76342d7
Merge branch 'pr/2621' into fusion
kittenchilly Aug 31, 2023
91682f4
Fix build
kittenchilly Aug 31, 2023
f64114c
Fix fusion items being used up
kittenchilly Aug 31, 2023
7ad56f0
Merge remote-tracking branch 'upstream/upcoming' into fusion
kittenchilly Aug 31, 2023
8faff8a
Merge branch 'upcoming' into fusion
kittenchilly Sep 2, 2023
2e78420
Fixed animations
kittenchilly Sep 3, 2023
f39fe5f
RefreshPartyMenu
kittenchilly Sep 3, 2023
aa5e883
Merge remote-tracking branch 'upstream/upcoming' into fusion
kittenchilly Sep 4, 2023
1403a07
Merge branch 'upcoming' into fusion
kittenchilly Sep 4, 2023
0da5662
Merge branch 'upcoming' into fusion
kittenchilly Sep 7, 2023
3f0eaa0
Apply suggestions from code review
kittenchilly Sep 8, 2023
4027b48
Merge remote-tracking branch 'upstream/upcoming' into fusion
kittenchilly Sep 8, 2023
c297ce6
Apply suggestions
kittenchilly Sep 8, 2023
2c95c0f
Update form_change_tables.h
kittenchilly Sep 8, 2023
7bf6574
Merge branch 'upcoming' into fusion
kittenchilly Sep 10, 2023
0276af3
Merge remote-tracking branch 'upstream/upcoming' into fusion
kittenchilly Sep 11, 2023
1483f17
Fix animation and simplify fusion tables
kittenchilly Sep 12, 2023
d148bd8
Fix party full message
kittenchilly Sep 12, 2023
0c4f363
Remove trailing whitespaces
kittenchilly Sep 12, 2023
36f74e8
Merge remote-tracking branch 'upstream/upcoming' into fusion
kittenchilly Oct 2, 2023
144b6bd
Merge remote-tracking branch 'upstream/upcoming' into fusion
kittenchilly Oct 7, 2023
2ef3457
Merge remote-tracking branch 'upstream/upcoming' into fusion
kittenchilly Oct 16, 2023
2a94ecb
Update party_menu.c
kittenchilly Oct 18, 2023
9aa95a4
Merge branch 'upcoming' into fusion
kittenchilly Oct 23, 2023
59b375c
Merge branch 'upcoming' into fusion
kittenchilly Oct 31, 2023
a0ce9e3
Merge branch 'upcoming' into fusion
kittenchilly Nov 13, 2023
99c7d23
Update party_menu.c
kittenchilly Nov 13, 2023
05dbc8f
Make IsFusionMon better
kittenchilly Nov 13, 2023
4b8c1cc
Apply suggestions from code review
kittenchilly Nov 23, 2023
37051ea
Merge branch 'upcoming' into fusion
kittenchilly Nov 23, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions include/constants/form_change_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#define DAY 1
#define NIGHT 2

#define FUSION_TERMINATOR 0xFF
#define FORM_CHANGE_TERMINATOR 0

// Form change that activates when the specified item is given to or taken from the selected Pokémon.
Expand Down
1 change: 1 addition & 0 deletions include/constants/party_menu.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@
#define PARTY_MSG_DO_WHAT_WITH_MAIL 25
#define PARTY_MSG_ALREADY_HOLDING_ONE 26
#define PARTY_MSG_WHICH_APPLIANCE 27
#define PARTY_MSG_CHOOSE_SECOND_FUSION 28
#define PARTY_MSG_NONE 127

// IDs for DisplayPartyPokemonDescriptionText, to display a message in the party pokemon's box
Expand Down
1 change: 1 addition & 0 deletions include/item_use.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ void ItemUseOutOfBattle_FormChange(u8);
void ItemUseOutOfBattle_FormChange_ConsumedOnUse(u8);
void ItemUseOutOfBattle_RotomCatalog(u8);
void ItemUseOutOfBattle_ZygardeCube(u8);
void ItemUseOutOfBattle_Fusion(u8);
void ItemUseOutOfBattle_Honey(u8);
void ItemUseOutOfBattle_CannotUse(u8);
void ItemUseOutOfBattle_ExpShare(u8);
Expand Down
1 change: 1 addition & 0 deletions include/party_menu.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ void ItemUseCB_FormChange(u8 taskId, TaskFunc task);
void ItemUseCB_FormChange_ConsumedOnUse(u8 taskId, TaskFunc task);
void ItemUseCB_RotomCatalog(u8 taskId, TaskFunc task);
void ItemUseCB_ZygardeCube(u8 taskId, TaskFunc task);
void ItemUseCB_Fusion(u8 taskId, TaskFunc task);
const u8* GetItemEffect(u16 item);
u8 GetItemEffectType(u16 item);
void CB2_PartyMenuFromStartMenu(void);
Expand Down
13 changes: 13 additions & 0 deletions include/pokemon.h
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,19 @@ struct FormChange
u16 param3;
};

struct Fusion
{
u16 fusionStorageIndex;
u16 itemId;
u16 targetSpecies1;
u16 targetSpecies2;
u16 fusingIntoMon;
u16 fusionMove;
u16 unfuseForgetMove;
};

extern const struct Fusion *const gFusionTablePointers[NUM_SPECIES];

#define NUM_UNOWN_FORMS 28

#define GET_UNOWN_LETTER(personality) (( \
Expand Down
2 changes: 2 additions & 0 deletions include/pokemon_storage_system.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#define IN_BOX_COLUMNS 6 // Number of columns, 5 Pokémon per column
#define IN_BOX_COUNT (IN_BOX_ROWS * IN_BOX_COLUMNS)
#define BOX_NAME_LENGTH 8
#define MAX_FUSION_STORAGE 4

/*
COLUMNS
Expand All @@ -22,6 +23,7 @@ struct PokemonStorage
/*0x0001*/ struct BoxPokemon boxes[TOTAL_BOXES_COUNT][IN_BOX_COUNT];
/*0x8344*/ u8 boxNames[TOTAL_BOXES_COUNT][BOX_NAME_LENGTH + 1];
/*0x83C2*/ u8 boxWallpapers[TOTAL_BOXES_COUNT];
/*0x8432*/ struct Pokemon fusions[MAX_FUSION_STORAGE];
};

extern struct PokemonStorage *gPokemonStoragePtr;
Expand Down
1 change: 1 addition & 0 deletions include/strings.h
Original file line number Diff line number Diff line change
Expand Up @@ -944,6 +944,7 @@ extern const u8 gText_UsedVar2WildLured[];
extern const u8 gText_UsedVar2WildRepelled[];
extern const u8 gText_BoxFull[];
extern const u8 gText_WontHaveEffect[];
extern const u8 gText_NextFusionMon[];

extern const u8 gText_LevelSymbol[];
extern const u8 gText_PkmnInfo[];
Expand Down
23 changes: 15 additions & 8 deletions src/data/items.h
Original file line number Diff line number Diff line change
Expand Up @@ -8502,6 +8502,7 @@ const struct Item gItems[] =
{
.name = _("Gracidea"),
.price = 0,
.importance = 1,
.description = sGracideaDesc,
.pocket = POCKET_KEY_ITEMS,
.type = ITEM_USE_PARTY_MENU,
Expand All @@ -8512,6 +8513,7 @@ const struct Item gItems[] =
{
.name = _("Reveal Glass"),
.price = 0,
.importance = 1,
.description = sRevealGlassDesc,
.pocket = POCKET_KEY_ITEMS,
.type = ITEM_USE_PARTY_MENU,
Expand All @@ -8522,10 +8524,11 @@ const struct Item gItems[] =
{
.name = _("DNA Splicers"),
.price = 0,
.importance = 1,
.description = sDNASplicersDesc,
.pocket = POCKET_KEY_ITEMS,
.type = ITEM_USE_BAG_MENU,
.fieldUseFunc = ItemUseOutOfBattle_CannotUse, // Todo: ItemUseOutOfBattle_FormChange_Fusion
.type = ITEM_USE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_Fusion,
},

[ITEM_ZYGARDE_CUBE] =
Expand All @@ -8543,6 +8546,7 @@ const struct Item gItems[] =
{
.name = _("Prison Bottle"),
.price = 0,
.importance = 1,
.description = sPrisonBottleDesc,
.pocket = POCKET_KEY_ITEMS,
.type = ITEM_USE_PARTY_MENU,
Expand All @@ -8553,30 +8557,33 @@ const struct Item gItems[] =
{
.name = _("N-Solarizer"),
.price = 0,
.importance = 1,
.description = sNSolarizerDesc,
.pocket = POCKET_KEY_ITEMS,
.type = ITEM_USE_BAG_MENU,
.fieldUseFunc = ItemUseOutOfBattle_CannotUse, // Todo: ItemUseOutOfBattle_FormChange_Fusion
.type = ITEM_USE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_Fusion,
},

[ITEM_N_LUNARIZER] =
{
.name = _("N-Lunarizer"),
.price = 0,
.importance = 1,
.description = sNLunarizerDesc,
.pocket = POCKET_KEY_ITEMS,
.type = ITEM_USE_BAG_MENU,
.fieldUseFunc = ItemUseOutOfBattle_CannotUse, // Todo: ItemUseOutOfBattle_FormChange_Fusion
.type = ITEM_USE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_Fusion,
},

[ITEM_REINS_OF_UNITY] =
{
.name = _("ReinsOfUnity"),
.price = 0,
.importance = 1,
.description = sReinsOfUnityDesc,
.pocket = POCKET_KEY_ITEMS,
.type = ITEM_USE_BAG_MENU,
.fieldUseFunc = ItemUseOutOfBattle_CannotUse, // Todo: ItemUseOutOfBattle_FormChange_Fusion
.type = ITEM_USE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_Fusion,
},

// Battle Mechanic Key Items
Expand Down
1 change: 1 addition & 0 deletions src/data/party_menu.h
Original file line number Diff line number Diff line change
Expand Up @@ -658,6 +658,7 @@ static const u8 *const sActionStringTable[] =
[PARTY_MSG_DO_WHAT_WITH_MAIL] = gText_DoWhatWithMail,
[PARTY_MSG_ALREADY_HOLDING_ONE] = gText_AlreadyHoldingOne,
[PARTY_MSG_WHICH_APPLIANCE] = gText_WhichAppliance,
[PARTY_MSG_CHOOSE_SECOND_FUSION] = gText_NextFusionMon,
};

static const u8 *const sDescriptionStringTable[] =
Expand Down
25 changes: 25 additions & 0 deletions src/data/pokemon/form_change_table_pointers.h
Original file line number Diff line number Diff line change
Expand Up @@ -375,3 +375,28 @@ const struct FormChange *const gFormChangeTablePointers[NUM_SPECIES] =
[SPECIES_OGERPON_CORNERSTONE_MASK_TERA] = sOgerponFormChangeTable,
#endif
};

const struct Fusion *const gFusionTablePointers[NUM_SPECIES] =
{
#if P_GEN_5_POKEMON == TRUE
[SPECIES_KYUREM] = sKyuremFusionTable,
[SPECIES_KYUREM_BLACK] = sKyuremFusionTable,
[SPECIES_KYUREM_WHITE] = sKyuremFusionTable,
[SPECIES_RESHIRAM] = sKyuremFusionTable,
[SPECIES_ZEKROM] = sKyuremFusionTable,
#endif
#if P_GEN_7_POKEMON == TRUE
[SPECIES_NECROZMA] = sNecrozmaFusionTable,
[SPECIES_NECROZMA_DAWN_WINGS] = sNecrozmaFusionTable,
[SPECIES_NECROZMA_DUSK_MANE] = sNecrozmaFusionTable,
[SPECIES_SOLGALEO] = sNecrozmaFusionTable,
[SPECIES_LUNALA] = sNecrozmaFusionTable,
#endif
#if P_GEN_8_POKEMON == TRUE
[SPECIES_CALYREX] = sCalyrexFusionTable,
[SPECIES_CALYREX_ICE_RIDER] = sCalyrexFusionTable,
[SPECIES_CALYREX_SHADOW_RIDER] = sCalyrexFusionTable,
[SPECIES_SPECTRIER] = sCalyrexFusionTable,
[SPECIES_GLASTRIER] = sCalyrexFusionTable,
#endif
};
19 changes: 19 additions & 0 deletions src/data/pokemon/form_change_tables.h
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,12 @@ static const struct FormChange sLandorusFormChangeTable[] = {
{FORM_CHANGE_TERMINATOR},
};

static const struct Fusion sKyuremFusionTable[] = {
{0, ITEM_DNA_SPLICERS, SPECIES_KYUREM, SPECIES_RESHIRAM, SPECIES_KYUREM_WHITE},
{0, ITEM_DNA_SPLICERS, SPECIES_KYUREM, SPECIES_ZEKROM, SPECIES_KYUREM_BLACK},
{FUSION_TERMINATOR},
};

static const struct FormChange sKeldeoFormChangeTable[] = {
{FORM_CHANGE_MOVE, SPECIES_KELDEO_RESOLUTE, MOVE_SECRET_SWORD, WHEN_LEARNED},
{FORM_CHANGE_MOVE, SPECIES_KELDEO_ORDINARY, MOVE_SECRET_SWORD, WHEN_FORGOTTEN},
Expand Down Expand Up @@ -588,6 +594,13 @@ static const struct FormChange sMiniorYellowFormChangeTable[] = {
{FORM_CHANGE_END_BATTLE, SPECIES_MINIOR_CORE_YELLOW},
{FORM_CHANGE_TERMINATOR},
};

static const struct Fusion sNecrozmaFusionTable[] = {
{1, ITEM_N_SOLARIZER, SPECIES_NECROZMA, SPECIES_SOLGALEO, SPECIES_NECROZMA_DUSK_MANE, MOVE_SUNSTEEL_STRIKE, MOVE_CONFUSION},
{2, ITEM_N_LUNARIZER, SPECIES_NECROZMA, SPECIES_LUNALA, SPECIES_NECROZMA_DAWN_WINGS, MOVE_MOONGEIST_BEAM, MOVE_CONFUSION},
{FUSION_TERMINATOR},
};

static const struct FormChange sNecrozmaDuskManeFormChangeTable[] = {
{FORM_CHANGE_BATTLE_ULTRA_BURST, SPECIES_NECROZMA_ULTRA, ITEM_ULTRANECROZIUM_Z},
{FORM_CHANGE_TERMINATOR},
Expand Down Expand Up @@ -635,6 +648,12 @@ static const struct FormChange sZamazentaFormChangeTable[] = {
{FORM_CHANGE_TERMINATOR},
};

static const struct Fusion sCalyrexFusionTable[] = {
{3, ITEM_REINS_OF_UNITY, SPECIES_CALYREX, SPECIES_GLASTRIER, SPECIES_CALYREX_ICE_RIDER, MOVE_GLACIAL_LANCE, MOVE_CONFUSION},
{3, ITEM_REINS_OF_UNITY, SPECIES_CALYREX, SPECIES_SPECTRIER, SPECIES_CALYREX_SHADOW_RIDER, MOVE_ASTRAL_BARRAGE, MOVE_CONFUSION},
{FUSION_TERMINATOR},
};

static const struct FormChange sEnamorusFormChangeTable[] = {
{FORM_CHANGE_ITEM_USE, SPECIES_ENAMORUS_INCARNATE, ITEM_REVEAL_GLASS},
{FORM_CHANGE_ITEM_USE, SPECIES_ENAMORUS_THERIAN, ITEM_REVEAL_GLASS},
Expand Down
7 changes: 7 additions & 0 deletions src/item_use.c
Original file line number Diff line number Diff line change
Expand Up @@ -1344,6 +1344,13 @@ void ItemUseOutOfBattle_ZygardeCube(u8 taskId)
}
}

void ItemUseOutOfBattle_Fusion(u8 taskId)
{
gItemUseCB = ItemUseCB_Fusion;
gTasks[taskId].data[0] = FALSE;
SetUpItemUseCallback(taskId);
}

void Task_UseHoneyOnField(u8 taskId)
{
//ResetInitialPlayerAvatarState();
Expand Down
Loading
Loading