I tested this patch and experienced the following problems (used shatter for testing):
When i casted shatter (.cast command), it not only hit the enemy but myself too. This should not happen. I am not sure of other such spells.
When i casted shatter once, it did damage. Second time onwards, it didn't affect the nearby friends at all. It just affected me. However, if I teleport to him (using .goname), the spell hits him again. It seems as if as soon as he gets damage, server assumes we are enemies and reloads this information when i teleport.
As for shatter's damage depending on distance, I tried a small patch in the place where meteor like spells are implemented to check the distance and change damage accordingly and it worked.