private void DodgeSkillShots() { if (!Situation.ShouldDodge()) { isDodging = false; return; } /* * if (isDodging && playerInDanger == false) //serverpos test * { * myHero.IssueOrder(GameObjectOrder.HoldPosition, myHero, false); * }*/ if (isDodging) { if (lastPosInfo != null) { /*foreach (KeyValuePair<int, Spell> entry in SpellDetector.spells) * { * Spell spell = entry.Value; * * Game.PrintChat("" + (int)(GetTickCount()-spell.startTime)); * }*/ Vector2 lastBestPosition = lastPosInfo.position; if (menu.SubMenu("MiscSettings").Item("RecalculatePosition").GetValue <bool>())//recheck path { var path = myHero.Path; if (path.Length > 0) { var movePos = path[path.Length - 1].To2D(); if (movePos.Distance(lastPosInfo.position) < 5) //more strict checking { var posInfo = EvadeHelper.CanHeroWalkToPos(movePos, myHero.MoveSpeed, 0, 0, false); if (EvadeHelper.isSamePosInfo(posInfo, lastPosInfo) && posInfo.posDangerCount > lastPosInfo.posDangerCount) { var newPosInfo = EvadeHelper.GetBestPosition(); if (newPosInfo.posDangerCount < posInfo.posDangerCount) { lastPosInfo = newPosInfo; CheckHeroInDanger(); } else if (EvadeSpell.PreferEvadeSpell()) { lastPosInfo = EvadeHelper.SetAllUndodgeable(); EvadeSpell.UseEvadeSpell(); //using spells) } } } } } EvadeCommand.MoveTo(lastBestPosition); } } else //if not dodging { //Check if hero will walk into a skillshot var path = myHero.Path; if (path.Length > 0) { var movePos = path[path.Length - 1].To2D(); if (EvadeHelper.CheckMovePath(movePos)) { var posInfo = EvadeHelper.GetBestPositionMovementBlock(movePos); if (posInfo != null) { EvadeCommand.MoveTo(posInfo.position); } return; } } } }