public static PositionInfo GetBestPositionTargetedDash(EvadeSpellData spell) { /*if (spell.spellDelay > 0) * { * if (CheckWindupTime(spell.spellDelay)) * { * return null; * } * }*/ var extraDelayBuffer = ObjectCache.menuCache.cache["ExtraPingBuffer"].GetValue <Slider>().Value; var extraEvadeDistance = 100;// Evade.menu.SubMenu("MiscSettings").SubMenu("ExtraBuffers").Item("ExtraEvadeDistance").GetValue<Slider>().Value; var extraDist = ObjectCache.menuCache.cache["ExtraCPADistance"].GetValue <Slider>().Value; Vector2 heroPoint = ObjectCache.myHeroCache.serverPos2DPing; Vector2 lastMovePos = Game.CursorPos.To2D(); List <PositionInfo> posTable = new List <PositionInfo>(); List <int> spellList = SpellDetector.GetSpellList(); int minDistance = 50; //Math.Min(spell.range, minDistance) int maxDistance = int.MaxValue; if (spell.fixedRange) { minDistance = maxDistance = (int)spell.range; } List <Obj_AI_Base> collisionCandidates = new List <Obj_AI_Base>(); if (spell.spellTargets.Contains(SpellTargets.Targetables)) { foreach (var obj in ObjectManager.Get <Obj_AI_Base>() .Where(h => !h.IsMe && h.IsValidTarget(spell.range, false))) { if (!obj.IsValid <Obj_AI_Turret>()) { collisionCandidates.Add(obj); } } } else { List <Obj_AI_Hero> heroList = new List <Obj_AI_Hero>(); if (spell.spellTargets.Contains(SpellTargets.EnemyChampions) && spell.spellTargets.Contains(SpellTargets.AllyChampions)) { heroList = HeroManager.AllHeroes; } else if (spell.spellTargets.Contains(SpellTargets.EnemyChampions)) { heroList = HeroManager.Enemies; } else if (spell.spellTargets.Contains(SpellTargets.AllyChampions)) { heroList = HeroManager.Allies; } foreach (var hero in heroList.Where(h => !h.IsMe && h.IsValidTarget(spell.range))) { collisionCandidates.Add(hero); } List <Obj_AI_Base> minionList = new List <Obj_AI_Base>(); if (spell.spellTargets.Contains(SpellTargets.EnemyMinions) && spell.spellTargets.Contains(SpellTargets.AllyMinions)) { minionList = MinionManager.GetMinions(spell.range, MinionTypes.All, MinionTeam.All); } else if (spell.spellTargets.Contains(SpellTargets.EnemyMinions)) { minionList = MinionManager.GetMinions(spell.range, MinionTypes.All, MinionTeam.Enemy); } else if (spell.spellTargets.Contains(SpellTargets.AllyMinions)) { minionList = MinionManager.GetMinions(spell.range, MinionTypes.All, MinionTeam.Ally); } foreach (var minion in minionList.Where(h => h.IsValidTarget(spell.range))) { collisionCandidates.Add(minion); } } foreach (var candidate in collisionCandidates) { var pos = candidate.ServerPosition.To2D(); PositionInfo posInfo; if (spell.spellName == "YasuoDashWrapper") { bool hasDashBuff = false; foreach (var buff in candidate.Buffs) { if (buff.Name == "YasuoDashWrapper") { hasDashBuff = true; break; } } if (hasDashBuff) { continue; } } if (spell.behindTarget) { var dir = (pos - heroPoint).Normalized(); pos = pos + dir * (candidate.BoundingRadius + ObjectCache.myHeroCache.boundingRadius); } if (spell.infrontTarget) { var dir = (pos - heroPoint).Normalized(); pos = pos - dir * (candidate.BoundingRadius + ObjectCache.myHeroCache.boundingRadius); } if (spell.fixedRange) { var dir = (pos - heroPoint).Normalized(); pos = heroPoint + dir * spell.range; } if (spell.evadeType == EvadeType.Dash) { posInfo = CanHeroWalkToPos(pos, spell.speed, extraDelayBuffer + ObjectCache.gamePing, extraDist); posInfo.isDangerousPos = pos.CheckDangerousPos(6); posInfo.distanceToMouse = pos.GetPositionValue(); posInfo.spellList = spellList; } else { bool isDangerousPos = pos.CheckDangerousPos(6); var dist = pos.GetPositionValue(); posInfo = new PositionInfo(pos, isDangerousPos, dist); } posInfo.target = candidate; posTable.Add(posInfo); } if (spell.evadeType == EvadeType.Dash) { var sortedPosTable = posTable.OrderBy(p => p.isDangerousPos) .ThenBy(p => p.posDangerLevel) .ThenBy(p => p.posDangerCount) .ThenBy(p => p.distanceToMouse); var first = sortedPosTable.FirstOrDefault(); if (first != null && Evade.lastPosInfo != null && first.isDangerousPos == false && Evade.lastPosInfo.posDangerLevel > first.posDangerLevel) { return(first); } } else { var sortedPosTable = posTable.OrderBy(p => p.isDangerousPos) //.ThenByDescending(p => p.hasComfortZone) //.ThenBy(p => p.hasExtraDistance) .ThenBy(p => p.distanceToMouse); var first = sortedPosTable.FirstOrDefault(); return(first); } return(null); }
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; Console.WriteLine("" + (int)(TickCount-spell.startTime)); }*/ Vector2 lastBestPosition = lastPosInfo.position; if (ObjectCache.menuCache.cache["RecalculatePosition"].GetValue<bool>())//recheck path { var dodgeInterval = ObjectCache.menuCache.cache["DodgeInterval"].GetValue<Slider>().Value; if (lastPosInfo != null && !lastPosInfo.recalculatedPath && dodgeInterval <= EvadeUtils.TickCount - lastPosInfo.timestamp) { 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, ObjectCache.myHeroCache.moveSpeed, 0, 0, false); if (posInfo.isSamePosInfo(lastPosInfo) && posInfo.posDangerCount > lastPosInfo.posDangerCount) { var newPosInfo = EvadeHelper.GetBestPosition(); if (newPosInfo.posDangerCount < posInfo.posDangerCount) { lastPosInfo = newPosInfo; CheckHeroInDanger(); } else if (EvadeSpell.PreferEvadeSpell()) { lastPosInfo = PositionInfo.SetAllUndodgeable(); } else { lastPosInfo.recalculatedPath = true; } } } } } } if (ObjectCache.menuCache.cache["ClickOnlyOnce"].GetValue<bool>() == false || lastPosInfo.timestamp > lastEvadeOrderTime) { if (Game.Time * 1000 - lastIssueOrderTime < 1) { DelayAction.Add(0, () => EvadeCommand.MoveTo(lastBestPosition)); lastEvadeOrderTime = EvadeUtils.TickCount; } else { EvadeCommand.MoveTo(lastBestPosition); lastEvadeOrderTime = EvadeUtils.TickCount; } } } } 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) { if (Game.Time * 1000 - lastIssueOrderTime < 1) //check? { DelayAction.Add(0, () => EvadeCommand.MoveTo(posInfo.position)); } else { EvadeCommand.MoveTo(posInfo.position); } } return; } } } }
public static void SetAllUndodgeable() { lastPosInfo = PositionInfo.SetAllUndodgeable(); }
private void RecalculatePath() { if (ObjectCache.menuCache.cache["RecalculatePosition"].Cast<CheckBox>().CurrentValue && isDodging) //recheck path { if (lastPosInfo != null && !lastPosInfo.recalculatedPath) { var path = 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, ObjectCache.myHeroCache.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(); } } } } } } } }
public static bool CompareEvadeOption(PositionInfo posInfo, bool checkSpell = false) { if (checkSpell) { if (posInfo.posDangerLevel == 0) { return true; } } return posInfo.isBetterMovePos(); }
public static PositionInfo GetBestPositionBlink() { int posChecked = 0; int maxPosToCheck = 100; int posRadius = 50; int radiusIndex = 0; var extraEvadeDistance = 100;//Evade.menu.SubMenu("MiscSettings").SubMenu("ExtraBuffers").Item("ExtraAvoidDistance").GetValue<Slider>().Value; Vector2 heroPoint = ObjectCache.myHeroCache.serverPos2DPing; Vector2 lastMovePos = Game.CursorPos.To2D(); int minComfortZone = ObjectCache.menuCache.cache["MinComfortZone"].Cast<Slider>().CurrentValue; List<PositionInfo> posTable = new List<PositionInfo>(); while (posChecked < maxPosToCheck) { radiusIndex++; int curRadius = radiusIndex * (2 * posRadius); int curCircleChecks = (int)Math.Ceiling((2 * Math.PI * (double)curRadius) / (2 * (double)posRadius)); for (int i = 1; i < curCircleChecks; i++) { posChecked++; var cRadians = (2 * Math.PI / (curCircleChecks - 1)) * i; //check decimals var pos = new Vector2((float)Math.Floor(heroPoint.X + curRadius * Math.Cos(cRadians)), (float)Math.Floor(heroPoint.Y + curRadius * Math.Sin(cRadians))); bool isDangerousPos = pos.CheckDangerousPos(6); var dist = pos.GetPositionValue(); var posInfo = new PositionInfo(pos, isDangerousPos, dist); posInfo.hasExtraDistance = extraEvadeDistance > 0 ? pos.CheckDangerousPos(extraEvadeDistance) : false; posInfo.posDistToChamps = pos.GetDistanceToChampions(); if (minComfortZone < posInfo.posDistToChamps) { posTable.Add(posInfo); } } } var sortedPosTable = posTable.OrderBy(p => p.isDangerousPos) .ThenBy(p => p.hasExtraDistance) .ThenBy(p => p.distanceToMouse); foreach (var posInfo in sortedPosTable) { if (CheckPointCollision(myHero, posInfo.position) == false) return posInfo; } return null; }
private void SpellDetector_OnProcessDetectedSpells() { ObjectCache.myHeroCache.UpdateInfo(); if (ObjectCache.menuCache.cache["DodgeSkillShots"].GetValue<KeyBind>().Active == false) { lastPosInfo = PositionInfo.SetAllUndodgeable(); EvadeSpell.UseEvadeSpell(); return; } if (ObjectCache.myHeroCache.serverPos2D.CheckDangerousPos(0) || ObjectCache.myHeroCache.serverPos2DExtra.CheckDangerousPos(0)) { if (EvadeSpell.PreferEvadeSpell()) { lastPosInfo = PositionInfo.SetAllUndodgeable(); } else { var posInfo = EvadeHelper.GetBestPosition(); var calculationTimer = EvadeUtils.TickCount; var caculationTime = EvadeUtils.TickCount - calculationTimer; if (posInfo != null) { lastPosInfo = posInfo.CompareLastMovePos(); var travelTime = ObjectCache.myHeroCache.serverPos2DPing.Distance(lastPosInfo.position) / myHero.MoveSpeed; lastPosInfo.endTime = EvadeUtils.TickCount + travelTime * 1000 - 100; } CheckHeroInDanger(); DodgeSkillShots(); //walking CheckLastMoveTo(); EvadeSpell.UseEvadeSpell(); //using spells } } else { lastPosInfo = PositionInfo.SetAllDodgeable(); CheckLastMoveTo(); } }
public static PositionInfo GetBestPositionMovementBlock(Vector2 movePos) { int posChecked = 0; int maxPosToCheck = 50; int posRadius = 50; int radiusIndex = 0; var extraEvadeDistance = ObjectCache.menuCache.cache["ExtraAvoidDistance"].GetValue<Slider>().Value; Vector2 heroPoint = ObjectCache.myHeroCache.serverPos2D; Vector2 lastMovePos = movePos;//Game.CursorPos.To2D(); //movePos List<PositionInfo> posTable = new List<PositionInfo>(); while (posChecked < maxPosToCheck) { radiusIndex++; int curRadius = radiusIndex * (2 * posRadius); int curCircleChecks = (int)Math.Ceiling((2 * Math.PI * (double)curRadius) / (2 * (double)posRadius)); for (int i = 1; i < curCircleChecks; i++) { posChecked++; var cRadians = (2 * Math.PI / (curCircleChecks - 1)) * i; //check decimals var pos = new Vector2((float)Math.Floor(heroPoint.X + curRadius * Math.Cos(cRadians)), (float)Math.Floor(heroPoint.Y + curRadius * Math.Sin(cRadians))); bool isDangerousPos = pos.CheckDangerousPos(6) || CheckMovePath(pos); var dist = pos.Distance(lastMovePos); //if (pos.Distance(myHero.Position.To2D()) < 100) // dist = 0; var posInfo = new PositionInfo(pos, isDangerousPos, dist); //posInfo.intersectionTime = GetMovementBlockPositionValue(pos, movePos); posInfo.hasExtraDistance = extraEvadeDistance > 0 ? pos.HasExtraAvoidDistance(extraEvadeDistance) : false; posTable.Add(posInfo); } } var sortedPosTable = posTable.OrderBy(p => p.isDangerousPos) .ThenBy(p => p.hasExtraDistance) .ThenBy(p => p.distanceToMouse); //.ThenBy(p => p.intersectionTime); foreach (var posInfo in sortedPosTable) { if (CheckPathCollision(myHero, posInfo.position) == false) return posInfo; } return null; }
private void Game_OnCastSpell(Spellbook spellbook, SpellbookCastSpellEventArgs args) /////LOI DOAN NAY { if (!spellbook.Owner.IsMe) { return; } var sData = spellbook.GetSpell(args.Slot); string name; if (SpellDetector.channeledSpells.TryGetValue(sData.Name, out name)) { //Evade.isChanneling = true; //Evade.channelPosition = ObjectCache.myHeroCache.serverPos2D; lastStopEvadeTime = EvadeUtils.TickCount + ObjectCache.gamePing + 100; } //block spell commmands if evade spell just used if (EvadeSpell.lastSpellEvadeCommand != null && EvadeSpell.lastSpellEvadeCommand.timestamp + ObjectCache.gamePing + 150 > EvadeUtils.TickCount) { args.Process = false; } lastSpellCast = args.Slot; lastSpellCastTime = EvadeUtils.TickCount; //moved from processPacket /*if (args.Slot == SpellSlot.Recall) * { * lastStopPosition = myHero.ServerPosition.To2D(); * }*/ if (Situation.ShouldDodge()) { if (isDodging && SpellDetector.spells.Any()) { foreach (KeyValuePair <String, SpellData> entry in SpellDetector.windupSpells) { SpellData spellData = entry.Value; if (spellData.spellKey == args.Slot) //check if it's a spell that we should block { args.Process = false; return; } } } } foreach (var evadeSpell in EvadeSpell.evadeSpells) { if (evadeSpell.isItem == false && evadeSpell.spellKey == args.Slot && evadeSpell.untargetable == false) { if (evadeSpell.evadeType == EvadeType.Blink) { var dir = (args.StartPosition.To2D() - myHero.ServerPosition.To2D()).Normalized(); var end = myHero.ServerPosition.To2D() + dir * myHero.ServerPosition.To2D().Distance(Game.CursorPos.To2D()); if (evadeSpell.fixedRange || end.Distance(myHero.ServerPosition.To2D()) > evadeSpell.range) { end = myHero.ServerPosition.To2D() + dir * evadeSpell.range; } var posInfo = EvadeHelper.CanHeroWalkToPos(end, evadeSpell.speed, ObjectCache.gamePing, 0); if (posInfo.posDangerCount < 1) { if (lastPosInfo != null) { lastPosInfo = posInfo; } if (lastPosInfo == null) { lastPosInfo = posInfo; } if (isDodging || EvadeUtils.TickCount < lastDodgingEndTime + 250) { EvadeCommand.MoveTo(Game.CursorPos.To2D()); lastStopEvadeTime = EvadeUtils.TickCount + ObjectCache.gamePing + 100; } return; } } if (evadeSpell.evadeType == EvadeType.Dash) { var dashPos = args.StartPosition.To2D(); if (args.Target != null) { dashPos = args.Target.Position.To2D(); } if (evadeSpell.fixedRange || dashPos.Distance(myHero.ServerPosition.To2D()) > evadeSpell.range) { var dir = (dashPos - myHero.ServerPosition.To2D()).Normalized(); dashPos = myHero.ServerPosition.To2D() + dir * evadeSpell.range; } var posInfo = EvadeHelper.CanHeroWalkToPos(dashPos, evadeSpell.speed, ObjectCache.gamePing, 0); if (posInfo.posDangerLevel > 0) { args.Process = false; } else { if (isDodging || EvadeUtils.TickCount < lastDodgingEndTime + 500) { EvadeCommand.MoveTo(Game.CursorPos.To2D()); lastStopEvadeTime = EvadeUtils.TickCount + ObjectCache.gamePing + 100; } return; } } lastPosInfo = PositionInfo.SetAllUndodgeable(); return; } } }
public static bool isSamePosInfo(this PositionInfo posInfo1, PositionInfo posInfo2) { return(new HashSet <int>(posInfo1.spellList).SetEquals(posInfo2.spellList)); }
private void Game_OnCastSpell(Spellbook spellbook, SpellbookCastSpellEventArgs args) { if (!spellbook.Owner.IsMe) { return; } var sData = spellbook.GetSpell(args.Slot); string name; if (SpellDetector.channeledSpells.TryGetValue(sData.Name, out name)) { //Evade.isChanneling = true; //Evade.channelPosition = ObjectCache.myHeroCache.serverPos2D; lastStopEvadeTime = EvadeUtils.TickCount + ObjectCache.gamePing + 100; } if (EvadeSpell.lastSpellEvadeCommand != null && EvadeSpell.lastSpellEvadeCommand.timestamp + ObjectCache.gamePing + 150 > EvadeUtils.TickCount) { args.Process = false; } lastSpellCast = args.Slot; lastSpellCastTime = EvadeUtils.TickCount; //moved from processPacket if (Situation.ShouldDodge()) { if (isDodging && SpellDetector.spells.Count() > 0) { foreach (KeyValuePair <String, SpellData> entry in SpellDetector.windupSpells) { SpellData spellData = entry.Value; if (spellData.spellKey == args.Slot) //check if it's a spell that we should block { args.Process = false; return; } } } } foreach (var evadeSpell in EvadeSpell.evadeSpells) { if (evadeSpell.isItem == false && evadeSpell.spellKey == args.Slot) { lastPosInfo = PositionInfo.SetAllUndodgeable(); if (evadeSpell.evadeType == EvadeType.Blink || evadeSpell.evadeType == EvadeType.Dash) { /*if (args.EndPosition.To2D().CheckDangerousPos(6, true)) //need testing * { * args.Process = false; * return; * }*/ if (isDodging || EvadeUtils.TickCount < lastDodgingEndTime + 500) { EvadeCommand.MoveTo(Game.CursorPos.To2D()); lastStopEvadeTime = EvadeUtils.TickCount + ObjectCache.gamePing + 100; } } return; } } }
public static PositionInfo GetBestPositionMovementBlock(Vector2 movePos) { int posChecked = 0; int maxPosToCheck = 50; int posRadius = 50; int radiusIndex = 0; var extraEvadeDistance = Evade.menu.SubMenu("MiscSettings").SubMenu("ExtraBuffers").Item("ExtraAvoidDistance").GetValue<Slider>().Value; Vector2 heroPoint = myHero.ServerPosition.To2D(); Vector2 lastMovePos = movePos; // Game.CursorPos.To2D(); List<PositionInfo> posTable = new List<PositionInfo>(); while (posChecked < maxPosToCheck) { radiusIndex++; int curRadius = radiusIndex * (2 * posRadius); int curCircleChecks = (int)Math.Ceiling((2 * Math.PI * (double)curRadius) / (2 * (double)posRadius)); for (int i = 1; i < curCircleChecks; i++) { posChecked++; var cRadians = (2 * Math.PI / (curCircleChecks - 1)) * i; //check decimals var pos = new Vector2((float)Math.Floor(heroPoint.X + curRadius * Math.Cos(cRadians)), (float)Math.Floor(heroPoint.Y + curRadius * Math.Sin(cRadians))); bool isDangerousPos = CheckDangerousPos(pos, 6) || checkMovePath(pos); var dist = pos.Distance(lastMovePos); var posInfo = new PositionInfo(pos, isDangerousPos, dist); posInfo.hasExtraDistance = extraEvadeDistance > 0 ? CheckDangerousPos(pos, extraEvadeDistance) : false; posTable.Add(posInfo); } } var sortedPosTable = posTable.OrderBy(p => p.isDangerousPos) .ThenBy(p => p.hasExtraDistance) .ThenBy(p => p.distanceToMouse); foreach (var posInfo in sortedPosTable) { if (CheckPathCollision(myHero, posInfo.position) == false) return posInfo; } return sortedPosTable.First(); }
public static bool PositionInfoStillValid(PositionInfo posInfo, float moveSpeed = 0) { return(true); //too buggy }
private void Game_OnCastSpell(Spellbook spellbook, SpellbookCastSpellEventArgs args) { if (!spellbook.Owner.IsMe) return; var sData = spellbook.GetSpell(args.Slot); string name; if (SpellDetector.channeledSpells.TryGetValue(sData.Name, out name)) { //Evade.isChanneling = true; //Evade.channelPosition = ObjectCache.myHeroCache.serverPos2D; lastStopEvadeTime = EvadeUtils.TickCount + ObjectCache.gamePing + 100; } if (EvadeSpell.lastSpellEvadeCommand != null && EvadeSpell.lastSpellEvadeCommand.timestamp + ObjectCache.gamePing + 150 > EvadeUtils.TickCount) { args.Process = false; } lastSpellCast = args.Slot; lastSpellCastTime = EvadeUtils.TickCount; //moved from processPacket if (Situation.ShouldDodge()) { if (isDodging && SpellDetector.spells.Count() > 0) { foreach (KeyValuePair<String, SpellData> entry in SpellDetector.windupSpells) { SpellData spellData = entry.Value; if (spellData.spellKey == args.Slot) //check if it's a spell that we should block { args.Process = false; return; } } } } foreach (var evadeSpell in EvadeSpell.evadeSpells) { if (evadeSpell.isItem == false && evadeSpell.spellKey == args.Slot) { lastPosInfo = PositionInfo.SetAllUndodgeable(); if (evadeSpell.evadeType == EvadeType.Blink || evadeSpell.evadeType == EvadeType.Dash) { if (isDodging || EvadeUtils.TickCount < lastDodgingEndTime + 500) { EvadeCommand.MoveTo(Game.CursorPos.To2D()); lastStopEvadeTime = EvadeUtils.TickCount + ObjectCache.gamePing + 100; } } return; } } }
private void Game_OnCastSpell(Spellbook spellbook, SpellbookCastSpellEventArgs args) { if (!spellbook.Owner.IsMe) { return; } var sData = spellbook.GetSpell(args.Slot); string name; if (SpellDetector.channeledSpells.TryGetValue(sData.Name, out name)) { //Evade.isChanneling = true; //Evade.channelPosition = ObjectCache.myHeroCache.serverPos2D; lastStopEvadeTime = EvadeUtils.TickCount + ObjectCache.gamePing + 100; } if (EvadeSpell.lastSpellEvadeCommand != null && EvadeSpell.lastSpellEvadeCommand.timestamp + ObjectCache.gamePing + 150 > EvadeUtils.TickCount) { args.Process = false; } lastSpellCast = args.Slot; lastSpellCastTime = EvadeUtils.TickCount; //moved from processPacket /*if (args.Slot == SpellSlot.Recall) * { * lastStopPosition = myHero.ServerPosition.To2D(); * }*/ if (Situation.ShouldDodge()) { if (isDodging && SpellDetector.spells.Count() > 0) { foreach (KeyValuePair <String, SpellData> entry in SpellDetector.windupSpells) { SpellData spellData = entry.Value; if (spellData.spellKey == args.Slot) //check if it's a spell that we should block { args.Process = false; return; } } } } foreach (var evadeSpell in EvadeSpell.evadeSpells) { if (evadeSpell.isItem == false && evadeSpell.spellKey == args.Slot) { if (evadeSpell.evadeType == EvadeType.Blink || evadeSpell.evadeType == EvadeType.Dash) { //Block spell cast if flashing/blinking into spells if (args.EndPosition.To2D().CheckDangerousPos(6, true)) //for blink + dash { args.Process = false; return; } if (evadeSpell.evadeType == EvadeType.Dash) { var extraDelayBuffer = ObjectCache.menuCache.cache["ExtraPingBuffer"].GetValue <Slider>().Value; var extraDist = ObjectCache.menuCache.cache["ExtraCPADistance"].GetValue <Slider>().Value; var dashPos = Game.CursorPos.To2D(); //real pos? if (evadeSpell.fixedRange) { var dir = (dashPos - myHero.ServerPosition.To2D()).Normalized(); dashPos = myHero.ServerPosition.To2D() + dir * evadeSpell.range; } //Draw.RenderObjects.Add(new Draw.RenderPosition(dashPos, 1000)); var posInfo = EvadeHelper.CanHeroWalkToPos(dashPos, evadeSpell.speed, extraDelayBuffer + ObjectCache.gamePing, extraDist); if (posInfo.posDangerLevel > 0) { args.Process = false; return; } } lastPosInfo = PositionInfo.SetAllUndodgeable(); //really? if (isDodging || EvadeUtils.TickCount < lastDodgingEndTime + 500) { EvadeCommand.MoveTo(Game.CursorPos.To2D()); //block moveto lastStopEvadeTime = EvadeUtils.TickCount + ObjectCache.gamePing + 100; } } return; } } }
public static bool PositionInfoStillValid(PositionInfo posInfo, float moveSpeed = 0) { return true; //too buggy /*if (moveSpeed == 0) moveSpeed = ObjectCache.myHeroCache.moveSpeed; var canDodge = true; foreach (KeyValuePair<int, Spell> entry in SpellDetector.spells) //final check { Spell spell = entry.Value; if (posInfo.undodgeableSpells.Contains(entry.Key)) { continue; } float timeElapsed = Evade.GetTickCount - posInfo.timestamp; if (spell.info.spellType == SpellType.Line) { if (spell.info.projectileSpeed != float.MaxValue && posInfo.closestDistance < spell.info.projectileSpeed * timeElapsed / 1000) { canDodge = false; break; } } else if (spell.info.spellType == SpellType.Circular) { if (posInfo.closestDistance < moveSpeed * timeElapsed / 1000) { canDodge = false; break; } } } return canDodge;*/ }
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; * * Console.WriteLine("" + (int)(TickCount-spell.startTime)); * }*/ Vector2 lastBestPosition = lastPosInfo.position; if (ObjectCache.menuCache.cache["RecalculatePosition"].GetValue <bool>())//recheck path { var dodgeInterval = ObjectCache.menuCache.cache["DodgeInterval"].GetValue <Slider>().Value; if (lastPosInfo != null && !lastPosInfo.recalculatedPath && dodgeInterval <= EvadeUtils.TickCount - lastPosInfo.timestamp) { 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, ObjectCache.myHeroCache.moveSpeed, 0, 0, false); if (posInfo.isSamePosInfo(lastPosInfo) && posInfo.posDangerCount > lastPosInfo.posDangerCount) { var newPosInfo = EvadeHelper.GetBestPosition(); if (newPosInfo.posDangerCount < posInfo.posDangerCount) { lastPosInfo = newPosInfo; CheckHeroInDanger(); } else if (EvadeSpell.PreferEvadeSpell()) { lastPosInfo = PositionInfo.SetAllUndodgeable(); } else { lastPosInfo.recalculatedPath = true; } } } } } } if (ObjectCache.menuCache.cache["ClickOnlyOnce"].GetValue <bool>() == false || !(myHero.Path.Count() > 0 && lastPosInfo.position.Distance(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 = myHero.Path; if (path.Length > 0) { var movePos = path[path.Length - 1].To2D(); if (EvadeHelper.CheckMovePath(movePos)) { /*if (ObjectCache.menuCache.cache["AllowCrossing"].GetValue<bool>()) * { * var extraDelayBuffer = ObjectCache.menuCache.cache["ExtraPingBuffer"] * .GetValue<Slider>().Value + 30; * var extraDist = ObjectCache.menuCache.cache["ExtraCPADistance"] * .GetValue<Slider>().Value + 10; * * var tPosInfo = EvadeHelper.CanHeroWalkToPos(movePos, ObjectCache.myHeroCache.moveSpeed, extraDelayBuffer + ObjectCache.gamePing, extraDist); * * if (tPosInfo.posDangerLevel == 0) * { * lastPosInfo = tPosInfo; * return; * } * }*/ var posInfo = EvadeHelper.GetBestPositionMovementBlock(movePos); if (posInfo != null) { EvadeCommand.MoveTo(posInfo.position); } return; } } } }
public static bool isSamePosInfo(this PositionInfo posInfo1, PositionInfo posInfo2) { return new HashSet<int>(posInfo1.spellList).SetEquals(posInfo2.spellList); }
private void Game_OnCastSpell(Spellbook spellbook, SpellbookCastSpellEventArgs args) { if (!spellbook.Owner.IsMe) { return; } var sData = spellbook.GetSpell(args.Slot); string name; if (SpellDetector.channeledSpells.TryGetValue(sData.Name, out name)) { lastStopEvadeTime = EvadeUtils.TickCount + ObjectCache.gamePing + 100; } //block spell commmands if evade spell just used if (EvadeSpell.lastSpellEvadeCommand != null && EvadeSpell.lastSpellEvadeCommand.timestamp + ObjectCache.gamePing + 150 > EvadeUtils.TickCount) { args.Process = false; } lastSpellCast = args.Slot; lastSpellCastTime = EvadeUtils.TickCount; if (Situation.ShouldDodge()) { if (isDodging && SpellDetector.spells.Count() > 0) { foreach (KeyValuePair <String, SpellData> entry in SpellDetector.windupSpells) { SpellData spellData = entry.Value; if (spellData.spellKey == args.Slot) //check if it's a spell that we should block { args.Process = false; return; } } } } foreach (var evadeSpell in EvadeSpell.evadeSpells) { if (evadeSpell.isItem == false && evadeSpell.spellKey == args.Slot && evadeSpell.untargetable == false) { if (evadeSpell.evadeType == EvadeType.Dash) { if (evadeSpell.evadeType == EvadeType.Dash) { var dashPos = args.StartPosition.LSTo2D(); //real pos? if (args.Target != null) { dashPos = args.Target.Position.LSTo2D(); } if (evadeSpell.fixedRange || dashPos.LSDistance(myHero.ServerPosition.LSTo2D()) > evadeSpell.range) { var dir = (dashPos - myHero.ServerPosition.LSTo2D()).LSNormalized(); dashPos = myHero.ServerPosition.LSTo2D() + dir * evadeSpell.range; } var posInfo = EvadeHelper.CanHeroWalkToPos(dashPos, evadeSpell.speed, ObjectCache.gamePing, 0); if (posInfo.posDangerLevel > 0) { args.Process = false; return; } } lastPosInfo = PositionInfo.SetAllUndodgeable(); if (isDodging || EvadeUtils.TickCount < lastDodgingEndTime + 500) { EvadeCommand.MoveTo(Game.CursorPos.LSTo2D()); lastStopEvadeTime = EvadeUtils.TickCount + ObjectCache.gamePing + 100; } } return; } } }
public static bool PositionInfoStillValid(PositionInfo posInfo, float moveSpeed = 0) { return true; //too buggy }
public static PositionInfo GetBestPositionTargetedDash(EvadeSpellData spell) { /*if (spell.spellDelay > 0) { if (CheckWindupTime(spell.spellDelay)) { return null; } }*/ var extraDelayBuffer = ObjectCache.menuCache.cache["ExtraPingBuffer"].Cast<Slider>().CurrentValue; //var extraEvadeDistance = 100;// Evade.menu.SubMenu("MiscSettings").SubMenu("ExtraBuffers").Item("ExtraEvadeDistance").GetValue<Slider>().Value; var extraDist = ObjectCache.menuCache.cache["ExtraCPADistance"].Cast<Slider>().CurrentValue; Vector2 heroPoint = ObjectCache.myHeroCache.serverPos2DPing; Vector2 lastMovePos = Game.CursorPos.To2D(); List<PositionInfo> posTable = new List<PositionInfo>(); List<int> spellList = SpellDetector.GetSpellList(); int minDistance = 50; //Math.Min(spell.range, minDistance) int maxDistance = int.MaxValue; if (spell.fixedRange) { minDistance = maxDistance = (int)spell.range; } List<Obj_AI_Base> collisionCandidates = new List<Obj_AI_Base>(); if (spell.spellTargets.Contains(SpellTargets.Targetables)) { foreach (var obj in ObjectManager.Get<Obj_AI_Base>() .Where(h => !h.IsMe && h.IsValidTarget(spell.range, false))) { if (obj.GetType() == typeof(Obj_AI_Turret) && ((Obj_AI_Turret)obj).IsValid()) { collisionCandidates.Add(obj); } } } else { List<AIHeroClient> heroList = new List<AIHeroClient>(); if (spell.spellTargets.Contains(SpellTargets.EnemyChampions) && spell.spellTargets.Contains(SpellTargets.AllyChampions)) { heroList = EntityManager.Heroes.AllHeroes; } else if (spell.spellTargets.Contains(SpellTargets.EnemyChampions)) { heroList = EntityManager.Heroes.Enemies; } else if (spell.spellTargets.Contains(SpellTargets.AllyChampions)) { heroList = EntityManager.Heroes.Allies; } foreach (var hero in heroList.Where(h => !h.IsMe && h.IsValidTarget(spell.range))) { collisionCandidates.Add(hero); } List<Obj_AI_Minion> minionList = new List<Obj_AI_Minion>(); if (spell.spellTargets.Contains(SpellTargets.EnemyMinions) && spell.spellTargets.Contains(SpellTargets.AllyMinions)) { minionList = EntityManager.MinionsAndMonsters.GetLaneMinions(EntityManager.UnitTeam.Both, Player.Instance.ServerPosition, spell.range).ToList(); } else if (spell.spellTargets.Contains(SpellTargets.EnemyMinions)) { minionList = EntityManager.MinionsAndMonsters.GetLaneMinions(EntityManager.UnitTeam.Enemy, Player.Instance.ServerPosition, spell.range).ToList(); } else if (spell.spellTargets.Contains(SpellTargets.AllyMinions)) { minionList = EntityManager.MinionsAndMonsters.GetLaneMinions(EntityManager.UnitTeam.Ally, Player.Instance.ServerPosition, spell.range).ToList(); } foreach (var minion in minionList.Where(h => h.IsValidTarget(spell.range))) { collisionCandidates.Add(minion); } } foreach (var candidate in collisionCandidates) { var pos = candidate.ServerPosition.To2D(); PositionInfo posInfo; if (spell.spellName == "YasuoDashWrapper") { bool hasDashBuff = false; foreach (var buff in candidate.Buffs) { if (buff.Name == "YasuoDashWrapper") { hasDashBuff = true; break; } } if (hasDashBuff) continue; } if (spell.behindTarget) { var dir = (pos - heroPoint).Normalized(); pos = pos + dir * (candidate.BoundingRadius + ObjectCache.myHeroCache.boundingRadius); } if (spell.infrontTarget) { var dir = (pos - heroPoint).Normalized(); pos = pos - dir * (candidate.BoundingRadius + ObjectCache.myHeroCache.boundingRadius); } if (spell.fixedRange) { var dir = (pos - heroPoint).Normalized(); pos = heroPoint + dir * spell.range; } if (spell.evadeType == EvadeType.Dash) { posInfo = CanHeroWalkToPos(pos, spell.speed, extraDelayBuffer + ObjectCache.gamePing, extraDist); posInfo.isDangerousPos = pos.CheckDangerousPos(6); posInfo.distanceToMouse = pos.GetPositionValue(); posInfo.spellList = spellList; } else { bool isDangerousPos = pos.CheckDangerousPos(6); var dist = pos.GetPositionValue(); posInfo = new PositionInfo(pos, isDangerousPos, dist); } posInfo.target = candidate; posTable.Add(posInfo); } if (spell.evadeType == EvadeType.Dash) { var sortedPosTable = posTable.OrderBy(p => p.isDangerousPos) .ThenBy(p => p.posDangerLevel) .ThenBy(p => p.posDangerCount) .ThenBy(p => p.distanceToMouse); var first = sortedPosTable.FirstOrDefault(); if (first != null && Evade.lastPosInfo != null && first.isDangerousPos == false && Evade.lastPosInfo.posDangerLevel > first.posDangerLevel) { return first; } } else { var sortedPosTable = posTable.OrderBy(p => p.isDangerousPos) //.ThenByDescending(p => p.hasComfortZone) //.ThenBy(p => p.hasExtraDistance) .ThenBy(p => p.distanceToMouse); var first = sortedPosTable.FirstOrDefault(); return first; } return null; }
private void SpellDetector_OnProcessDetectedSpells() { ObjectCache.myHeroCache.UpdateInfo(); if (ObjectCache.menuCache.cache["DodgeSkillShots"].Cast <KeyBind>().CurrentValue == false) { lastPosInfo = PositionInfo.SetAllUndodgeable(); EvadeSpell.UseEvadeSpell(); return; } if (ObjectCache.myHeroCache.serverPos2D.CheckDangerousPos(0) || ObjectCache.myHeroCache.serverPos2DExtra.CheckDangerousPos(0)) { if (EvadeSpell.PreferEvadeSpell()) { lastPosInfo = PositionInfo.SetAllUndodgeable(); } else { var posInfo = EvadeHelper.GetBestPosition(); var calculationTimer = EvadeUtils.TickCount; var caculationTime = EvadeUtils.TickCount - calculationTimer; //computing time /*if (numCalculationTime > 0) * { * sumCalculationTime += caculationTime; * avgCalculationTime = sumCalculationTime / numCalculationTime; * } * numCalculationTime += 1;*/ //Console.WriteLine("CalculationTime: " + caculationTime); /*if (EvadeHelper.GetHighestDetectedSpellID() > EvadeHelper.GetHighestSpellID(posInfo)) * { * return; * }*/ if (posInfo != null) { lastPosInfo = posInfo.CompareLastMovePos(); var travelTime = ObjectCache.myHeroCache.serverPos2DPing.LSDistance(lastPosInfo.position) / myHero.MoveSpeed; lastPosInfo.endTime = EvadeUtils.TickCount + travelTime * 1000 - 100; } CheckHeroInDanger(); DodgeSkillShots(); //walking CheckLastMoveTo(); EvadeSpell.UseEvadeSpell(); //using spells } } else { lastPosInfo = PositionInfo.SetAllDodgeable(); CheckLastMoveTo(); } //Console.WriteLine("SkillsDodged: " + lastPosInfo.dodgeableSpells.Count + " DangerLevel: " + lastPosInfo.undodgeableSpells.Count); }
private void Game_OnCastSpell(Spellbook spellbook, SpellbookCastSpellEventArgs args) { if (!spellbook.Owner.IsMe) return; var sData = spellbook.GetSpell(args.Slot); string name; if (SpellDetector.channeledSpells.TryGetValue(sData.Name, out name)) { //Evade.isChanneling = true; //Evade.channelPosition = ObjectCache.myHeroCache.serverPos2D; lastStopEvadeTime = EvadeUtils.TickCount + ObjectCache.gamePing + 100; } if (EvadeSpell.lastSpellEvadeCommand != null && EvadeSpell.lastSpellEvadeCommand.timestamp + ObjectCache.gamePing + 150 > EvadeUtils.TickCount) { args.Process = false; } lastSpellCast = args.Slot; lastSpellCastTime = EvadeUtils.TickCount; //moved from processPacket /*if (args.Slot == SpellSlot.Recall) { lastStopPosition = myHero.ServerPosition.To2D(); }*/ if (Situation.ShouldDodge()) { if (isDodging && SpellDetector.spells.Count() > 0) { foreach (KeyValuePair<String, SpellData> entry in SpellDetector.windupSpells) { SpellData spellData = entry.Value; if (spellData.spellKey == args.Slot) //check if it's a spell that we should block { args.Process = false; return; } } } } foreach (var evadeSpell in EvadeSpell.evadeSpells) { if (evadeSpell.isItem == false && evadeSpell.spellKey == args.Slot) { if (evadeSpell.evadeType == EvadeType.Blink || evadeSpell.evadeType == EvadeType.Dash) { //Block spell cast if flashing/blinking into spells if (args.EndPosition.To2D().CheckDangerousPos(6, true)) //for blink + dash { args.Process = false; return; } if (evadeSpell.evadeType == EvadeType.Dash) { var extraDelayBuffer = ObjectCache.menuCache.cache["ExtraPingBuffer"].Cast<Slider>().CurrentValue; var extraDist = ObjectCache.menuCache.cache["ExtraCPADistance"].Cast<Slider>().CurrentValue; var dashPos = Game.CursorPos.To2D(); //real pos? if (evadeSpell.fixedRange) { var dir = (dashPos - myHero.ServerPosition.To2D()).Normalized(); dashPos = myHero.ServerPosition.To2D() + dir*evadeSpell.range; } //Draw.RenderObjects.Add(new Draw.RenderPosition(dashPos, 1000)); var posInfo = EvadeHelper.CanHeroWalkToPos(dashPos, evadeSpell.speed, extraDelayBuffer + ObjectCache.gamePing, extraDist); if (posInfo.posDangerLevel > 0) { args.Process = false; return; } } lastPosInfo = PositionInfo.SetAllUndodgeable(); //really? if (isDodging || EvadeUtils.TickCount < lastDodgingEndTime + 500) { EvadeCommand.MoveTo(Game.CursorPos.To2D()); //block moveto lastStopEvadeTime = EvadeUtils.TickCount + ObjectCache.gamePing + 100; } } return; } } }
private void Game_OnCastSpell(Spellbook spellbook, SpellbookCastSpellEventArgs args) { if (!spellbook.Owner.IsMe) return; var sData = spellbook.GetSpell(args.Slot); string name; if (SpellDetector.channeledSpells.TryGetValue(sData.Name, out name)) { lastStopEvadeTime = EvadeUtils.TickCount + ObjectCache.gamePing + 100; } //block spell commmands if evade spell just used if (EvadeSpell.lastSpellEvadeCommand != null && EvadeSpell.lastSpellEvadeCommand.timestamp + ObjectCache.gamePing + 150 > EvadeUtils.TickCount) { args.Process = false; } lastSpellCast = args.Slot; lastSpellCastTime = EvadeUtils.TickCount; if (Situation.ShouldDodge()) { if (isDodging && SpellDetector.spells.Any()) { foreach (KeyValuePair<String, SpellData> entry in SpellDetector.windupSpells) { SpellData spellData = entry.Value; if (spellData.spellKey == args.Slot) //check if it's a spell that we should block { args.Process = false; return; } } } } foreach (var evadeSpell in EvadeSpell.evadeSpells) { if (evadeSpell.isItem == false && evadeSpell.spellKey == args.Slot && evadeSpell.untargetable == false) { if (evadeSpell.evadeType == EvadeType.Blink) { var dir = (args.StartPosition.LSTo2D() - myHero.ServerPosition.LSTo2D()).LSNormalized(); var end = myHero.ServerPosition.LSTo2D() + dir * myHero.ServerPosition.LSTo2D().LSDistance(Game.CursorPos.LSTo2D()); if (evadeSpell.fixedRange || end.LSDistance(myHero.ServerPosition.LSTo2D()) > evadeSpell.range) { end = myHero.ServerPosition.LSTo2D() + dir * evadeSpell.range; } var posInfo = EvadeHelper.CanHeroWalkToPos(end, evadeSpell.speed, ObjectCache.gamePing, 0); if (posInfo.posDangerCount > 0) { args.Process = false; } else { lastPosInfo.position = end; lastDodgingEndTime = EvadeUtils.TickCount; if (isDodging || EvadeUtils.TickCount < lastDodgingEndTime + 500) { EvadeCommand.MoveTo(Game.CursorPos.LSTo2D()); //block moveto lastStopEvadeTime = EvadeUtils.TickCount + ObjectCache.gamePing + 100; } return; } } if (evadeSpell.evadeType == EvadeType.Dash) { var dashPos = args.StartPosition.LSTo2D(); if (args.Target != null) { dashPos = args.Target.Position.LSTo2D(); } if (evadeSpell.fixedRange || dashPos.LSDistance(myHero.ServerPosition.LSTo2D()) > evadeSpell.range) { var dir = (dashPos - myHero.ServerPosition.LSTo2D()).LSNormalized(); dashPos = myHero.ServerPosition.LSTo2D() + dir * evadeSpell.range; } var posInfo = EvadeHelper.CanHeroWalkToPos(dashPos, evadeSpell.speed, ObjectCache.gamePing, 0); if (posInfo.posDangerLevel > 0) { args.Process = false; } else { lastPosInfo.position = dashPos; lastDodgingEndTime = EvadeUtils.TickCount; if (isDodging || EvadeUtils.TickCount < lastDodgingEndTime + 500) { EvadeCommand.MoveTo(Game.CursorPos.LSTo2D()); //block moveto lastStopEvadeTime = EvadeUtils.TickCount + ObjectCache.gamePing + 100; } return; } } lastPosInfo = PositionInfo.SetAllUndodgeable(); return; } } }
private void SpellDetector_OnProcessDetectedSpells() { ObjectCache.myHeroCache.UpdateInfo(); if (ObjectCache.menuCache.cache["DodgeSkillShots"].Cast<KeyBind>().CurrentValue == false) { lastPosInfo = PositionInfo.SetAllUndodgeable(); EvadeSpell.UseEvadeSpell(); return; } if (ObjectCache.myHeroCache.serverPos2D.CheckDangerousPos(0) || ObjectCache.myHeroCache.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; //Console.WriteLine("CalculationTime: " + caculationTime); /*if (EvadeHelper.GetHighestDetectedSpellID() > EvadeHelper.GetHighestSpellID(posInfo)) { return; }*/ if (posInfo != null) { lastPosInfo = posInfo.CompareLastMovePos(); var travelTime = ObjectCache.myHeroCache.serverPos2DPing.Distance(lastPosInfo.position)/ myHero.MoveSpeed; lastPosInfo.endTime = EvadeUtils.TickCount + travelTime*1000 - 100; } CheckHeroInDanger(); DodgeSkillShots(); //walking CheckLastMoveTo(); EvadeSpell.UseEvadeSpell(); //using spells } } else { lastPosInfo = PositionInfo.SetAllDodgeable(); CheckLastMoveTo(); } //Console.WriteLine("SkillsDodged: " + lastPosInfo.dodgeableSpells.Count + " DangerLevel: " + lastPosInfo.undodgeableSpells.Count); }
public static PositionInfo GetBestPosition() { int posChecked = 0; int maxPosToCheck = 50; int posRadius = 50; int radiusIndex = 0; var extraDelayBuffer = ObjectCache.menuCache.cache["ExtraPingBuffer"].GetValue <Slider>().Value; var extraEvadeDistance = ObjectCache.menuCache.cache["ExtraEvadeDistance"].GetValue <Slider>().Value; SpellDetector.UpdateSpells(); CalculateEvadeTime(); if (ObjectCache.menuCache.cache["CalculateWindupDelay"].GetValue <bool>()) { var extraWindupDelay = Evade.lastWindupTime - EvadeUtils.TickCount; if (extraWindupDelay > 0) { extraDelayBuffer += (int)extraWindupDelay; } } extraDelayBuffer += (int)(Evade.avgCalculationTime); if (ObjectCache.menuCache.cache["HigherPrecision"].GetValue <bool>()) { maxPosToCheck = 150; posRadius = 25; } Vector2 heroPoint = ObjectCache.myHeroCache.serverPos2D; Vector2 lastMovePos = Game.CursorPos.To2D(); List <PositionInfo> posTable = new List <PositionInfo>(); Spell lowestEvadeTimeSpell; var lowestEvadeTime = SpellDetector.GetLowestEvadeTime(out lowestEvadeTimeSpell); List <Vector2> fastestPositions = GetFastestPositions(); foreach (var pos in fastestPositions) //add the fastest positions into list of candidates { posTable.Add(InitPositionInfo(pos, extraDelayBuffer, extraEvadeDistance, lastMovePos, lowestEvadeTimeSpell)); } /*if (SpellDetector.spells.Count() == 1) * { * var sortedFastestTable = * posTable.OrderBy(p => p.posDangerLevel); * * if (sortedFastestTable.First() != null && sortedFastestTable.First().posDangerLevel > 0) * { * //use fastest * } * }*/ while (posChecked < maxPosToCheck) { radiusIndex++; int curRadius = radiusIndex * (2 * posRadius); int curCircleChecks = (int)Math.Ceiling((2 * Math.PI * (double)curRadius) / (2 * (double)posRadius)); for (int i = 1; i < curCircleChecks; i++) { posChecked++; var cRadians = (2 * Math.PI / (curCircleChecks - 1)) * i; //check decimals var pos = new Vector2((float)Math.Floor(heroPoint.X + curRadius * Math.Cos(cRadians)), (float)Math.Floor(heroPoint.Y + curRadius * Math.Sin(cRadians))); posTable.Add(InitPositionInfo(pos, extraDelayBuffer, extraEvadeDistance, lastMovePos, lowestEvadeTimeSpell)); } } IOrderedEnumerable <PositionInfo> sortedPosTable; if (ObjectCache.menuCache.cache["EvadeMode"].GetValue <StringList>().SelectedValue == "Fastest") { sortedPosTable = posTable.OrderBy(p => p.isDangerousPos) .ThenByDescending(p => p.intersectionTime) .ThenBy(p => p.posDangerLevel) .ThenBy(p => p.posDangerCount); fastEvadeMode = true; } else if (ObjectCache.menuCache.cache["FastEvadeActivationTime"].GetValue <Slider>().Value > 0 && ObjectCache.menuCache.cache["FastEvadeActivationTime"].GetValue <Slider>().Value + ObjectCache.gamePing + extraDelayBuffer > lowestEvadeTime) { sortedPosTable = posTable.OrderBy(p => p.isDangerousPos) .ThenByDescending(p => p.intersectionTime) .ThenBy(p => p.posDangerLevel) .ThenBy(p => p.posDangerCount); fastEvadeMode = true; } else { sortedPosTable = posTable.OrderBy(p => p.rejectPosition) .ThenBy(p => p.posDangerLevel) .ThenBy(p => p.posDangerCount) .ThenBy(p => p.distanceToMouse); if (sortedPosTable.First().posDangerCount != 0) //if can't dodge smoothly, dodge fast { var sortedPosTableFastest = posTable.OrderBy(p => p.isDangerousPos) .ThenByDescending(p => p.intersectionTime) .ThenBy(p => p.posDangerLevel) .ThenBy(p => p.posDangerCount); if (sortedPosTableFastest.First().posDangerCount == 0) { sortedPosTable = sortedPosTableFastest; fastEvadeMode = true; } } } foreach (var posInfo in sortedPosTable) { if (CheckPathCollision(myHero, posInfo.position) == false) { if (fastEvadeMode) { posInfo.position = GetExtendedSafePosition(ObjectCache.myHeroCache.serverPos2D, posInfo.position, extraEvadeDistance); return(CanHeroWalkToPos(posInfo.position, ObjectCache.myHeroCache.moveSpeed, ObjectCache.gamePing, 0)); } if (PositionInfoStillValid(posInfo)) { if (posInfo.position.CheckDangerousPos(extraEvadeDistance)) //extra evade distance, no multiple skillshots { posInfo.position = GetExtendedSafePosition(ObjectCache.myHeroCache.serverPos2D, posInfo.position, extraEvadeDistance); } return(posInfo); } } } return(PositionInfo.SetAllUndodgeable()); }