diff --git a/include/config/item.h b/include/config/item.h index 2f60739335..272848e82e 100644 --- a/include/config/item.h +++ b/include/config/item.h @@ -20,6 +20,7 @@ #define I_POWER_ITEM_BOOST GEN_LATEST // In Gen7+, Power Items grant 8 EVs instead of 4 EVs. #define I_PREMIER_BALL_BONUS GEN_LATEST // In LGPE onwards (Gen8+ here), you are given a Premier Ball for every 10 Poké Balls of any type and in the same purchase. Previously, it only applied to regular Poké Balls and only 1 could be obtained per purchase. #define I_ROTOM_CATALOG_THUNDER_SHOCK GEN_LATEST // In Gen9+, reverting Rotom to its base form will teach it Thunder Shock even if it knows another move. +#define I_REPEL_INCLUDE_FAINTED GEN_LATEST // In Gen1 and Gen6+, Repels always use the level of the first member of the party to check which wild Pokémon to prevent encounters with, even if that member is fainted. In Gen2-5, it only uses the level of the first non-fainted Pokémon. // TM config #define I_REUSABLE_TMS FALSE // In Gen5-8, TMs are reusable. Setting this to TRUE will make all vanilla TMs reusable, though they can also be cherry-picked by setting their importance to 1. diff --git a/src/wild_encounter.c b/src/wild_encounter.c index ae7770aa3a..033eec56da 100644 --- a/src/wild_encounter.c +++ b/src/wild_encounter.c @@ -1002,14 +1002,10 @@ static bool8 IsWildLevelAllowedByRepel(u8 wildLevel) for (i = 0; i < PARTY_SIZE; i++) { - if (GetMonData(&gPlayerParty[i], MON_DATA_HP) && !GetMonData(&gPlayerParty[i], MON_DATA_IS_EGG)) + if (I_REPEL_INCLUDE_FAINTED == GEN_1 || I_REPEL_INCLUDE_FAINTED >= GEN_6 || GetMonData(&gPlayerParty[i], MON_DATA_HP)) { - u8 ourLevel = GetMonData(&gPlayerParty[i], MON_DATA_LEVEL); - - if (wildLevel < ourLevel) - return FALSE; - else - return TRUE; + if (!GetMonData(&gPlayerParty[i], MON_DATA_IS_EGG)) + return wildLevel >= GetMonData(&gPlayerParty[i], MON_DATA_LEVEL); } }