Made IsEnemy/FriendlyEntityName more efficient

Typed these all by hand, so tell me if anything is wrong.
Merge pull request #808 from Kefta/patch-3

Made IsEnemy/FriendlyEntityName more efficient