private void RecalculatePath()
{
if (ConfigValue.RecalculatePath.GetBool() && IsDodging) //recheck path
{
if (LastPosInfo != null && !LastPosInfo.RecalculatedPath)
{
var path = GameData.MyHero.Path;
if (path.Length > 0)
{
var movePos = path.Last().To2D();
if (movePos.Distance(LastPosInfo.Position) < 5) //more strict checking
{
var posInfo = EvadeHelper.CanHeroWalkToPos(movePos, GameData.HeroInfo.MoveSpeed, 0, 0, false);
if (posInfo.PosDangerCount > LastPosInfo.PosDangerCount)
{
LastPosInfo.RecalculatedPath = true;
if (EvadeSpell.PreferEvadeSpell())
{
LastPosInfo = PositionInfo.SetAllUndodgeable();
}
else
{
var newPosInfo = EvadeHelper.GetBestPosition();
if (newPosInfo.PosDangerCount < posInfo.PosDangerCount)
{
LastPosInfo = newPosInfo;
CheckHeroInDanger();
DodgeSkillShots();
}
}
}
}
}
}
}
}