Remove redundant calls to GetMonData in pokemon.c

This commit is contained in:
Rose 2024-10-19 13:35:37 -04:00
parent 85197eda5e
commit c2f9162b1c

View file

@ -3985,12 +3985,8 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov
if (dataUnsigned != CalculatePPWithBonus(moveId, GetMonData(mon, MON_DATA_PP_BONUSES, NULL), temp2))
{
dataUnsigned += itemEffect[itemEffectParam];
moveId = GetMonData(mon, MON_DATA_MOVE1 + temp2, NULL); // Redundant
if (dataUnsigned > CalculatePPWithBonus(moveId, GetMonData(mon, MON_DATA_PP_BONUSES, NULL), temp2))
{
moveId = GetMonData(mon, MON_DATA_MOVE1 + temp2, NULL); // Redundant
dataUnsigned = CalculatePPWithBonus(moveId, GetMonData(mon, MON_DATA_PP_BONUSES, NULL), temp2);
}
SetMonData(mon, MON_DATA_PP1 + temp2, &dataUnsigned);
retVal = FALSE;
}
@ -4006,12 +4002,8 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov
if (dataUnsigned != CalculatePPWithBonus(moveId, GetMonData(mon, MON_DATA_PP_BONUSES, NULL), moveIndex))
{
dataUnsigned += itemEffect[itemEffectParam++];
moveId = GetMonData(mon, MON_DATA_MOVE1 + moveIndex, NULL); // Redundant
if (dataUnsigned > CalculatePPWithBonus(moveId, GetMonData(mon, MON_DATA_PP_BONUSES, NULL), moveIndex))
{
moveId = GetMonData(mon, MON_DATA_MOVE1 + moveIndex, NULL); // Redundant
dataUnsigned = CalculatePPWithBonus(moveId, GetMonData(mon, MON_DATA_PP_BONUSES, NULL), moveIndex);
}
SetMonData(mon, MON_DATA_PP1 + moveIndex, &dataUnsigned);
retVal = FALSE;
}