diff --git a/include/constants/battle_config.h b/include/constants/battle_config.h index 374a4b54f6..4659e15958 100644 --- a/include/constants/battle_config.h +++ b/include/constants/battle_config.h @@ -123,6 +123,10 @@ #define B_SHOW_TARGETS TRUE // If set to TRUE, all available targets, for moves hitting 2 or 3 Pokémon, will be shown before selecting a move. #define B_SHOW_SPLIT_ICON TRUE // If set to TRUE, it will show an icon in the summary showing the move's category split. +// Critical Capture +#define B_CRITICAL_CAPTURE TRUE // If set to TRUE, Critical Capture will be enabled. +#define B_CATCHING_CHARM_BOOST 20 // % boost in Critical Capture odds if player has the Catching Charm. + // Other #define B_DOUBLE_WILD_CHANCE 0 // % chance of encountering two Pokémon in a Wild Encounter. #define B_SLEEP_TURNS GEN_6 // In Gen5+, sleep lasts for 1-3 turns instead of 2-5 turns. diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 517e1c45d6..3ea83cf93b 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -12391,25 +12391,34 @@ static void Cmd_metalburstdamagecalculator(void) static bool32 CriticalCapture(u32 odds) { - u16 numCaught = GetNationalPokedexCount(FLAG_GET_CAUGHT); + #if B_CRITICAL_CAPTURE == TRUE + u32 numCaught = GetNationalPokedexCount(FLAG_GET_CAUGHT); - if (numCaught <= 30) - odds = 0; - else if (numCaught <= 150) - odds /= 2; - else if (numCaught <= 300) - ; - else if (numCaught <= 450) - odds = (odds * 150) / 100; - else if (numCaught <= 600) - odds *= 2; - else - odds = (odds * 250) / 100; + if (numCaught <= (NATIONAL_DEX_COUNT * 30) / 650) + odds = 0; + else if (numCaught <= (NATIONAL_DEX_COUNT * 150) / 650) + odds /= 2; + else if (numCaught <= (NATIONAL_DEX_COUNT * 300) / 650) + ; // odds = (odds * 100) / 100; + else if (numCaught <= (NATIONAL_DEX_COUNT * 450) / 650) + odds = (odds * 150) / 100; + else if (numCaught <= (NATIONAL_DEX_COUNT * 600) / 650) + odds *= 2; + else + odds = (odds * 250) / 100; - odds /= 6; - if ((Random() % 255) < odds) - return TRUE; + #ifdef ITEM_CATCHING_CHARM + if (CheckBagHasItem(ITEM_CATCHING_CHARM, 1)) + odds = (odds * (100 + B_CATCHING_CHARM_BOOST)) / 100; + #endif - return FALSE; + odds /= 6; + if ((Random() % 255) < odds) + return TRUE; + + return FALSE; + #else + return FALSE; + #endif }