Better yet, it doesn't even require scripting.
/stopmacro lets you halt execution when a macro condition matches.
Code:
/cast [@focus,help,nodead][help,nodead][@pet] Misdirection
/stopmacro [@focus,help,nodead][nohelp][dead]
/focus
/p Misdirecting %t
Note: [
help] implies [
exists], you don't need to check both.