Fixes Tera Type not being carried over to during form change / evolution

This commit is contained in:
AlexOn1ine 2025-03-30 13:31:27 +02:00
parent 68a869da99
commit 3b9b24312a

View File

@ -1198,6 +1198,9 @@ void CreateBoxMon(struct BoxPokemon *boxMon, u16 species, u8 level, u8 fixedIV,
SetBoxMonData(boxMon, MON_DATA_POKEBALL, &value);
SetBoxMonData(boxMon, MON_DATA_OT_GENDER, &gSaveBlock2Ptr->playerGender);
u32 teraType = (boxMon->personality & 0x1) == 0 ? gSpeciesInfo[species].types[0] : gSpeciesInfo[species].types[1];
SetBoxMonData(boxMon, MON_DATA_TERA_TYPE, &teraType);
if (fixedIV < USE_RANDOM_IVS)
{
SetBoxMonData(boxMon, MON_DATA_HP_IV, &fixedIV);
@ -2789,18 +2792,9 @@ u32 GetBoxMonData3(struct BoxPokemon *boxMon, s32 field, u8 *data)
break;
case MON_DATA_TERA_TYPE:
if (gSpeciesInfo[substruct0->species].forceTeraType)
{
retVal = gSpeciesInfo[substruct0->species].forceTeraType;
}
else if (substruct0->teraType == TYPE_NONE) // Tera Type hasn't been modified so we can just use the personality
{
const u8 *types = gSpeciesInfo[substruct0->species].types;
retVal = (boxMon->personality & 0x1) == 0 ? types[0] : types[1];
}
else
{
retVal = substruct0->teraType;
}
break;
case MON_DATA_EVOLUTION_TRACKER:
evoTracker.asField.a = substruct1->evolutionTracker1;