Skip to content

Get Match Calls Only If Caller Wants a Rematch

voloved edited this page Dec 27, 2022 · 1 revision

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;
}
Clone this wiki locally