Critical Capture Config Option And Catching Charm #556 from ghoulslash

Critical Capture Config Option And Catching Charm
This commit is contained in:
Eduardo Quezada D'Ottone 2020-11-10 17:31:08 -03:00 committed by GitHub
commit e021a4aa87
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 30 additions and 17 deletions

View File

@ -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.

View File

@ -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
}