I took what you did with the hunter spam, and expanded it slightly. Also, it is 3 seperate peices as to be used in all situations, not just grinding a single mob 1 and another. Mostly, I use this for PvP.
Each one always checks health and will do the appropriate action. I do not include Feign Death here, but I have debated it. With a little tweaking, this can fit any hunter's needs dependent on play-style.
Pet Attack: Checks health... sends pet in, checks for targets etc.
Code:
local itemList = {
"Greater Healing Potion",
"Healthstone",
}
if (UnitHealth("player") < 300) then ItemUse(itemList)
if (UnitAffectingCombat("pet")) then TargetUnit("pettarget")
end
if (UnitIsDead("target") or not UnitCanAttack("player", "target")) then
ClearTarget()
TargetNearestEnemy()
end
if (UnitExists("target")) then PetAttack()
else Debug("Nothing to attack")
return
end
Range Attack: Checks health... If target is under 20% health it will slow them... if above 40% it will Hunter's Mark (under that amount, it is probably too close to death and just a waste of mana)... Finally checks for Serpent sting, applies and moves onto AutoShot and Arcane Shot. Due to
Aimed Shot being a long cast, I use it seperately.
Code:
local itemList = {
"Greater Healing Potion",
"Healthstone",
}
if (UnitHealth("player") < 300) then ItemUse(itemList)
elseif SpellReady("Concussive Shot") and (UnitHealth("target") > 20) and (not BuffActive("target", "Concussive Shot")) then CastSpell("Concussive Shot")
elseif (not DebuffActive("target", "Hunter's Mark")) and (UnitHealth("target") < 40) then CastSpell("Hunter's Mark")
elseif SpellReady("Serpent Sting") and (not BuffActive("target", "Serpent Sting")) then CastSpell("Serpent Sting")
elseif SpellReady("Arcane Shot") then CastSpell("Arcane Shot")
else CastSpell("Auto Shot")
end
Melee Attack: Pretty much a melee version of the above Ranged Attack code. Checks health... slows if under 20%... does Mongoose Bite if available, if not it Attacks and does Raptor Strike when available.
Code:
local itemList = {
"Greater Healing Potion",
"Healthstone",
}
if (UnitHealth("player") < 300) then ItemUse(itemList)
elseif SpellReady("Wing Clip") and (UnitHealth("target") > 20) and (not DebuffActive("target", "Wing Clip")) then CastSpell("Wing Clip")
elseif SpellReady("Mongoose Bite") then CastSpell("Mongoose Bite")
elseif SpellReady("Raptor Strike") then CastSpell("Raptor Strike")
else CastSpell("Attack")
end
Mad props to Shag for the examples. Couldn't have continued this without it.