This is a trick I have never had to experience.
Carry a second wallet while traveling with a couple of fake or expired credit cards and money in small denominations. If mugged,I am told throw the wallet two metres away from your attacker in the opposite direction of where you will then run. Throw and run. They will go for the wallet while you make your escape. My fear is that I will throw the wrong wallet.
Of course, being aware of your surroundings, looking confident, not wearing expensive jewellery can also reduce your risks.