private void DodgeSkillShots()
{
if (!Situation.ShouldDodge())
{
IsDodging = false;
return;
}
/*
if (isDodging && playerInDanger == false) //serverpos test
{
GameData.MyHero.IssueOrder(GameObjectOrder.HoldPosition, myHero, false);
}*/
if (IsDodging)
{
ConsoleDebug.WriteLineColor("Dodging Skill Shots by walking", ConsoleColor.Green);
if (LastPosInfo != null)
{
/*foreach (KeyValuePair<int, Spell> entry in SpellDetector.spells)
{
Spell spell = entry.Value;
ConsoleDebug.WriteLine("" + (int)(TickCount-spell.startTime));
}*/
Vector2 lastBestPosition = LastPosInfo.Position;
if (!ConfigValue.ClickOnlyOnce.GetBool() || !(GameData.MyHero.Path.Length > 0 && LastPosInfo.Position.Distance(GameData.MyHero.Path.Last().To2D()) < 5))
//|| lastPosInfo.timestamp > lastEvadeOrderTime)
{
EvadeCommand.MoveTo(lastBestPosition);
LastEvadeOrderTime = EvadeUtils.TickCount;
}
}
}
else //if not dodging
{
//Check if hero will walk into a skillshot
var path = GameData.MyHero.Path;
if (path.Length > 0)
{
var movePos = path[path.Length - 1].To2D();
if (EvadeHelper.CheckMovePath(movePos))
{
/*if (() Properties.Properties.Data["AllowCrossing"].Cast<CheckBox>().CurrentValue)
{
var extraDelayBuffer = () Properties.Properties.Data["ExtraPingBuffer"]
+ 30;
var extraDist = () Properties.Properties.Data["ExtraCPADistance"]
+ 10;
var tPosInfo = EvadeHelper.CanHeroWalkToPos(movePos, GameData.HeroInfo.moveSpeed, extraDelayBuffer + Game.Ping, extraDist);
if (tPosInfo.posDangerLevel == 0)
{
lastPosInfo = tPosInfo;
return;
}
}*/
var posInfo = EvadeHelper.GetBestPositionMovementBlock(movePos);
if (posInfo != null)
{
EvadeCommand.MoveTo(posInfo.Position);
}
return;
}
}
}
}