sovereignx/test/species.c
Martin Griffin 3ad66028e9
Backwards-compatible BoxPokémon Refactor (#3438)
* Check progress in non-battle PARAMETRIZEd tests

* Overworld Script Tests

* Backward-compatible BoxPokemon Refactor

Reuses space that contains zeros to provide space for:
- HP/status in the box
- 12-character nicknames
- Up to 63 PokéBalls
- Shininess separate from PID
- Hidden Nature
- Hyper Training
- Dynamax Level
- Gigantamax Factor
- Terastallization Types
- Shadow

Implements:
- OW_PC_HEAL to switch between Gen7- and Gen8+ behavior
- Nature Mints
- Dynamax Candy
- Hyper Training commands (canhypertrain/hypertrain)
- Gigantamax Factor commands (hasgigantamaxfactor/togglegigantamaxfactor)
- Terastallization Type on the summary screen
- Prevents Gigantamax Factor Pokémon from evolving into a species without a Gigantamax form

* fixup! Backward-compatible BoxPokemon Refactor

* displaydexinfo fix from Jasper
2023-12-27 17:48:17 +01:00

80 lines
2.6 KiB
C

#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++)
{
if (formChangeTable[i].targetSpecies == SPECIES_NONE)
continue;
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;
}
}
}