Allowed rematches to occur if I_VS_SEEKER_CHARGING isn't enabled (#4866)

This commit is contained in:
Frank DeBlasio 2024-06-29 16:12:26 -04:00 committed by GitHub
parent 3ec371de05
commit 6957fc70c9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 19 additions and 9 deletions

View file

@ -8,6 +8,7 @@ bool8 UpdateVsSeekerStepCounter(void);
void MapResetTrainerRematches(u16 mapGroup, u16 mapNum);
void ClearRematchMovementByTrainerId(void);
u16 GetRematchTrainerIdVSSeeker(u16 trainerId);
bool32 IsVsSeekerEnabled(void);
#define VSSEEKER_RECHARGE_STEPS 100

View file

@ -1916,15 +1916,16 @@ static bool32 HasAtLeastFiveBadges(void)
void IncrementRematchStepCounter(void)
{
#if FREE_MATCH_CALL == FALSE
if (HasAtLeastFiveBadges()
&& (I_VS_SEEKER_CHARGING != 0)
&& (!CheckBagHasItem(ITEM_VS_SEEKER, 1)))
{
if (!HasAtLeastFiveBadges())
return;
if (IsVsSeekerEnabled())
return;
if (gSaveBlock1Ptr->trainerRematchStepCounter >= STEP_COUNTER_MAX)
gSaveBlock1Ptr->trainerRematchStepCounter = STEP_COUNTER_MAX;
else
gSaveBlock1Ptr->trainerRematchStepCounter++;
}
#endif //FREE_MATCH_CALL
}

View file

@ -577,6 +577,14 @@ u16 GetRematchTrainerIdVSSeeker(u16 trainerId)
return gRematchTable[tableId].trainerIds[rematchTrainerIdx];
}
bool32 IsVsSeekerEnabled(void)
{
if (I_VS_SEEKER_CHARGING == 0)
return FALSE;
return (CheckBagHasItem(ITEM_VS_SEEKER, 1));
}
static bool8 ObjectEventIdIsSane(u8 objectEventId)
{
struct ObjectEvent *objectEvent = &gObjectEvents[objectEventId];