diff --git a/include/constants/battle_config.h b/include/constants/battle_config.h index 778314f643..f7d4946622 100644 --- a/include/constants/battle_config.h +++ b/include/constants/battle_config.h @@ -130,6 +130,10 @@ #define B_PARALYZE_ELECTRIC GEN_6 // In Gen6+, Electric type Pokémon can't be paralyzed. #define B_POWDER_GRASS GEN_6 // In Gen6+, Grass type Pokémon are immune to powder and spore moves. +// Critical Capture +#define CRITICAL_CAPTURE TRUE // if set to TRUE, critical capture will be enabled +#define CATCHING_CHARM_BOOST 20 // % boost in critical capture odds if player has the catching charm + // Animation Settings #define B_NEW_SWORD_PARTICLE TRUE // If set to TRUE, it updates Swords Dance's particle. #define B_NEW_LEECH_SEED_PARTICLE TRUE // If set to TRUE, it updates Leech Seed's animation particle. diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 36355d10da..ed8086d7de 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -12389,25 +12389,34 @@ static void Cmd_metalburstdamagecalculator(void) static bool32 CriticalCapture(u32 odds) { - u16 numCaught = GetNationalPokedexCount(FLAG_GET_CAUGHT); + #if CRITICAL_CAPTURE == TRUE + u16 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 <= 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; - odds /= 6; - if ((Random() % 255) < odds) - return TRUE; + #ifdef ITEM_CATCHING_CHARM + if (CheckBagHasItem(ITEM_CATCHING_CHARM, 1)) + odds = (odds * (100 + CATCHING_CHARM_BOOST)) / 100; + #endif - return FALSE; + odds /= 6; + if ((Random() % 255) < odds) + return TRUE; + + return FALSE; + #else + return FALSE; + #endif }