Single Target or Multi Target? And this is for Bear right? If you want, take whatever you can from mine and change it around to meet your needs. All the 3 of variables there are my own making, so you might have to change more around than meets the needs
This one is my single target that also checks to see if you have ClearCasting for the free Thrash. If not there, then return false and never think about it again
PHP Code:
//Variables
local HasGlyph = HasGlyph(127540)
local HasSR = select(2,HasSR("Player"))
local HasThrash = HasThrash("Target","Player")
if HasGlyph then
if HasThrash then
CastSpellByName(tostring(GetSpellInfo(106830)))
end
elseif not HasGlyph then
if HasThrash then
CastSpellByName(tostring(GetSpellInfo(106830)))
end
end
with my custom made function for Thrash being:
PHP Code:
function HasThrash(var1,var2)
local CCasting = UnitBuffID(var2,16870)
local tBuff = UnitDebuffID(var1, 106830,var2)
if CCasting and not tBuff then
return true
elseif CCasting and tBuff then
local tTimer = select(7,UnitDebuffID(var1, 106830,var2))
local Timer = (tTimer - GetTime())
return true,Timer
elseif not CCasting and tBuff then
local tTimer = select(7,UnitDebuffID(var1, 106830,var2))
local Timer = (tTimer - GetTime())
return false,Timer
end
return false
end
Here's my flat Multi Target with none of the above in it pretty much but a check to see if you have Savage Roar, which can easily be removed from the code (HasSR is also one of my custom function's)
PHP Code:
local hasTarget = UnitExists("Target")
local Enemy = UnitCanAttack("Player","Target")
local isDead = UnitIsDead("Target")
local inCombat = UnitAffectingCombat("Player") or UnitAffectingCombat("Target")
if hasTarget and Enemy and not isDead and inCombat then
//Variables
local HasGlyph = HasGlyph(127540)
local HasSR = select(2,HasSR("Player"))
//Misc Buff's/Debuff's/CD's
local thrashBleed = UnitDebuffID("Target",106830)
if HasGlyph then
if not thrashBleed and HasSR then
CastSpellByName(tostring(GetSpellInfo(106830)))
end
elseif not HasGlyph then
if not thrashBleed then
CastSpellByName(tostring(GetSpellInfo(106830)))
end
end
end
P.S. Just have to check and make sure that the Thrash Debuff on the target is indeed yours, which is why the "PLAYER" tag is included in my custom function. This is just in case another druid is in your group and Thrash has the same spellID.