Code:
------INITIALIZE------
cast = CastSpellByName
------SPEC------
pt = GetPrimaryTalentTree();
------MOVEMENT------
if GetUnitSpeed("player")>0 and not UnitAura("player","Aspect of the Fox") and GetSpellCooldown("Aspect of the Fox")==0 then
cast("Aspect of the Fox")
elseif GetUnitSpeed("player")==0 and not UnitAura("player","Aspect of the Hawk") and GetSpellCooldown("Aspect of the Hawk")==0 then
cast("Aspect of the Hawk")
end
------THREAT------
t={UnitDetailedThreatSituation("player","target")}
if GetNumPartyMembers()>0 and (t[1]==1 or (t[5] ~=nil and t[5]>25000 and t[3]>90)) then
if GetSpellCooldown("Feign Death")==0 then
cast("Feign Death")
end
end
------TRANQUILIZING SHOT------
if GetSpellCooldown("Tranquilizing Shot")==0 and UnitPower("player")>19 and IsSpellInRange("Tranquilizing Shot","target")==1 and (UnitBuff("target","Enrage") or UnitBuff("target","Remedy") or UnitBuff("target","Rage") or UnitBuff("target","Power Conversion") or UnitBuff("target","Venomous Rage") or UnitBuff("target","Rapid Fire")) then
cast("Tranquilizing Shot")
end
------HUNTERS MARK------
if (UnitLevel("target")==-1 or (UnitLevel("target")==UnitLevel("player")+2 and select(2,GetInstanceInfo())=="party")) then
if not (UnitDebuff("target","Hunter's Mark") or UnitDebuff("target","Marked for Death")) and UnitHealth("target")/UnitHealthMax("target")>=.95 then
cast("Hunter's Mark")
end
end
------MISDIRECTION------
if md and not UnitCastingInfo("player") and UnitAffectingCombat("player")==1 then
if GetSpellCooldown("Misdirection")==0 and not UnitBuff("player","Misdirection") then
RunMacro("Misdirection")
end
end
------SERPENT STING------
if not UnitDebuff("target","Serpent Sting","","player") then
ssremain=0
elseif UnitDebuff("target","Serpent Sting","","player") then
ssremain=select(7,UnitDebuff("target","Serpent Sting","","player"))-GetTime()
end
------AOE------
if aoeflag and pt==2 then
if not UnitCastingInfo("player") and select(2,IsUsableSpell("Multi-Shot"))==nil and GetSpellCooldown("Multi-Shot")==0 then
cast("Multi-Shot")
elseif not UnitCastingInfo("player") and UnitBuff("player","Fire!") and GetSpellCooldown("Steady Shot")==0 then
RunMacroText("/click BT4Button27")
elseif not UnitCastingInfo("player") and UnitPower("player")<=39 and GetSpellCooldown("Steady Shot")==0 then
cast("Steady Shot")
end
elseif aoeflag and pt==3 then
if not UnitCastingInfo("player") and select(2,IsUsableSpell("Multi-Shot"))==nil and GetSpellCooldown("Multi-Shot")==0 then
cast("Multi-Shot")
elseif not UnitCastingInfo("player") and GetSpellCooldown("Cobra Shot")==0 then
cast("Cobra Shot")
end
end
------RAPID FIRE AND READINESS------
if (UnitLevel("target")==-1 or (UnitLevel("target")==UnitLevel("player")+2 and select(2,GetInstanceInfo())=="party")) then
if not UnitCastingInfo("player") then
if GetSpellCooldown("Rapid Fire")==0 and GetSpellCooldown("Serpent Sting")==0 and not UnitBuff("player","Bloodlust") and UnitHealth("target")/UnitHealthMax("target")>=0.05 then
cast("Rapid Fire")
elseif pt==2 and GetSpellCooldown("Readiness")==0 and GetSpellCooldown("Serpent Sting")==0 and (GetSpellCooldown("Rapid Fire")+select(2,GetSpellCooldown("Rapid Fire"))-GetTime()>30) and not UnitBuff("player","Rapid Fire") and UnitHealth("target")/UnitHealthMax("target")>=0.05 then
cast("Readiness")
end
end
end
------PET HEAL------
if UnitExists("pet") then
if UnitHealth("pet")/UnitHealthMax("pet")<0.60 and not UnitBuff("pet","Mend Pet") then
cast("Mend Pet")
end
end
------PHASES AND MAIN------
if UnitHealth("target")/UnitHealthMax("target")>=0.90 then
phase=1
elseif UnitHealth("target")/UnitHealthMax("target")<0.90 and UnitHealth("target")/UnitHealthMax("target")>=0.20 then
phase=2
elseif UnitHealth("target")/UnitHealthMax("target")<0.20 then
phase=3
end
if UnitAura("player","Aspect of the Fox") and not UnitCastingInfo("player") and GetSpellCooldown("Steady Shot")==0 then
cast("Steady Shot")
end
if not aoeflag and pt==2 then
if phase==1 and not UnitCastingInfo("player") then
if UnitBuff("player","Fire!") and GetSpellCooldown("Aimed Shot")==0 then
RunMacroText("/click BT4Button27")
elseif GetSpellCooldown("Aimed Shot")==0 and UnitPower("player")>=75 or (select(2,IsUsableSpell("Aimed Shot"))==nil and (UnitBuff("player","Bloodlust") or UnitBuff("player","Rapid Fire"))) then
cast("Aimed Shot")
elseif UnitPower("player")<79 and not UnitCastingInfo("player") and GetSpellCooldown("Steady Shot")==0 then
cast("Steady Shot")
end
elseif phase==2 and not UnitCastingInfo("player") then
if ssremain==0 and GetSpellCooldown("Serpent Sting")==0 and select(2,IsUsableSpell("Serpent Sting"))==nil then
cast("Serpent Sting")
elseif select(2,IsUsableSpell("Chimera Shot"))==nil and GetSpellCooldown("Chimera Shot")==0 and GetSpellCooldown("Serpent Sting")==0 then
cast("Chimera Shot")
elseif UnitBuff("player","Fire!") and GetSpellCooldown("Aimed Shot")==0 then
RunMacroText("/click BT4Button27")
elseif GetSpellCooldown("Aimed Shot")==0 and select(2,IsUsableSpell("Aimed Shot"))==nil and (GetSpellCooldown("Chimera Shot")>5 or UnitBuff("player","Bloodlust") or UnitBuff("player","Rapid Fire")) then
cast("Aimed Shot")
elseif not UnitBuff("player","Improved Steady Shot") and GetSpellCooldown("Steady Shot")==0 then
cast("Steady Shot")
elseif GetSpellCooldown("Steady Shot")==0 then
cast("Steady Shot")
end
elseif phase==3 and not UnitCastingInfo("player") then
if ssremain==0 and GetSpellCooldown("Serpent Sting")==0 and select(2,IsUsableSpell("Serpent Sting"))==nil then
cast("Serpent Sting")
elseif GetSpellCooldown("Kill Shot")==0 and GetSpellCooldown("Steady Shot")==0 then
cast("Kill Shot")
elseif select(2,IsUsableSpell("Chimera Shot"))==nil and GetSpellCooldown("Chimera Shot")==0 and GetSpellCooldown("Serpent Sting")==0 then
cast("Chimera Shot")
elseif UnitBuff("player","Fire!") and GetSpellCooldown("Aimed Shot")==0 then
RunMacroText("/click BT4Button27")
elseif GetSpellCooldown("Aimed Shot")==0 and select(2,IsUsableSpell("Aimed Shot"))==nil and (GetSpellCooldown("Chimera Shot")>5 or UnitBuff("player","Bloodlust") or UnitBuff("player","Rapid Fire")) then
cast("Aimed Shot")
elseif not UnitBuff("player","Improved Steady Shot") and GetSpellCooldown("Steady Shot")==0 then
cast("Steady Shot")
elseif GetSpellCooldown("Steady Shot")==0 then
cast("Steady Shot")
end
end
elseif not aoeflag and pt==3 then
if (phase==1 or phase==2) and not UnitCastingInfo("player") then
if ssremain==0 and GetSpellCooldown("Serpent Sting")==0 and select(2,IsUsableSpell("Serpent Sting"))==nil then
cast("Serpent Sting")
elseif UnitBuff("player","Lock and Load") and select(2,IsUsableSpell("Explosive Shot"))==nil and GetSpellCooldown("Explosive Shot")==0 and GetSpellCooldown("Serpent Sting")==0 then
cast("Explosive Shot")
elseif select(2,IsUsableSpell("Explosive Shot"))==nil and GetSpellCooldown("Explosive Shot")==0 and GetSpellCooldown("Serpent Sting")==0 then
cast("Explosive Shot")
elseif select(2,IsUsableSpell("Black Arrow"))==nil and GetSpellCooldown("Black Arrow")==0 and GetSpellCooldown("Serpent Sting")==0 then
cast("Black Arrow")
elseif UnitPower("player")>60 and not UnitBuff("player","Lock and Load") and select(2,IsUsableSpell("Arcane Shot"))==nil and GetSpellCooldown("Arcane Shot")==0 and GetSpellCooldown("Serpent Sting")==0 then
cast("Arcane Shot")
elseif select(2,IsUsableSpell("Cobra Shot"))==nil and GetSpellCooldown("Cobra Shot")==0 and GetSpellCooldown("Serpent Sting")==0 then
cast("Cobra Shot")
end
elseif phase==3 and not UnitCastingInfo("player") then
if ssremain==0 and GetSpellCooldown("Serpent Sting")==0 and select(2,IsUsableSpell("Serpent Sting"))==nil then
cast("Serpent Sting")
elseif UnitBuff("player","Lock and Load") and select(2,IsUsableSpell("Explosive Shot"))==nil and GetSpellCooldown("Explosive Shot")==0 and GetSpellCooldown("Serpent Sting")==0 then
cast("Explosive Shot")
elseif select(2,IsUsableSpell("Explosive Shot"))==nil and GetSpellCooldown("Explosive Shot")==0 and GetSpellCooldown("Serpent Sting")==0 then
cast("Explosive Shot")
elseif select(2,IsUsableSpell("Black Arrow"))==nil and GetSpellCooldown("Black Arrow")==0 and GetSpellCooldown("Serpent Sting")==0 then
cast("Black Arrow")
elseif GetSpellCooldown("Kill Shot")==0 and GetSpellCooldown("Steady Shot")==0 then
cast("Kill Shot")
elseif UnitPower("player")>60 and not UnitBuff("player","Lock and Load") and select(2,IsUsableSpell("Arcane Shot"))==nil and GetSpellCooldown("Arcane Shot")==0 and GetSpellCooldown("Serpent Sting")==0 then
cast("Arcane Shot")
elseif select(2,IsUsableSpell("Cobra Shot"))==nil and GetSpellCooldown("Cobra Shot")==0 and GetSpellCooldown("Serpent Sting")==0 then
cast("Cobra Shot")
end
end
end