From fb28206f21a69f45993063fc49aaf477663e95bf Mon Sep 17 00:00:00 2001 From: surskitty Date: Thu, 27 Feb 2025 18:16:16 -0500 Subject: [PATCH] Configuration to scale Critical Capture odds based on local Pokedex or estimated National Pokedex (#6250) --- include/config/battle.h | 8 +++++--- src/battle_script_commands.c | 17 ++++++++++++----- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/include/config/battle.h b/include/config/battle.h index bacdc770d9..8721ef317f 100644 --- a/include/config/battle.h +++ b/include/config/battle.h @@ -245,9 +245,11 @@ #define B_MOVE_DESCRIPTION_BUTTON L_BUTTON // If set to a button other than B_LAST_USED_BALL_BUTTON, pressing this button will open the move description menu // Catching settings -#define B_SEMI_INVULNERABLE_CATCH GEN_LATEST // In Gen4+, you cannot throw a ball against a Pokemon that is in a semi-invulnerable state (dig/fly/etc) -#define B_CATCHING_CHARM_BOOST 20 // % boost in Critical Capture odds if player has the Catching Charm. -#define B_CRITICAL_CAPTURE TRUE // If set to TRUE, Critical Capture will be enabled. +#define B_SEMI_INVULNERABLE_CATCH GEN_LATEST // In Gen4+, you cannot throw a ball against a Pokemon that is in a semi-invulnerable state (dig/fly/etc) +#define B_CATCHING_CHARM_BOOST 20 // % boost in Critical Capture odds if player has the Catching Charm. +#define B_CRITICAL_CAPTURE TRUE // If set to TRUE, Critical Capture will be enabled. +#define B_CRITICAL_CAPTURE_LOCAL_DEX TRUE // If set to FALSE, Critical Capture % is based off of the National Pokedex estimated by enabled generations. + #define B_LAST_USED_BALL TRUE // If TRUE, the "last used ball" feature from Gen 7 will be implemented #define B_LAST_USED_BALL_BUTTON R_BUTTON // If last used ball is implemented, this button (or button combo) will trigger throwing the last used ball. #define B_LAST_USED_BALL_CYCLE TRUE // If TRUE, then holding B_LAST_USED_BALL_BUTTON while pressing the D-Pad cycles through the balls diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index be57f4ae18..1154660af2 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -16701,21 +16701,27 @@ void BS_DoStockpileStatChangesWearOff(void) static bool32 CriticalCapture(u32 odds) { u32 numCaught; + u32 totalDexCount; if (B_CRITICAL_CAPTURE == FALSE) return FALSE; + if (B_CRITICAL_CAPTURE_LOCAL_DEX == TRUE) + totalDexCount = HOENN_DEX_COUNT; + else + totalDexCount = NATIONAL_DEX_COUNT; + numCaught = GetNationalPokedexCount(FLAG_GET_CAUGHT); - if (numCaught <= (NATIONAL_DEX_COUNT * 30) / 650) + if (numCaught <= (totalDexCount * 30) / 650) odds = 0; - else if (numCaught <= (NATIONAL_DEX_COUNT * 150) / 650) + else if (numCaught <= (totalDexCount * 150) / 650) odds /= 2; - else if (numCaught <= (NATIONAL_DEX_COUNT * 300) / 650) + else if (numCaught <= (totalDexCount * 300) / 650) ; // odds = (odds * 100) / 100; - else if (numCaught <= (NATIONAL_DEX_COUNT * 450) / 650) + else if (numCaught <= (totalDexCount * 450) / 650) odds = (odds * 150) / 100; - else if (numCaught <= (NATIONAL_DEX_COUNT * 600) / 650) + else if (numCaught <= (totalDexCount * 600) / 650) odds *= 2; else odds = (odds * 250) / 100; @@ -16724,6 +16730,7 @@ static bool32 CriticalCapture(u32 odds) odds = (odds * (100 + B_CATCHING_CHARM_BOOST)) / 100; odds /= 6; + if ((Random() % 255) < odds) return TRUE;