all of this assumes integer math at the start of the encounter: - safariGoNearCounter is initialized to 0 - safariPkblThrowCounter is initialized to 0 - safariCatchFactor is initialized to catch rate * 100 / 1275 - safariEscapeFactor is initialized to flee rate * 100 / 1275 - if safariEscapeFactor <= 1, safariEscapeFactor is set to 2 before your turn it is decided whether or not the pokemon will run: - if safariGoNearCounter > 0 - safariFleeRate is set to safariEscapeFactor * 2 - if safariFleeRate > 20, then safariFleeRate is set to 20 - else if safariPkblThrowCounter > 0 - safariFleeRate is set to safariEscapeFactor / 4 - if safariEscapeFactor == 0, then safariEscapeFactor is set to 1 - else - safariFleeRate is set to safariEscapeFactor - safariFleeRate is multiplied by 5 - if a random number between 0 and 99 is less than safariFleeRate it runs, otherwise it doesn't every time a rock is thrown: - safariPkblThrowCounter is set to 0 - safariGoNearCounter is increased by 2 + a random value between 0 and 4 - if safariGoNearCounter > 6, then safariGoNearCounter is set to 6 - safariCatchFactor is bitshifted left by 1, essentially multiplied by 2 - if safariCatchFactor > 20, then safariCatchFactor is set to 20 every time a bait is thrown: - safariGoNearCounter is set to 0 - safariPkblThrowCounter is increased by 2 + a random value between 0 and 4 - if safariPkblThrowCounter > 6, then safariPkblThrowCounter is set to 6 - safariCatchFactor is bitshifted right by 1, essentially divided by 2 - if safariCatchFactor <= 2, then safariCatchFactor is set to 3 every time the pokemon doesn't run: - if safariGoNearCounter != 0 - safariGoNearCounter is decreased by 1 - if it reached 0, safariCatchFactor is reset to its initial state (catch rate * 100 / 1275) - else if safariPkblThrowCounter != 0 - safariPkblThrowCounter is decreased by 1 - NOTE: no resetting of safariCatchFactor if reached 0 in the catch formula: - when using a safari ball, catch rate is set to safariCatchFactor * 1275 / 100