There are different ways to approach it. Personally, I don’t like using the self cast and focus keybinds, instead preferring to handle any modifiers directly in macros.
When it comes to macros, the most important thing to remember is that it evaluates conditionals in order, and when it finds one that evaluates to “true” it does the thing and stops.
A basic macro that I typically use for heals and such is:
#showtooltip
/cast [@mouseover, help, nodead][@player] Heal
If you want it to only self cast with alt key, you can just add that modifier to the [@player] conditional"
#showtooltip
/cast [@mouseover, help, nodead][@player,mod:alt] Heal
In the second case, your tooltip won’t always show the spell icon unless your mouse if either over a friendly target or you’re holding alt to self cast. So, in many cases people will add an empty conditional which will just cause the spell to do the default action as if you cast it directly from the spellbook. (So, if you have a friendly target, it will cast on them, if not and you have self cast turned on, it will cast on you. If neither of those are true, it will bring up a selection cursor to click on a target for the spell.)
When using mouseover macros, it’s important to add some additional conditionals or the macro can get stuck on that conditional. If you just use a plain [@mouseover] it will evaluate to true no matter what your mouse if over, and if it’s trying to cast a friendly spell and your mouse is over something else, the macro will just fail at that point. So, you’ll generally want to add either “help,” “harm,” or “exists” to any mouseover macro. (“nodead” is also generally a good idea for non-resurection macros.)
Now, when you want to start combining hostile and friendly spells, just make sure you are paying attention to the order of your conditionals to get your desired result.
#showtooltip
/cast [@mouseover,harm,nodead,mod:alt]Smite,[@player,mod:alt][@mouseover,help,nodead] Heal; [harm] Smite;[]Heal
To break that down:
If you are holding the alt key and your mouse if over a living hostile target, it casts smite.
If not, then if you’re holding alt, it casts Heal on yourself
If not, then if your mouse is over a friendly living target, it will cast heal on them.
If not, and you have an enemy target, it will cast Smite on them.
If not, then it will cast heal as it’s default action as if from the spell book. (As discussed above.)
That macro is probably a bit weird to actually use (you really don’t want to be worrying about what your mouse is over before self-casting) but it’s a great example of how the to get specific results based on the order of conditionals.
If you were to swap the two mod:alt conditionals:
#showtooltip
/cast [@player, mod:alt][@mouseover, help,nodead]Heal;[@mouseover,harm, nodead,mod:alt]Smite;[]Heal
You effectively break the macro. (Or at least the hostile mouseover part.) Once it gets to the [@player,mod:alt] it will always be true if you are holding alt, so it will never progress to the [@mouseover,harm, nodead,mod:alt], effectively always ignoring that conditional.