2023-12-11 12:54:20 +00:00
|
|
|
#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;
|
2024-03-05 13:57:39 +00:00
|
|
|
const u16 *formSpeciesIdTable;
|
2024-06-02 16:12:08 +01:00
|
|
|
|
2023-12-11 12:54:20 +00:00
|
|
|
for (i = 0; i < NUM_SPECIES; i++)
|
|
|
|
{
|
2024-03-05 13:57:39 +00:00
|
|
|
if (gSpeciesInfo[i].formSpeciesIdTable)
|
|
|
|
{
|
|
|
|
PARAMETRIZE_LABEL("%S", gSpeciesInfo[i].speciesName) { species = i; }
|
|
|
|
}
|
2023-12-11 12:54:20 +00:00
|
|
|
}
|
|
|
|
|
2024-03-05 13:57:39 +00:00
|
|
|
formSpeciesIdTable = gSpeciesInfo[species].formSpeciesIdTable;
|
2023-12-11 12:54:20 +00:00
|
|
|
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;
|
2024-03-05 13:57:39 +00:00
|
|
|
const struct FormChange *formChangeTable;
|
|
|
|
const u16 *formSpeciesIdTable;
|
2024-06-02 16:12:08 +01:00
|
|
|
|
2023-12-11 12:54:20 +00:00
|
|
|
for (i = 0; i < NUM_SPECIES; i++)
|
|
|
|
{
|
2024-03-05 13:57:39 +00:00
|
|
|
if (gSpeciesInfo[i].formChangeTable)
|
|
|
|
{
|
|
|
|
PARAMETRIZE_LABEL("%S", gSpeciesInfo[i].speciesName) { species = i; }
|
|
|
|
}
|
2023-12-11 12:54:20 +00:00
|
|
|
}
|
|
|
|
|
2024-03-05 13:57:39 +00:00
|
|
|
formChangeTable = gSpeciesInfo[species].formChangeTable;
|
|
|
|
formSpeciesIdTable = gSpeciesInfo[species].formSpeciesIdTable;
|
2023-12-11 12:54:20 +00:00
|
|
|
EXPECT(formSpeciesIdTable);
|
|
|
|
|
|
|
|
for (i = 0; formChangeTable[i].method != FORM_CHANGE_TERMINATOR; i++)
|
|
|
|
{
|
2023-12-27 16:48:17 +00:00
|
|
|
if (formChangeTable[i].targetSpecies == SPECIES_NONE)
|
|
|
|
continue;
|
2023-12-11 12:54:20 +00:00
|
|
|
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;
|
2024-03-05 13:57:39 +00:00
|
|
|
const struct FormChange *formChangeTable;
|
2024-06-02 16:12:08 +01:00
|
|
|
|
2023-12-11 12:54:20 +00:00
|
|
|
for (i = 0; i < NUM_SPECIES; i++)
|
|
|
|
{
|
2024-03-05 13:57:39 +00:00
|
|
|
if (gSpeciesInfo[i].formChangeTable)
|
|
|
|
{
|
|
|
|
PARAMETRIZE_LABEL("%S", gSpeciesInfo[i].speciesName) { species = i; }
|
|
|
|
}
|
2023-12-11 12:54:20 +00:00
|
|
|
}
|
|
|
|
|
2024-03-05 13:57:39 +00:00
|
|
|
formChangeTable = gSpeciesInfo[species].formChangeTable;
|
2023-12-11 12:54:20 +00:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2024-06-12 20:52:04 +01:00
|
|
|
|
|
|
|
TEST("No species has two evolutions that use the evolution tracker")
|
|
|
|
{
|
|
|
|
u32 i;
|
|
|
|
u32 species = SPECIES_NONE;
|
|
|
|
u32 evolutionTrackerEvolutions;
|
|
|
|
bool32 hasGenderBasedRecoil;
|
|
|
|
const struct Evolution *evolutions;
|
|
|
|
|
|
|
|
for (i = 0; i < NUM_SPECIES; i++)
|
|
|
|
{
|
|
|
|
if (GetSpeciesEvolutions(i) != NULL) PARAMETRIZE { species = i; }
|
|
|
|
}
|
|
|
|
|
|
|
|
evolutionTrackerEvolutions = 0;
|
|
|
|
hasGenderBasedRecoil = FALSE;
|
|
|
|
evolutions = GetSpeciesEvolutions(species);
|
|
|
|
|
|
|
|
for (i = 0; evolutions[i].method != EVOLUTIONS_END; i++)
|
|
|
|
{
|
|
|
|
if (evolutions[i].method == EVO_LEVEL_MOVE_TWENTY_TIMES
|
|
|
|
#ifdef EVO_DEFEAT_WITH_ITEM
|
|
|
|
|| evolutions[i].method == EVO_DEFEAT_WITH_ITEM
|
|
|
|
#endif //EVO_DEFEAT_WITH_ITEM
|
|
|
|
#ifdef EVO_OVERWORLD_STEPS
|
|
|
|
|| evolutions[i].method == EVO_OVERWORLD_STEPS
|
|
|
|
#endif //EVO_OVERWORLD_STEPS
|
|
|
|
)
|
|
|
|
evolutionTrackerEvolutions++;
|
|
|
|
|
|
|
|
if (evolutions[i].method == EVO_LEVEL_RECOIL_DAMAGE_MALE
|
|
|
|
|| evolutions[i].method == EVO_LEVEL_RECOIL_DAMAGE_FEMALE)
|
|
|
|
{
|
|
|
|
// Special handling for these since they can be combined as the evolution tracker field is used for the same purpose
|
|
|
|
if (!hasGenderBasedRecoil)
|
|
|
|
{
|
|
|
|
hasGenderBasedRecoil = TRUE;
|
|
|
|
evolutionTrackerEvolutions++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
EXPECT(evolutionTrackerEvolutions < 2);
|
|
|
|
}
|