Cleaning up repeated code

Create a static function in PlayerIdentity to get the identity opposite of a given value. This cleans up the code in a lot of places where a ternary had been used previously.