I too noticed that soul harvest wasn't very reliable. Even when there were lots of enemies around, it would pop off as soon as the first got in range, and the "number of enemies in range" didn't seem very reliable for some reason. I borrowed the hostile unit count function from GearSwap's 3enemy/5enemy conditions, and placed it inside the WitchDoctorCombat class:
Code:
private static float validDistance = 16f;
private static bool IsValidHosileUnit(DiaUnit unit)
{
try
{
if (unit != null && unit.IsAlive && unit.IsAttackable && unit.Distance <= validDistance && unit.IsHostile)
return true;
else
return false;
}
catch
{
return false;
}
}
I then changed the soul harvest area to be this:
Code:
bool hasSwallowYourSoul = HotbarSkills.AssignedSkills.Any(s => s.Power == SNOPower.Witchdoctor_SoulHarvest && s.RuneIndex == 3);
int enemyCount = ZetaDia.Actors.GetActorsOfType<DiaUnit>(true, false).Count(IsValidHosileUnit);
// Soul Harvest Any Elites or to increase buff stacks
if (CanCast(SNOPower.Witchdoctor_SoulHarvest) &&
(enemyCount >= 5
|| (hasSwallowYourSoul && Player.PrimaryResourcePct <= 0.50)
|| (TargetUtil.IsEliteTargetInRange(12f)&& enemyCount > GetBuffStacks(SNOPower.Witchdoctor_SoulHarvest))))
{
return new TrinityPower(SNOPower.Witchdoctor_SoulHarvest);
}
This replaces everything between:
Code:
// Witch Doctor - Terror
[old code replaced here]
// Sacrifice
Basically, it will always use it when it's up and there are at least 5 hostile enemies in range. If you use SYS rune, it'll also use it if you need mana (I haven't tested this, since I don't use SYS, so this may need to be tweaked). If there's an elite in range, and there are more enemies in range than you have stacks, it will use it, since some damage increase is better than none on elites.
These changes will prevent it from overwriting a 5 stack with a 3 stack "just because" it's available. It seems pretty reliable to me so far with my tests, however I've changed to the Soul to Waste rune while botting, just to ensure that there's always a 5 stack up.