critical capture config option and catching charm

This commit is contained in:
Evan 2020-11-01 16:15:42 -07:00
parent 3af9a65506
commit a6c3d950f6
2 changed files with 30 additions and 17 deletions

View file

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

View file

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