mirror of
https://github.com/pret/pokeemerald.git
synced 2026-05-05 21:07:17 -05:00
Fix Critical Capture RNG and Catching Charm boost (#7534)
This commit is contained in:
parent
40ffcfb94a
commit
7aad95ae63
|
|
@ -286,7 +286,7 @@
|
|||
|
||||
// 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_CATCHING_CHARM_BOOST 100 // % 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_CRITICAL_CAPTURE_IF_OWNED GEN_LATEST // In Gen9, a capture appear critical if the pokemon you are trying to catch already has a dex entry (has already been caught)
|
||||
|
|
|
|||
|
|
@ -14372,6 +14372,7 @@ static bool32 CriticalCapture(u32 odds)
|
|||
{
|
||||
u32 numCaught;
|
||||
u32 totalDexCount;
|
||||
u32 charmBoost = 1;
|
||||
|
||||
if (B_CRITICAL_CAPTURE == FALSE)
|
||||
return FALSE;
|
||||
|
|
@ -14381,27 +14382,28 @@ static bool32 CriticalCapture(u32 odds)
|
|||
else
|
||||
totalDexCount = NATIONAL_DEX_COUNT;
|
||||
|
||||
numCaught = GetNationalPokedexCount(FLAG_GET_CAUGHT);
|
||||
|
||||
if (numCaught <= (totalDexCount * 30) / 650)
|
||||
odds = 0;
|
||||
else if (numCaught <= (totalDexCount * 150) / 650)
|
||||
odds /= 2;
|
||||
else if (numCaught <= (totalDexCount * 300) / 650)
|
||||
; // odds = (odds * 100) / 100;
|
||||
else if (numCaught <= (totalDexCount * 450) / 650)
|
||||
odds = (odds * 150) / 100;
|
||||
else if (numCaught <= (totalDexCount * 600) / 650)
|
||||
odds *= 2;
|
||||
else
|
||||
odds = (odds * 250) / 100;
|
||||
|
||||
if (CheckBagHasItem(ITEM_CATCHING_CHARM, 1))
|
||||
odds = (odds * (100 + B_CATCHING_CHARM_BOOST)) / 100;
|
||||
charmBoost = (100 + B_CATCHING_CHARM_BOOST) / 100;
|
||||
|
||||
numCaught = GetNationalPokedexCount(FLAG_GET_CAUGHT);
|
||||
if (numCaught > (totalDexCount * 600) / 650)
|
||||
odds = (odds * (250 * charmBoost)) / 100;
|
||||
else if (numCaught > (totalDexCount * 450) / 650)
|
||||
odds = (odds * (200 * charmBoost)) / 100;
|
||||
else if (numCaught > (totalDexCount * 300) / 650)
|
||||
odds = (odds * (150 * charmBoost)) / 100;
|
||||
else if (numCaught > (totalDexCount * 150) / 650)
|
||||
odds = (odds * (100 * charmBoost)) / 100;
|
||||
else if (numCaught > (totalDexCount * 30) / 650)
|
||||
odds = (odds * (50 * charmBoost)) / 100;
|
||||
else
|
||||
return FALSE;
|
||||
|
||||
if (odds > 255)
|
||||
odds = 255;
|
||||
|
||||
odds /= 6;
|
||||
|
||||
if ((Random() % 255) < odds)
|
||||
if ((Random() % 256) < odds)
|
||||
return TRUE;
|
||||
|
||||
return FALSE;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user