1 Get Match Calls Only If Caller Wants a Rematch
voloved edited this page 2022-12-27 08:30:09 -05:00

By devolov

Goal: If the person who wants to call isn't calling for a rematch, then don't have their calls go through.

In match_call.c:

static bool32 SelectMatchCallTrainer(void)
{
    u32 matchCallId;
    u32 numRegistered = GetNumRegisteredNPCs();
    if (numRegistered == 0)
        return FALSE;

    sMatchCallState.trainerId = GetActiveMatchCallTrainerId(Random() % numRegistered);
    sMatchCallState.triggeredFromScript = FALSE;
    if (sMatchCallState.trainerId == REMATCH_TABLE_ENTRIES)
        return FALSE;
 
    matchCallId = GetTrainerMatchCallId(sMatchCallState.trainerId);
-   if (GetRematchTrainerLocation(matchCallId) == gMapHeader.regionMapSectionId && !TrainerIsEligibleForRematch(matchCallId))
+   if (!((TrainerIsEligibleForRematch(matchCallId) && GetRematchTrainerLocation(matchCallId) == gMapHeader.regionMapSectionId)
+   || ShouldTrainerRequestBattle(matchCallId)))
        return FALSE;

    return TRUE;
}