diff --git a/include/pokemon.h b/include/pokemon.h index 6c3df51a75..ac753301ea 100644 --- a/include/pokemon.h +++ b/include/pokemon.h @@ -385,7 +385,7 @@ struct SpeciesInfo /*0x8C*/ u32 isUltraBeast:1; u32 isParadoxForm:1; u32 isMegaEvolution:1; - u32 isPrimalRevesion:1; + u32 isPrimalReversion:1; u32 isUltraBurst:1; u32 isGigantamax:1; u32 isAlolanForm:1; @@ -396,11 +396,11 @@ struct SpeciesInfo /*0x8C*/ u32 allPerfectIVs:1; u32 padding4:18; // Move Data - /* 0x80 */ const struct LevelUpMove *const levelUpLearnset; - /* 0x84 */ const u16 *const teachableLearnset; - /* 0x88 */ const struct Evolution *const evolutions; - /* 0x84 */ const u16 *const formSpeciesIdTable; - /* 0x84 */ const struct FormChange *const formChangeTable; + /* 0x80 */ const struct LevelUpMove *levelUpLearnset; + /* 0x84 */ const u16 *teachableLearnset; + /* 0x88 */ const struct Evolution *evolutions; + /* 0x84 */ const u16 *formSpeciesIdTable; + /* 0x84 */ const struct FormChange *formChangeTable; }; struct BattleMove diff --git a/src/battle_util.c b/src/battle_util.c index 182e1fc302..237b43e34e 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -10395,7 +10395,7 @@ bool32 IsBattlerPrimalReverted(u32 battler) // While Transform does copy stats and visuals, it shouldn't be counted as true Primal Revesion. if (gBattleMons[battler].status2 & STATUS2_TRANSFORMED) return FALSE; - return (gSpeciesInfo[gBattleMons[battler].species].isPrimalRevesion); + return (gSpeciesInfo[gBattleMons[battler].species].isPrimalReversion); } bool32 IsBattlerUltraBursted(u32 battler) diff --git a/src/data/pokemon/form_change_tables.h b/src/data/pokemon/form_change_tables.h index d467b17316..d86ff4ea90 100644 --- a/src/data/pokemon/form_change_tables.h +++ b/src/data/pokemon/form_change_tables.h @@ -829,12 +829,15 @@ static const struct FormChange sNecrozmaDawnWingsFormChangeTable[] = { {FORM_CHANGE_BATTLE_ULTRA_BURST, SPECIES_NECROZMA_ULTRA, ITEM_ULTRANECROZIUM_Z}, {FORM_CHANGE_TERMINATOR}, }; +#endif //P_FAMILY_NECROZMA + +#if P_FAMILY_MELTAN static const struct FormChange sMelmetalFormChangeTable[] = { {FORM_CHANGE_BATTLE_GIGANTAMAX, SPECIES_MELMETAL_GIGANTAMAX}, {FORM_CHANGE_TERMINATOR}, }; -#endif //P_FAMILY_NECROZMA +#endif //P_FAMILY_MELTAN #if P_FAMILY_GROOKEY static const struct FormChange sRillaboomFormChangeTable[] = diff --git a/src/data/pokemon/form_species_tables.h b/src/data/pokemon/form_species_tables.h index 94fa38c1bb..b9d2631739 100644 --- a/src/data/pokemon/form_species_tables.h +++ b/src/data/pokemon/form_species_tables.h @@ -1751,3 +1751,13 @@ static const u16 sGimmighoulFormSpeciesIdTable[] = { FORM_SPECIES_END, }; #endif //P_FAMILY_GIMMIGHOUL + +#if P_FAMILY_OGERPON +static const u16 sOgerponFormSpeciesIdTable[] = { + SPECIES_OGERPON_TEAL_MASK, + SPECIES_OGERPON_WELLSPRING_MASK, + SPECIES_OGERPON_HEARTHFLAME_MASK, + SPECIES_OGERPON_CORNERSTONE_MASK, + FORM_SPECIES_END, +}; +#endif //P_FAMILY_OGERPON diff --git a/src/data/pokemon/species_info.h b/src/data/pokemon/species_info.h index 8468d7669c..6f36f2ce83 100644 --- a/src/data/pokemon/species_info.h +++ b/src/data/pokemon/species_info.h @@ -25988,7 +25988,7 @@ const struct SpeciesInfo gSpeciesInfo[] = .backAnimId = BACK_ANIM_SHAKE_GLOW_BLUE, PALETTES(KyogrePrimal), ICON(KyogrePrimal, 0), - .isPrimalRevesion = TRUE, + .isPrimalReversion = TRUE, }, #endif //P_PRIMAL_REVERSIONS #endif //P_FAMILY_KYOGRE @@ -26080,7 +26080,7 @@ const struct SpeciesInfo gSpeciesInfo[] = .backAnimId = BACK_ANIM_SHAKE_GLOW_RED, PALETTES(GroudonPrimal), ICON(GroudonPrimal, 0), - .isPrimalRevesion = TRUE, + .isPrimalReversion = TRUE, }, #endif //P_PRIMAL_REVERSIONS #endif //P_FAMILY_GROUDON @@ -48783,6 +48783,7 @@ const struct SpeciesInfo gSpeciesInfo[] = .trainerOffset = 8, \ .footprint = gMonFootprint_Melmetal, \ LEARNSETS(Melmetal), \ + .formSpeciesIdTable = sMelmetalFormSpeciesIdTable, \ .formChangeTable = sMelmetalFormChangeTable, \ .isMythical = TRUE @@ -48948,6 +48949,7 @@ const struct SpeciesInfo gSpeciesInfo[] = .categoryName = _("Drummer"), \ .footprint = gMonFootprint_Rillaboom, \ LEARNSETS(Rillaboom), \ + .formSpeciesIdTable = sRillaboomFormSpeciesIdTable, \ .formChangeTable = sRillaboomFormChangeTable [SPECIES_RILLABOOM] = @@ -48995,7 +48997,6 @@ const struct SpeciesInfo gSpeciesInfo[] = //.backAnimId = BACK_ANIM_NONE, PALETTES(RillaboomGigantamax), ICON(RillaboomGigantamax, 1), - .formSpeciesIdTable = sRillaboomFormSpeciesIdTable, .isGigantamax = TRUE, }, #endif //P_GIGANTAMAX_FORMS @@ -49121,6 +49122,7 @@ const struct SpeciesInfo gSpeciesInfo[] = .categoryName = _("Striker"), \ .footprint = gMonFootprint_Cinderace, \ LEARNSETS(Cinderace), \ + .formSpeciesIdTable = sCinderaceFormSpeciesIdTable, \ .formChangeTable = sCinderaceFormChangeTable [SPECIES_CINDERACE] = @@ -49169,7 +49171,6 @@ const struct SpeciesInfo gSpeciesInfo[] = //.backAnimId = BACK_ANIM_NONE, PALETTES(CinderaceGigantamax), ICON(CinderaceGigantamax, 0), - .formSpeciesIdTable = sCinderaceFormSpeciesIdTable, .isGigantamax = TRUE, }, #endif //P_GIGANTAMAX_FORMS @@ -49296,6 +49297,7 @@ const struct SpeciesInfo gSpeciesInfo[] = .categoryName = _("Secret Agent"), \ .footprint = gMonFootprint_Inteleon, \ LEARNSETS(Inteleon), \ + .formSpeciesIdTable = sInteleonFormSpeciesIdTable, \ .formChangeTable = sInteleonFormChangeTable [SPECIES_INTELEON] = @@ -49569,6 +49571,7 @@ const struct SpeciesInfo gSpeciesInfo[] = .categoryName = _("Raven"), \ .footprint = gMonFootprint_Corviknight, \ LEARNSETS(Corviknight), \ + .formSpeciesIdTable = sCorviknightFormSpeciesIdTable, \ .formChangeTable = sCorviknightFormChangeTable [SPECIES_CORVIKNIGHT] = @@ -49617,7 +49620,6 @@ const struct SpeciesInfo gSpeciesInfo[] = //.backAnimId = BACK_ANIM_NONE, PALETTES(CorviknightGigantamax), ICON(CorviknightGigantamax, 0), - .formSpeciesIdTable = sCorviknightFormSpeciesIdTable, .isGigantamax = TRUE, }, #endif //P_GIGANTAMAX_FORMS @@ -49745,6 +49747,7 @@ const struct SpeciesInfo gSpeciesInfo[] = .categoryName = _("Seven Spot"), \ .footprint = gMonFootprint_Orbeetle, \ LEARNSETS(Orbeetle), \ + .formSpeciesIdTable = sOrbeetleFormSpeciesIdTable, \ .formChangeTable = sOrbeetleFormChangeTable [SPECIES_ORBEETLE] = @@ -49794,7 +49797,6 @@ const struct SpeciesInfo gSpeciesInfo[] = //.backAnimId = BACK_ANIM_NONE, PALETTES(OrbeetleGigantamax), ICON(OrbeetleGigantamax, 0), - .formSpeciesIdTable = sOrbeetleFormSpeciesIdTable, .isGigantamax = TRUE, }, #endif //P_GIGANTAMAX_FORMS @@ -50163,6 +50165,7 @@ const struct SpeciesInfo gSpeciesInfo[] = .categoryName = _("Bite"), \ .footprint = gMonFootprint_Drednaw, \ LEARNSETS(Drednaw), \ + .formSpeciesIdTable = sDrednawFormSpeciesIdTable, \ .formChangeTable = sDrednawFormChangeTable [SPECIES_DREDNAW] = @@ -50210,7 +50213,6 @@ const struct SpeciesInfo gSpeciesInfo[] = //.backAnimId = BACK_ANIM_NONE, PALETTES(DrednawGigantamax), ICON(DrednawGigantamax, 0), - .formSpeciesIdTable = sDrednawFormSpeciesIdTable, .isGigantamax = TRUE, }, #endif //P_GIGANTAMAX_FORMS @@ -50433,6 +50435,7 @@ const struct SpeciesInfo gSpeciesInfo[] = .categoryName = _("Coal"), \ .footprint = gMonFootprint_Coalossal, \ LEARNSETS(Coalossal), \ + .formSpeciesIdTable = sCoalossalFormSpeciesIdTable, \ .formChangeTable = sCoalossalFormChangeTable [SPECIES_COALOSSAL] = @@ -50481,7 +50484,6 @@ const struct SpeciesInfo gSpeciesInfo[] = //.backAnimId = BACK_ANIM_NONE, PALETTES(CoalossalGigantamax), ICON(CoalossalGigantamax, 0), - .formSpeciesIdTable = sCoalossalFormSpeciesIdTable, .isGigantamax = TRUE, }, #endif //P_GIGANTAMAX_FORMS @@ -50562,6 +50564,7 @@ const struct SpeciesInfo gSpeciesInfo[] = .categoryName = _("Apple Wing"), \ .footprint = gMonFootprint_Flapple, \ LEARNSETS(Flapple), \ + .formSpeciesIdTable = sFlappleFormSpeciesIdTable, \ .formChangeTable = sFlappleFormChangeTable [SPECIES_FLAPPLE] = @@ -50610,7 +50613,6 @@ const struct SpeciesInfo gSpeciesInfo[] = //.backAnimId = BACK_ANIM_NONE, PALETTES(FlappleGigantamax), ICON(FlappleGigantamax, 1), - .formSpeciesIdTable = sFlappleFormSpeciesIdTable, .isGigantamax = TRUE, }, #endif //P_GIGANTAMAX_FORMS @@ -50639,6 +50641,7 @@ const struct SpeciesInfo gSpeciesInfo[] = .categoryName = _("Apple Nectar"), \ .footprint = gMonFootprint_Appletun, \ LEARNSETS(Appletun), \ + .formSpeciesIdTable = sAppletunFormSpeciesIdTable, \ .formChangeTable = sAppletunFormChangeTable [SPECIES_APPLETUN] = @@ -50686,7 +50689,6 @@ const struct SpeciesInfo gSpeciesInfo[] = //.backAnimId = BACK_ANIM_NONE, PALETTES(AppletunGigantamax), ICON(AppletunGigantamax, 1), - .formSpeciesIdTable = sAppletunFormSpeciesIdTable, .isGigantamax = TRUE, }, #endif //P_GIGANTAMAX_FORMS @@ -50812,6 +50814,7 @@ const struct SpeciesInfo gSpeciesInfo[] = .categoryName = _("Sand Snake"), \ .footprint = gMonFootprint_Sandaconda, \ LEARNSETS(Sandaconda), \ + .formSpeciesIdTable = sSandacondaFormSpeciesIdTable, \ .formChangeTable = sSandacondaFormChangeTable [SPECIES_SANDACONDA] = @@ -50861,7 +50864,6 @@ const struct SpeciesInfo gSpeciesInfo[] = //.backAnimId = BACK_ANIM_NONE, PALETTES(SandacondaGigantamax), ICON(SandacondaGigantamax, 1), - .formSpeciesIdTable = sSandacondaFormSpeciesIdTable, .isGigantamax = TRUE, }, #endif //P_GIGANTAMAX_FORMS @@ -51307,6 +51309,7 @@ const struct SpeciesInfo gSpeciesInfo[] = .categoryName = _("Radiator"), \ .footprint = gMonFootprint_Centiskorch, \ LEARNSETS(Centiskorch), \ + .formSpeciesIdTable = sCentiskorchFormSpeciesIdTable, \ .formChangeTable = sCentiskorchFormChangeTable [SPECIES_CENTISKORCH] = @@ -51355,7 +51358,6 @@ const struct SpeciesInfo gSpeciesInfo[] = //.backAnimId = BACK_ANIM_NONE, PALETTES(CentiskorchGigantamax), ICON(CentiskorchGigantamax, 0), - .formSpeciesIdTable = sCentiskorchFormSpeciesIdTable, .isGigantamax = TRUE, }, #endif //P_GIGANTAMAX_FORMS @@ -51699,6 +51701,7 @@ const struct SpeciesInfo gSpeciesInfo[] = .categoryName = _("Silent"), \ .footprint = gMonFootprint_Hatterene, \ LEARNSETS(Hatterene), \ + .formSpeciesIdTable = sHattereneFormSpeciesIdTable, \ .formChangeTable = sHattereneFormChangeTable [SPECIES_HATTERENE] = @@ -51746,7 +51749,6 @@ const struct SpeciesInfo gSpeciesInfo[] = //.backAnimId = BACK_ANIM_NONE, PALETTES(HattereneGigantamax), ICON(HattereneGigantamax, 0), - .formSpeciesIdTable = sHattereneFormSpeciesIdTable, .isGigantamax = TRUE, }, #endif //P_GIGANTAMAX_FORMS @@ -51873,6 +51875,7 @@ const struct SpeciesInfo gSpeciesInfo[] = .categoryName = _("Bulk Up"), \ .footprint = gMonFootprint_Grimmsnarl, \ LEARNSETS(Grimmsnarl), \ + .formSpeciesIdTable = sGrimmsnarlFormSpeciesIdTable, \ .formChangeTable = sGrimmsnarlFormChangeTable [SPECIES_GRIMMSNARL] = @@ -51920,7 +51923,6 @@ const struct SpeciesInfo gSpeciesInfo[] = //.backAnimId = BACK_ANIM_NONE, PALETTES(GrimmsnarlGigantamax), ICON(GrimmsnarlGigantamax, 0), - .formSpeciesIdTable = sGrimmsnarlFormSpeciesIdTable, .isGigantamax = TRUE, }, #endif //P_GIGANTAMAX_FORMS @@ -52677,6 +52679,7 @@ const struct SpeciesInfo gSpeciesInfo[] = .categoryName = _("Copperderm"), \ .footprint = gMonFootprint_Copperajah, \ LEARNSETS(Copperajah), \ + .formSpeciesIdTable = sCopperajahFormSpeciesIdTable, \ .formChangeTable = sCopperajahFormChangeTable [SPECIES_COPPERAJAH] = @@ -52724,8 +52727,6 @@ const struct SpeciesInfo gSpeciesInfo[] = //.backAnimId = BACK_ANIM_NONE, PALETTES(CopperajahGigantamax), ICON(CopperajahGigantamax, 0), - .formSpeciesIdTable = sCopperajahFormSpeciesIdTable, - .isGigantamax = TRUE, }, #endif //P_GIGANTAMAX_FORMS @@ -52951,6 +52952,7 @@ const struct SpeciesInfo gSpeciesInfo[] = .categoryName = _("Alloy"), \ .footprint = gMonFootprint_Duraludon, \ LEARNSETS(Duraludon), \ + .formSpeciesIdTable = sDuraludonFormSpeciesIdTable, \ .formChangeTable = sDuraludonFormChangeTable [SPECIES_DURALUDON] = @@ -52998,7 +53000,6 @@ const struct SpeciesInfo gSpeciesInfo[] = //.backAnimId = BACK_ANIM_NONE, PALETTES(DuraludonGigantamax), ICON(DuraludonGigantamax, 0), - .formSpeciesIdTable = sDuraludonFormSpeciesIdTable, .isGigantamax = TRUE, }, #endif //P_GIGANTAMAX_FORMS @@ -59449,6 +59450,7 @@ const struct SpeciesInfo gSpeciesInfo[] = .palette = gMonPalette_Ogerpon##Form, \ ICON(OgerponTealMask, 1), \ LEARNSETS(Ogerpon), \ + .formSpeciesIdTable = sOgerponFormSpeciesIdTable, \ .formChangeTable = sOgerponFormChangeTable, \ .isLegendary = TRUE, \ } diff --git a/src/data/pokemon_graphics/front_pic_anims.h b/src/data/pokemon_graphics/front_pic_anims.h index 4a94aba808..92c8c7729c 100644 --- a/src/data/pokemon_graphics/front_pic_anims.h +++ b/src/data/pokemon_graphics/front_pic_anims.h @@ -9239,10 +9239,12 @@ static const union AnimCmd sAnim_Togedemaru_1[] = ANIMCMD_FRAME(0, 5), ANIMCMD_END, }; +#endif //P_FAMILY_TOGEDEMARU +#if P_FAMILY_MIMIKYU PLACEHOLDER_ANIM_SINGLE_FRAME(MimikyuDisguised); PLACEHOLDER_ANIM_SINGLE_FRAME(MimikyuBusted); -#endif //P_FAMILY_TOGEDEMARU +#endif //P_FAMILY_MIMIKYU #if P_FAMILY_BRUXISH PLACEHOLDER_ANIM_SINGLE_FRAME(Bruxish); diff --git a/test/species.c b/test/species.c new file mode 100644 index 0000000000..9ea20638c8 --- /dev/null +++ b/test/species.c @@ -0,0 +1,78 @@ +#include "global.h" +#include "test/test.h" +#include "constants/form_change_types.h" + +TEST("Form species ID tables are shared between all forms") +{ + u32 i; + u32 species = SPECIES_NONE; + for (i = 0; i < NUM_SPECIES; i++) + { + if (gSpeciesInfo[i].formSpeciesIdTable) PARAMETRIZE { species = i; } + } + + const u16 *formSpeciesIdTable = gSpeciesInfo[species].formSpeciesIdTable; + for (i = 0; formSpeciesIdTable[i] != FORM_SPECIES_END; i++) + { + u32 formSpeciesId = formSpeciesIdTable[i]; + EXPECT_EQ(gSpeciesInfo[formSpeciesId].formSpeciesIdTable, formSpeciesIdTable); + } +} + +TEST("Form change tables contain only forms in the form species ID table") +{ + u32 i, j; + u32 species = SPECIES_NONE; + for (i = 0; i < NUM_SPECIES; i++) + { + if (gSpeciesInfo[i].formChangeTable) PARAMETRIZE { species = i; } + } + + const struct FormChange *formChangeTable = gSpeciesInfo[species].formChangeTable; + const u16 *formSpeciesIdTable = gSpeciesInfo[species].formSpeciesIdTable; + EXPECT(formSpeciesIdTable); + + for (i = 0; formChangeTable[i].method != FORM_CHANGE_TERMINATOR; i++) + { + for (j = 0; formSpeciesIdTable[j] != FORM_SPECIES_END; j++) + { + if (formChangeTable[i].targetSpecies == formSpeciesIdTable[j]) + { + break; + } + } + EXPECT(formSpeciesIdTable[j] != FORM_SPECIES_END); + } +} + +TEST("Form change targets have the appropriate species flags") +{ + u32 i; + u32 species = SPECIES_NONE; + for (i = 0; i < NUM_SPECIES; i++) + { + if (gSpeciesInfo[i].formChangeTable) PARAMETRIZE { species = i; } + } + + const struct FormChange *formChangeTable = gSpeciesInfo[species].formChangeTable; + for (i = 0; formChangeTable[i].method != FORM_CHANGE_TERMINATOR; i++) + { + const struct SpeciesInfo *targetSpeciesInfo = &gSpeciesInfo[formChangeTable[i].targetSpecies]; + switch (formChangeTable[i].method) + { + case FORM_CHANGE_BATTLE_MEGA_EVOLUTION_ITEM: + case FORM_CHANGE_BATTLE_MEGA_EVOLUTION_MOVE: + EXPECT(targetSpeciesInfo->isMegaEvolution); + break; + case FORM_CHANGE_BATTLE_PRIMAL_REVERSION: + EXPECT(targetSpeciesInfo->isPrimalReversion); + break; + case FORM_CHANGE_BATTLE_ULTRA_BURST: + EXPECT(targetSpeciesInfo->isUltraBurst); + break; + case FORM_CHANGE_BATTLE_GIGANTAMAX: + EXPECT(targetSpeciesInfo->isGigantamax); + break; + } + } +}