private void SpellDetector_OnProcessDetectedSpells()
{
GameData.HeroInfo.UpdateInfo();
if (!ConfigValue.DodgeSkillShots.GetBool())
{
LastPosInfo = PositionInfo.SetAllUndodgeable();
EvadeSpell.UseEvadeSpell();
return;
}
if (GameData.HeroInfo.ServerPos2D.CheckDangerousPos(0) || GameData.HeroInfo.ServerPos2DExtra.CheckDangerousPos(0))
{
if (EvadeSpell.PreferEvadeSpell())
{
LastPosInfo = PositionInfo.SetAllUndodgeable();
}
else
{
var calculationTimer = EvadeUtils.TickCount;
var posInfo = EvadeHelper.GetBestPosition();
var caculationTime = EvadeUtils.TickCount - calculationTimer;
if (NumCalculationTime > 0)
{
SumCalculationTime += caculationTime;
AvgCalculationTime = SumCalculationTime/NumCalculationTime;
}
NumCalculationTime += 1;
//ConsoleDebug.WriteLine("CalculationTime: " + caculationTime);
/*if (EvadeHelper.GetHighestDetectedSpellID() > EvadeHelper.GetHighestSpellID(posInfo))
{
return;
}*/
if (posInfo != null)
{
LastPosInfo = posInfo.CompareLastMovePos();
var travelTime = GameData.HeroInfo.ServerPos2DPing.Distance(LastPosInfo.Position)/GameData.MyHero.MoveSpeed;
LastPosInfo.EndTime = EvadeUtils.TickCount + travelTime*1000 - 100;
}
CheckHeroInDanger();
DodgeSkillShots(); //walking
CheckLastMoveTo();
EvadeSpell.UseEvadeSpell(); //using spells
}
}
else
{
LastPosInfo = PositionInfo.SetAllDodgeable();
CheckLastMoveTo();
}
//ConsoleDebug.WriteLine("SkillsDodged: " + lastPosInfo.dodgeableSpells.Count + " DangerLevel: " + lastPosInfo.undodgeableSpells.Count);
}
}