From 6957fc70c901c84e9a246b3d1d5f5a251ed19ae4 Mon Sep 17 00:00:00 2001 From: Frank DeBlasio <35279583+fdeblasio@users.noreply.github.com> Date: Sat, 29 Jun 2024 16:12:26 -0400 Subject: [PATCH] Allowed rematches to occur if I_VS_SEEKER_CHARGING isn't enabled (#4866) --- include/vs_seeker.h | 1 + src/battle_setup.c | 19 ++++++++++--------- src/vs_seeker.c | 8 ++++++++ 3 files changed, 19 insertions(+), 9 deletions(-) diff --git a/include/vs_seeker.h b/include/vs_seeker.h index 723e73bf372d..d6795432b071 100644 --- a/include/vs_seeker.h +++ b/include/vs_seeker.h @@ -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 diff --git a/src/battle_setup.c b/src/battle_setup.c index 92fc2bea250c..2fe016ec8728 100644 --- a/src/battle_setup.c +++ b/src/battle_setup.c @@ -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 (gSaveBlock1Ptr->trainerRematchStepCounter >= STEP_COUNTER_MAX) - gSaveBlock1Ptr->trainerRematchStepCounter = STEP_COUNTER_MAX; - else - gSaveBlock1Ptr->trainerRematchStepCounter++; - } + if (!HasAtLeastFiveBadges()) + return; + + if (IsVsSeekerEnabled()) + return; + + if (gSaveBlock1Ptr->trainerRematchStepCounter >= STEP_COUNTER_MAX) + gSaveBlock1Ptr->trainerRematchStepCounter = STEP_COUNTER_MAX; + else + gSaveBlock1Ptr->trainerRematchStepCounter++; #endif //FREE_MATCH_CALL } diff --git a/src/vs_seeker.c b/src/vs_seeker.c index 63b6c6f9d533..30dcb74ce0c4 100644 --- a/src/vs_seeker.c +++ b/src/vs_seeker.c @@ -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];