Skip to content

Commit

Permalink
Allowed rematches to occur if I_VS_SEEKER_CHARGING isn't enabled (rh-…
Browse files Browse the repository at this point in the history
  • Loading branch information
fdeblasio authored Jun 29, 2024
1 parent 3ec371d commit 6957fc7
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 9 deletions.
1 change: 1 addition & 0 deletions include/vs_seeker.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
19 changes: 10 additions & 9 deletions src/battle_setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
8 changes: 8 additions & 0 deletions src/vs_seeker.c
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down

0 comments on commit 6957fc7

Please sign in to comment.