Merge branch 'master' into upcoming-master

This commit is contained in:
Hedara 2025-04-09 11:22:07 +02:00
commit c57d21b7b2

View File

@ -2008,16 +2008,22 @@ u16 MonTryLearningNewMove(struct Pokemon *mon, bool8 firstMove)
}
}
// Handler for if Zacian or Zamazenta should learn Iron Head
// since it transforms in the Behemoth Blade/Bash move in
// battle in the Crowned forms.
if (learnset[sLearningMoveTableID].move == MOVE_IRON_HEAD && (species == SPECIES_ZAMAZENTA_CROWNED || species == SPECIES_ZACIAN_CROWNED))
// Handler for Pokémon whose moves change upon form change.
// For example, if Zacian or Zamazenta should learn Iron Head,
// they're prevented from doing if they have Behemoth Blade/Bash,
// since it transforms into them while in their Crowned forms.
const struct FormChange *formChanges = GetSpeciesFormChanges(species);
for (u32 i = 0; formChanges != NULL && formChanges[i].method != FORM_CHANGE_TERMINATOR; i++)
{
for (u32 accessor = MON_DATA_MOVE1; accessor <= MON_DATA_MOVE4; accessor++)
if (formChanges[i].method == FORM_CHANGE_END_BATTLE
&& learnset[sLearningMoveTableID].move == formChanges[i].param3)
{
u32 move = GetMonData(mon, accessor);
if (move == MOVE_BEHEMOTH_BLADE || move == MOVE_BEHEMOTH_BASH)
return MOVE_NONE;
for (u32 j = 0; j < MAX_MON_MOVES; j++)
{
if (formChanges[i].param2 == GetMonData(mon, MON_DATA_MOVE1 + j))
return MOVE_NONE;
}
}
}
@ -3646,10 +3652,10 @@ const u16 *GetSpeciesFormTable(u16 species)
const struct FormChange *GetSpeciesFormChanges(u16 species)
{
const struct FormChange *evolutions = gSpeciesInfo[SanitizeSpeciesId(species)].formChangeTable;
if (evolutions == NULL)
const struct FormChange *formChanges = gSpeciesInfo[SanitizeSpeciesId(species)].formChangeTable;
if (formChanges == NULL)
return gSpeciesInfo[SPECIES_NONE].formChangeTable;
return evolutions;
return formChanges;
}
u8 CalculatePPWithBonus(u16 move, u8 ppBonuses, u8 moveIndex)