private void SpellDetector_OnProcessDetectedSpells() { if (EvadeHelper.CheckDangerousPos(myHero.ServerPosition.To2D(), 0)) { if (Evade.menu.SubMenu("Main").Item("DodgeSkillShots").GetValue <KeyBind>().Active == false || EvadeSpell.PreferEvadeSpell()) { lastPosInfo = EvadeHelper.SetAllUndodgeable(); EvadeSpell.UseEvadeSpell(); //using spells } else { var posInfo = EvadeHelper.GetBestPosition(); /*if (EvadeHelper.GetHighestDetectedSpellID() > EvadeHelper.GetHighestSpellID(posInfo)) * { * return; * }*/ if (lastPosInfo != null && posInfo != null && lastPosInfo.posDangerCount < posInfo.posDangerCount) { return; } lastPosInfo = posInfo; CheckHeroInDanger(); DodgeSkillShots(); //walking EvadeSpell.UseEvadeSpell(); //using spells } } else { lastPosInfo = EvadeHelper.SetAllDodgeable(); } //Game.PrintChat("SkillsDodged: " + lastPosInfo.dodgeableSpells.Count + " DangerLevel: " + lastPosInfo.undodgeableSpells.Count); }
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; } } } }