Chain Heal/Chain Lightning Macro?

Hey everyone, Shaman here. Needing some assistance with trying to fix this macro so it does what I need.

I’m essentially trying to combine my healing abilities with my damaging abilities as a resto shaman depending what I’m targeting or mousing over.

For example, If I am targeting an ally, I want Chain Heal to be cast. If I am targeting an enemy? I want Chain Lightning to be cast.

What I have so far:

#showtooltip
/cast [@mouseover,nodead,help] Healing Wave; Lightning Bolt

The Problem? As it stands now, this macro won’t do anything if I have an ally targeted. But I would like it to heal me if I don’t have an active target, or something mouse over.

Would it be possible to have the Macro cast a harmful/helpful ability if an enemy/ally is targeted, while making it default to healing me if there is no target/mouseover? I would also like to make it prioritize whatever I’m actively hovering my mouse on over the active selected target.

In world would look something like this. Enemy Targeted, but ally just took a massive hit. So now I mouseover them to have a chainheal priortized over my active target.

I hope I am not making this too confusing.

Thank you for any and all help!

Check the pins :wink:

#showtooltip
/cast [@mouseover,help,nodead] Healing Wave; [@mouseover,harm,nodead] [harm] Lightning Bolt; Healing Wave

Thanks friend, I appreciate you.