Can't change the forced Tera Type anymore

This commit is contained in:
kittenchilly 2024-04-25 01:38:53 -05:00
parent 3b293b8327
commit 67157250ef
5 changed files with 15 additions and 16 deletions

View file

@ -2330,7 +2330,8 @@ u8 CreateNPCTrainerPartyFromTrainer(struct Pokemon *party, const struct Trainer
if (partyData[i].teraType > 0)
{
u32 data = partyData[i].teraType;
SetMonData(&party[i], MON_DATA_TERA_TYPE, &data);
if (gSpeciesInfo[partyData[i].species].forceTeraType == TYPE_NONE)
SetMonData(&party[i], MON_DATA_TERA_TYPE, &data);
}
CalculateMonStats(&party[i]);

View file

@ -82,13 +82,10 @@ bool32 CanTerastallize(u32 battler)
// Returns a pokemon's Tera type.
u32 GetTeraType(struct Pokemon *mon)
{
if (GetMonData(mon, MON_DATA_TERA_TYPE) + 1 == 0) // no tera type, so generate it
if (GetMonData(mon, MON_DATA_TERA_TYPE) == -1) // no tera type, so generate it
{
u16 species = GetMonData(mon, MON_DATA_SPECIES);
if (gSpeciesInfo[species].forceTeraType != TYPE_NONE)
SetMonData(mon, MON_DATA_TERA_TYPE, &gSpeciesInfo[species].forceTeraType);
else
if (gSpeciesInfo[species].forceTeraType == TYPE_NONE)
SetMonData(mon, MON_DATA_TERA_TYPE, ((GetMonData(mon, MON_DATA_PERSONALITY) & 0x1) == 0 ? &(gSpeciesInfo[species].types[0]) : &(gSpeciesInfo[species].types[1])));
}

View file

@ -1643,7 +1643,8 @@ void CreateFacilityMon(const struct TrainerMon *fmon, u16 level, u8 fixedIV, u32
if (fmon->teraType)
{
u32 data = fmon->teraType;
SetMonData(dst, MON_DATA_TERA_TYPE, &data);
if (gSpeciesInfo[fmon->species].forceTeraType == TYPE_NONE)
SetMonData(dst, MON_DATA_TERA_TYPE, &data);
}

View file

@ -1020,9 +1020,7 @@ void CreateBoxMon(struct BoxPokemon *boxMon, u16 species, u8 level, u8 fixedIV,
SetBoxMonData(boxMon, MON_DATA_ABILITY_NUM, &value);
}
if (gSpeciesInfo[species].forceTeraType != TYPE_NONE)
SetBoxMonData(boxMon, MON_DATA_TERA_TYPE, &(gSpeciesInfo[species].forceTeraType));
else
if (gSpeciesInfo[species].forceTeraType == TYPE_NONE)
SetBoxMonData(boxMon, MON_DATA_TERA_TYPE, ((personality & 0x1) == 0 ? &(gSpeciesInfo[species].types[0]) : &(gSpeciesInfo[species].types[1])));
GiveBoxMonInitialMoveset(boxMon);
@ -2543,7 +2541,10 @@ u32 GetBoxMonData3(struct BoxPokemon *boxMon, s32 field, u8 *data)
break;
case MON_DATA_TERA_TYPE:
{
retVal = substruct0->teraType - 1;
if (gSpeciesInfo[substruct0->species].forceTeraType != TYPE_NONE)
retVal = gSpeciesInfo[substruct0->species].forceTeraType;
else
retVal = substruct0->teraType - 1;
break;
}
case MON_DATA_EVOLUTION_TRACKER:
@ -6274,9 +6275,6 @@ u16 GetFormChangeTargetSpeciesBoxMon(struct BoxPokemon *boxMon, u16 method, u32
}
}
if (gSpeciesInfo[targetSpecies].forceTeraType != TYPE_NONE) // Doing this here seems to cover all cases
SetBoxMonData(boxMon, MON_DATA_TERA_TYPE, &gSpeciesInfo[targetSpecies].forceTeraType);
return targetSpecies;
}
@ -6526,7 +6524,8 @@ void UpdateMonPersonality(struct BoxPokemon *boxMon, u32 personality)
SetBoxMonData(boxMon, MON_DATA_IS_SHINY, &isShiny);
SetBoxMonData(boxMon, MON_DATA_HIDDEN_NATURE, &hiddenNature);
SetBoxMonData(boxMon, MON_DATA_TERA_TYPE, &teraType);
if (gSpeciesInfo[GetBoxMonData(boxMon, MON_DATA_SPECIES)].forceTeraType == TYPE_NONE)
SetBoxMonData(boxMon, MON_DATA_TERA_TYPE, &teraType);
}
void HealPokemon(struct Pokemon *mon)

View file

@ -334,7 +334,8 @@ u32 ScriptGiveMonParameterized(u16 species, u8 level, u16 item, u8 ball, u8 natu
// tera type
if (teraType >= NUMBER_OF_MON_TYPES)
teraType = gSpeciesInfo[species].types[0];
SetMonData(&mon, MON_DATA_TERA_TYPE, &teraType);
if (gSpeciesInfo[species].forceTeraType == TYPE_NONE)
SetMonData(&mon, MON_DATA_TERA_TYPE, &teraType);
// EV and IV
for (i = 0; i < NUM_STATS; i++)