RavePossum's Safari Ball 100% Catch Rate Solution - idfacio1/emeraldfacility GitHub Wiki

To my knowledge this is not recorded anywhere outside of RHH/Team Aquas, and I've recorded it here for posterity. Below is RavePossum's solution for making Safari Balls have a 100% catch rate, as implemented in Emerald Facility. If for some reason you use this code, credit RavePossum:

In battle_script_commands.c


    static void Cmd_handleballthrow(void)
    ...
            if (gBattleResults.catchAttempts[gLastUsedItem - FIRST_BALL] < 255)
                gBattleResults.catchAttempts[gLastUsedItem - FIRST_BALL]++;

-     if (odds > 254) // mon caught
+     if (odds > 254 || gLastUsedItem == ITEM_SAFARI_BALL) // mon caught
            {
                BtlController_EmitBallThrowAnim(gBattlerAttacker, BUFFER_A, BALL_3_SHAKES_SUCCESS);
                MarkBattlerForControllerExec(gBattlerAttacker);
                TryBattleFormChange(gBattlerTarget, FORM_CHANGE_END_BATTLE);