You can change how spells work with options [options].
If target is enemy heal self, if target is helpful, heal target.
It helps to put in conditions that are most limiting or true first.
So:
/cast [target=target-target, help] HealSpell
/cast [target=player] HealSpell
This assumes that you are targeting your leader if not, you can change who you put in target=
Hope that helps and good luck.