In your magic weapon item's class, you'll need to override the Shoot method like so:
public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
{
// Check for that 10% chance
if(Main.rand.Next(10)...