diff --git a/include/dexnav.h b/include/dexnav.h index 1ed3b74ba8..b0ee02aa2f 100644 --- a/include/dexnav.h +++ b/include/dexnav.h @@ -127,6 +127,7 @@ void TryIncrementSpeciesSearchLevel(u16 dexNum); void ResetDexNavSearch(void); bool8 TryFindHiddenPokemon(void); bool8 DexNavTryMakeShinyMon(void); +void IncrementDexNavChain(void); //ewram extern u8 gCurrentDexNavChain; diff --git a/src/battle_main.c b/src/battle_main.c index 001e2ec17c..c34dc0ac57 100644 --- a/src/battle_main.c +++ b/src/battle_main.c @@ -5072,6 +5072,11 @@ static void FreeResetData_ReturnToOvOrDoEvolutions(void) { if (!gPaletteFade.active) { + if (gDexnavBattle && (gBattleOutcome == B_OUTCOME_WON || gBattleOutcome == B_OUTCOME_CAUGHT)) + IncrementDexNavChain(); + else + gSaveBlock1Ptr->dexNavChain = 0; + ResetSpriteData(); if (gLeveledUpInBattle == 0 || gBattleOutcome != B_OUTCOME_WON) { diff --git a/src/dexnav.c b/src/dexnav.c index f378de7cab..be46b94ff5 100644 --- a/src/dexnav.c +++ b/src/dexnav.c @@ -2720,4 +2720,10 @@ void ResetDexNavSearch(void) VarSet(VAR_DEXNAV_STEP_COUNTER, 0); //reset hidden pokemon step counter if (FlagGet(FLAG_SYS_DEXNAV_SEARCH)) EndDexNavSearch(FindTaskIdByFunc(Task_DexNavSearch)); //moving to new map ends dexnav search -} \ No newline at end of file +} + +void IncrementDexNavChain(void) +{ + if (gSaveBlock1Ptr->dexNavChain < DEXNAV_CHAIN_MAX) + gSaveBlock1Ptr->dexNavChain++; +}