You need to teach your cat how to play with you (how much biting/scratching your skin can take). Cats do this automatically with each other, so you just mimic their behavior for "everything is OK" and "now you've gone too far".
You also need to be consistent in your behavior with them. Randomly attacking them (even if just for play) just teaches them that taking random swipes at others is OK (which it is not). You also make it almost impossible for them to predict your behavior, which freaks them out and leads to all sorts of neuroses. Cats like predictability. There is a whole social dance around "let's play!" that you would be wise to learn.
Cats and humans have very different cultures. They are able to learn a little about human culture, but most of the responsibility is upon you to learn cat culture.
My family had a cat while I was growing up, that little beast was a terror at night. If I had to go to the bathroom I'd always need to be on the lookout because he had the despicable habit of hiding behind corners waiting to pounce when you walk by, biting his target.