No tested but use code like
internal void MultiTargetRotation()
{
var unitsAffectingMyCombat = ObjectManager.GetUnitAttackPlayer();
if (unitsAffectingMyCombat.Count <= 0)
return;
var unitsAttackMe = unitsAffectingMyCombat.Where(u => u != null && u.IsValid && u.IsTargetingMe).ToList();
if (unitsAttackMe.Count > 1)
{
var unitToAttack = unitsAttackMe.FirstOrDefault(u => u != null && u.IsValid && !u.IsMyPetTarget);
if (unitToAttack != null && unitToAttack.IsValid && unitToAttack.IsAlive)
{
if (!unitToAttack.IsMyTarget)
Interact.InteractGameObject(unitToAttack.GetBaseAddress, !ObjectManager.Me.GetMove);
if (unitToAttack.IsMyTarget)
Lua.LuaDoString("PetAttack();");
Logging.Write("PET ATTACKING: " + unitToAttack);
}
}
//IF ALL THE MOBS ARE ATTACKING THE PET FOCUS THE LOWER HP ONE
else
{
var unitsAttackPet = unitsAffectingMyCombat.Where(u => u != null && u.IsValid && u.IsTargetingMyPet).ToList();
var lowerHpUnit = unitsAttackPet.OrderBy(unit => unit.HealthPercent).FirstOrDefault();
if (lowerHpUnit != null && lowerHpUnit.IsValid && lowerHpUnit.IsAlive && !lowerHpUnit.IsMyPetTarget)
{
if (!lowerHpUnit.IsMyTarget)
Interact.InteractGameObject(lowerHpUnit.GetBaseAddress, !ObjectManager.Me.GetMove);
if (lowerHpUnit.IsMyTarget)
Lua.LuaDoString("PetAttack();");
Logging.Write("PET ATTACKING LOWER HP: " + lowerHpUnit);
}
}
}