if (_enduringCrySlot != -1)
{
// See if we can use the skill.
var skill = LokiPoe.InGameState.SkillBarPanel.Slot(_enduringCrySlot);
var endCharges = LokiPoe.Me.Auras.FirstOrDefault(a => a.InternalName.ToLower().Contains("endurance"));
Func<bool> eCryCondition = () => endCharges == null || endCharges.TimeLeft.Seconds <= 3; // this is what you need to consider
if (_enduringCrySlot != -1)
{
// See if we can use the skill.
var skill = LokiPoe.InGameState.SkillBarPanel.Slot(_enduringCrySlot);
if (skill.CanUse())
{
if (eCryCondition.Invoke()) // This magically returns true if eCryCondition matches one of the 2 written above
{
if (Utility.NumberOfMobsNear(LokiPoe.Me, 30) > 0)
{
var err1 = LokiPoe.InGameState.SkillBarPanel.Use(_enduringCrySlot, true);
if (err1 == LokiPoe.InGameState.UseError.None)
{
await Coroutine.Sleep(Utility.LatencySafeValue(500));
await Coroutines.FinishCurrentAction(false);
return true;
}
Log.ErrorFormat("[Logic] Use returned {0} for {1}.", err1, skill.Name);
}
}
}
}
}