Originally Posted by
Kaolla
I'm not certain if this has been posted already, but this is a simple bit of code that will prevent any wasteful or harmful actions if your target puts up an immunity (optimized for a Frost DK).
I left out abilities such as Hand of Protection, AMS and Cloak of Shadows, as my class has a way of circumventing them, but they're easy to add if needed
Code:
Name: Immunities
Spell ID: 0
Delay: 0
Target: Player
if UnitBuff("target","Divine Shield") or UnitBuff("target","Deterrence") or UnitBuff("target","Ice Block") or UnitDebuff("target","Cyclone") then
SpellStopCasting()
return true
end
I stuck it near the top of my rotation, just beneath the survivability things like IBF and Healthstones.
just so you know, here's what i've put together so far
you may or may not notice that thing at the bottom 
Name: Stop Casting
Spell ID: 0
Delay: 0
Target: Player
LUA Code:
Code:
local unithealth = 100 * UnitHealth(targettoheal) / UnitHealthMax(targettoheal)
local Spell, _, _, _, _, EndTime = UnitCastingInfo("player")
if unithealth > 95 then
if Spell == "Holy Light" or Spell == "Divine Light" or Spell == "Flash of Light" then
SpellStopCasting()
return true
end
elseif unithealth > 80 then
if Spell == "Divine Light" or Spell == "Flash of Light" then
SpellStopCasting()
return true
end
elseif unithealth < 30 then
if Spell == "Holy Light" then
EndTime = EndTime/1000 - GetTime()
if EndTime > 1 then
SpellStopCasting()
return true
end
end
end
if UnitBuff(targettoheal,"Divine Shield") or UnitBuff(targettoheal,"Deterrence") or UnitBuff(targettoheal,"Ice Block") or UnitDebuff(targettoheal,"Cyclone") then
SpellStopCasting()
return true
end
as soon as i finish a couple more things, i'll be releasing an ALMOST complete version on my profile 
*edit*
Finished Hand of Protection and Salvation
and after a headache and a half found my error in my beacon ability. my beacon ability will auto cast beacon on any target that already has beacon when there's 15 seconds left, if there is no target with beacon on them it will default back to you. Also adding in the ability to change beacon target quickly with holding left alt down and mousing over your desired beacon target.
going to be adding a finishing touch and releasing tomorrow 
--------------------
also ran into a snag with trying to find out who arena1-5 are targeting.... my brain turned off a LONG time ago