Fixed Behemoth Blade/Bash handler not using form change tables (#6558)

This commit is contained in:
Eduardo Quezada 2025-04-09 05:09:27 -04:00 committed by GitHub
parent ce1943904a
commit 8cf8de1344
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

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