public static bool CheckMoveToDirection(Vector2 from, Vector2 movePos, float extraDelay = 0) { var dir = (movePos - from).Normalized(); foreach (KeyValuePair <int, Spell> entry in SpellDetector.spells) { Spell spell = entry.Value; if (!from.InSkillShot(spell, ObjectCache.myHeroCache.boundingRadius)) { Vector2 spellPos = spell.currentSpellPosition; /*if (ObjectCache.menuCache.cache["AllowCrossing"].GetValue<bool>()) * { * var extraDelayBuffer = Evade.menu.Item("ExtraPingBuffer").GetValue<Slider>().Value; * var extraDist = ObjectCache.menuCache.cache["ExtraCPADistance"].GetValue<Slider>().Value; * * if (PredictSpellCollision(spell, movePos, ObjectCache.myHeroCache.moveSpeed, extraDelayBuffer, from, extraDist)) * { * return true; * } * Console.WriteLine("cross"); * continue; * }*/ if (spell.info.spellType == SpellType.Line) { if (spell.LineIntersectLinearSpell(from, movePos)) { return(true); } } else if (spell.info.spellType == SpellType.Circular) { var cpa = MathUtilsCPA.CPAPointsEx(from, dir * ObjectCache.myHeroCache.moveSpeed, spell.endPos, new Vector2(0, 0), movePos, spell.endPos); if (cpa < spell.radius + 10) { return(true); } } else if (spell.info.spellType == SpellType.Cone) { } } } return(false); }
public static float GetClosestDistanceApproach(Spell spell, Vector2 pos, float speed, float delay, Vector2 heroPos, float extraDist) { var walkDir = (pos - heroPos).Normalized(); var zVector = new Vector2(0, 0); if (spell.info.spellType == SpellType.Line) { var spellPos = SpellDetector.GetCurrentSpellPosition(spell, true, delay); Vector2 cPos1, cPos2; var cpa = MathUtilsCPA.CPAPoints(heroPos, walkDir * speed, spellPos, spell.direction * spell.info.projectileSpeed, out cPos1, out cPos2); if (cpa < myHero.BoundingRadius + spell.info.radius + extraDist) { if (cPos2.Distance(spell.startPos) > spell.info.range + myHero.BoundingRadius) { return(1); //500 } return(0); } return(cpa - (myHero.BoundingRadius + GetSpellRadius(spell) + extraDist)); //return MathUtils.ClosestTimeOfApproach(heroPos, walkDir * speed, spellPos, spell.direction * spell.info.projectileSpeed); } else if (spell.info.spellType == SpellType.Circular) { /*var spellHitTime = Math.Max(0, spell.endTime - Evade.GetTickCount()); //extraDelay * var walkRange = heroPos.Distance(pos); * var predictedRange = speed * (spellHitTime / 1000); * var tHeroPos = heroPos + walkDir * Math.Min(predictedRange, walkRange); //Hero predicted pos * * return Math.Max(0,tHeroPos.Distance(spell.endPos) - (GetSpellRadius(spell) + myHero.BoundingRadius + extraDist)); //+ dodgeBuffer */ } return(1); }
public static float GetClosestDistanceApproach(Spell spell, Vector2 pos, float speed, float delay, Vector2 heroPos, float extraDist) { var walkDir = (pos - heroPos).LSNormalized(); if (spell.spellType == SpellType.Line && spell.info.projectileSpeed != float.MaxValue) { var spellPos = spell.GetCurrentSpellPosition(true, delay); var spellStartPos = spell.currentSpellPosition; var spellEndPos = spell.GetSpellEndPosition(); var extendedPos = pos.ExtendDir(walkDir, ObjectCache.myHeroCache.boundingRadius + speed * delay / 1000); Vector2 cHeroPos; Vector2 cSpellPos; var cpa2 = MathUtils.GetCollisionDistanceEx( heroPos, walkDir * speed, ObjectCache.myHeroCache.boundingRadius, spellPos, spell.direction * spell.info.projectileSpeed, spell.radius + extraDist, out cHeroPos, out cSpellPos); var cHeroPosProjection = cHeroPos.LSProjectOn(heroPos, extendedPos); var cSpellPosProjection = cSpellPos.LSProjectOn(spellPos, spellEndPos); if (cSpellPosProjection.IsOnSegment && cHeroPosProjection.IsOnSegment && cpa2 != float.MaxValue) { return(0); } var cpa = MathUtilsCPA.CPAPointsEx(heroPos, walkDir * speed, spellPos, spell.direction * spell.info.projectileSpeed, pos, spellEndPos, out cHeroPos, out cSpellPos); cHeroPosProjection = cHeroPos.LSProjectOn(heroPos, extendedPos); cSpellPosProjection = cSpellPos.LSProjectOn(spellPos, spellEndPos); var checkDist = ObjectCache.myHeroCache.boundingRadius + spell.radius + extraDist; if (cSpellPosProjection.IsOnSegment && cHeroPosProjection.IsOnSegment) { return(Math.Max(0, cpa - checkDist)); } else { return(checkDist); } //return MathUtils.ClosestTimeOfApproach(heroPos, walkDir * speed, spellPos, spell.direction * spell.info.projectileSpeed); } else if (spell.spellType == SpellType.Line && spell.info.projectileSpeed == float.MaxValue) { var spellHitTime = Math.Max(0, spell.endTime - EvadeUtils.TickCount - delay); //extraDelay var walkRange = heroPos.LSDistance(pos); var predictedRange = speed * (spellHitTime / 1000); var tHeroPos = heroPos + walkDir * Math.Min(predictedRange, walkRange); //Hero predicted pos var projection = tHeroPos.LSProjectOn(spell.startPos, spell.endPos); return(Math.Max(0, tHeroPos.LSDistance(projection.SegmentPoint) - (spell.radius + ObjectCache.myHeroCache.boundingRadius + extraDist))); //+ dodgeBuffer } else if (spell.spellType == SpellType.Circular) { var spellHitTime = Math.Max(0, spell.endTime - EvadeUtils.TickCount - delay); //extraDelay var walkRange = heroPos.LSDistance(pos); var predictedRange = speed * (spellHitTime / 1000); var tHeroPos = heroPos + walkDir * Math.Min(predictedRange, walkRange); //Hero predicted pos if (spell.info.spellName == "VeigarEventHorizon") { var wallRadius = 65; var midRadius = spell.radius - wallRadius; if (spellHitTime == 0) { return(0); } if (tHeroPos.LSDistance(spell.endPos) >= spell.radius) { return(Math.Max(0, tHeroPos.LSDistance(spell.endPos) - midRadius - wallRadius)); } else { return(Math.Max(0, midRadius - tHeroPos.LSDistance(spell.endPos) - wallRadius)); } } var closestDist = Math.Max(0, tHeroPos.LSDistance(spell.endPos) - (spell.radius + extraDist)); if (spell.info.extraEndTime > 0 && closestDist != 0) { var remainingTime = Math.Max(0, spell.endTime + spell.info.extraEndTime - EvadeUtils.TickCount - delay); var predictedRange2 = speed * (remainingTime / 1000); var tHeroPos2 = heroPos + walkDir * Math.Min(predictedRange2, walkRange); if (CheckMoveToDirection(tHeroPos, tHeroPos2)) { return(0); } } else { return(closestDist); } } else if (spell.spellType == SpellType.Arc) { var spellPos = spell.GetCurrentSpellPosition(true, delay); var spellEndPos = spell.GetSpellEndPosition(); var pDir = spell.direction.LSPerpendicular(); spellPos = spellPos - pDir * spell.radius / 2; spellEndPos = spellEndPos - pDir * spell.radius / 2; var extendedPos = pos.ExtendDir(walkDir, ObjectCache.myHeroCache.boundingRadius); Vector2 cHeroPos; Vector2 cSpellPos; var cpa = MathUtilsCPA.CPAPointsEx(heroPos, walkDir * speed, spellPos, spell.direction * spell.info.projectileSpeed, pos, spellEndPos, out cHeroPos, out cSpellPos); var cHeroPosProjection = cHeroPos.LSProjectOn(heroPos, extendedPos); var cSpellPosProjection = cSpellPos.LSProjectOn(spellPos, spellEndPos); var checkDist = spell.radius + extraDist; if (cHeroPos.InSkillShot(spell, ObjectCache.myHeroCache.boundingRadius)) { if (cSpellPosProjection.IsOnSegment && cHeroPosProjection.IsOnSegment) { return(Math.Max(0, cpa - checkDist)); } else { return(checkDist); } } } return(1); }
public static bool CheckMoveToDirection(Vector2 from, Vector2 movePos, float extraDelay = 0) { var dir = (movePos - from).LSNormalized(); //movePos = movePos.ExtendDir(dir, ObjectCache.myHeroCache.boundingRadius); foreach (KeyValuePair <int, Spell> entry in SpellDetector.spells) { Spell spell = entry.Value; if (!from.InSkillShot(spell, ObjectCache.myHeroCache.boundingRadius)) { Vector2 spellPos = spell.currentSpellPosition; if (spell.spellType == SpellType.Line) { if (spell.LineIntersectLinearSpell(from, movePos)) { return(true); } } else if (spell.spellType == SpellType.Circular) { if (spell.info.spellName == "VeigarEventHorizon") { var cpa2 = MathUtilsCPA.CPAPointsEx(from, dir * ObjectCache.myHeroCache.moveSpeed, spell.endPos, new Vector2(0, 0), movePos, spell.endPos); if (from.LSDistance(spell.endPos) < spell.radius && !(from.LSDistance(spell.endPos) < spell.radius - 135 && movePos.LSDistance(spell.endPos) < spell.radius - 135)) { return(true); } else if (from.LSDistance(spell.endPos) > spell.radius && cpa2 < spell.radius + 10) { return(true); } } else { Vector2 cHeroPos; Vector2 cSpellPos; var cpa2 = MathUtils.GetCollisionDistanceEx( from, dir * ObjectCache.myHeroCache.moveSpeed, 1, spell.endPos, new Vector2(0, 0), spell.radius, out cHeroPos, out cSpellPos); var cHeroPosProjection = cHeroPos.LSProjectOn(from, movePos); if (cHeroPosProjection.IsOnSegment && cpa2 != float.MaxValue) { return(true); } /*var cpa = MathUtilsCPA.CPAPointsEx(from, dir * ObjectCache.myHeroCache.moveSpeed, spell.endPos, new Vector2(0, 0), movePos, spell.endPos); * * if (cpa < spell.radius + 10) * { * return true; * }*/ } } else if (spell.spellType == SpellType.Arc) { if (from.isLeftOfLineSegment(spell.startPos, spell.endPos)) { return(MathUtils.CheckLineIntersection(from, movePos, spell.startPos, spell.endPos)); } var spellRange = spell.startPos.LSDistance(spell.endPos); var midPoint = spell.startPos + spell.direction * (spellRange / 2); var cpa = MathUtilsCPA.CPAPointsEx(from, dir * ObjectCache.myHeroCache.moveSpeed, midPoint, new Vector2(0, 0), movePos, midPoint); if (cpa < spell.radius + 10) { return(true); } } else if (spell.spellType == SpellType.Cone) { } } } return(false); }
private void Drawing_OnDraw(EventArgs args) { //PrintTimers(); //EvadeHelper.CheckMovePath(Game.CursorPos.To2D()); //TestUnderTurret(); /*if (EvadeHelper.CheckPathCollision(myHero, Game.CursorPos.To2D())) * { * var paths = myHero.GetPath(ObjectCache.myHeroCache.serverPos2DExtra.To3D(), Game.CursorPos); * foreach (var path in paths) * { * Render.Circle.DrawCircle(path, ObjectCache.myHeroCache.boundingRadius, Color.Red, 3); * } * } * else * { * Render.Circle.DrawCircle(Game.CursorPos, ObjectCache.myHeroCache.boundingRadius, Color.White, 3); * }*/ foreach (KeyValuePair <int, Spell> entry in SpellDetector.drawSpells) { Spell spell = entry.Value; if (spell.spellType == SpellType.Line) { Vector2 spellPos = spell.currentSpellPosition; Render.Circle.DrawCircle(new Vector3(spellPos.X, spellPos.Y, myHero.Position.Z), spell.info.radius, Color.White, 3); /*spellPos = spellPos + spell.direction * spell.info.projectileSpeed * (60 / 1000); //move the spellPos by 50 miliseconds forwards * spellPos = spellPos + spell.direction * 200; //move the spellPos by 50 units forwards * * Render.Circle.DrawCircle(new Vector3(spellPos.X, spellPos.Y, myHero.Position.Z), spell.info.radius, Color.White, 3);*/ } } if (testMenu.Item("TestHeroPos").GetValue <bool>()) { var path = myHero.Path; if (path.Length > 0) { var heroPos2 = EvadeHelper.GetRealHeroPos(ObjectCache.gamePing + 50);// path[path.Length - 1].To2D(); var heroPos1 = ObjectCache.myHeroCache.serverPos2D; Render.Circle.DrawCircle(new Vector3(heroPos2.X, heroPos2.Y, myHero.ServerPosition.Z), ObjectCache.myHeroCache.boundingRadius, Color.Red, 3); Render.Circle.DrawCircle(new Vector3(myHero.ServerPosition.X, myHero.ServerPosition.Y, myHero.ServerPosition.Z), ObjectCache.myHeroCache.boundingRadius, Color.White, 3); var heroPos = Drawing.WorldToScreen(ObjectManager.Player.Position); var dimension = Drawing.GetTextExtent("Evade: ON"); Drawing.DrawText(heroPos.X - dimension.Width / 2, heroPos.Y, Color.Red, "" + (int)(heroPos2.Distance(heroPos1))); Render.Circle.DrawCircle(new Vector3(circleRenderPos.X, circleRenderPos.Y, myHero.ServerPosition.Z), 10, Color.Red, 3); } } if (testMenu.Item("DrawHeroPos").GetValue <bool>()) { Render.Circle.DrawCircle(new Vector3(myHero.ServerPosition.X, myHero.ServerPosition.Y, myHero.ServerPosition.Z), ObjectCache.myHeroCache.boundingRadius, Color.White, 3); } if (testMenu.Item("TestMoveTo").GetValue <KeyBind>().Active) { var keyBind = testMenu.Item("TestMoveTo").GetValue <KeyBind>(); testMenu.Item("TestMoveTo").SetValue(new KeyBind(keyBind.Key, KeyBindType.Toggle, false)); /*lastRightMouseClickTime = EvadeUtils.TickCount; * myHero.IssueOrder(GameObjectOrder.MoveTo, Game.CursorPos,false);*/ myHero.IssueOrder(GameObjectOrder.MoveTo, Game.CursorPos); var dir = (Game.CursorPos - myHero.Position).Normalized(); //var pos2 = myHero.Position - dir * Game.CursorPos.Distance(myHero.Position); //var pos2 = myHero.Position.To2D() - dir.To2D() * 75; var pos2 = Game.CursorPos.To2D() - dir.To2D() * 75; //Console.WriteLine(myHero.BBox.Maximum.Distance(myHero.Position)); DelayAction.Add(20, () => myHero.IssueOrder(GameObjectOrder.MoveTo, pos2.To3D(), false)); //myHero.IssueOrder(GameObjectOrder.MoveTo, pos2, false); } if (testMenu.Item("TestPath").GetValue <bool>()) { var tPath = myHero.GetPath(Game.CursorPos); Vector2 lastPoint = Vector2.Zero; foreach (Vector3 point in tPath) { var point2D = point.To2D(); Render.Circle.DrawCircle(new Vector3(point.X, point.Y, point.Z), ObjectCache.myHeroCache.boundingRadius, Color.Violet, 3); lastPoint = point2D; } } if (testMenu.Item("TestPath").GetValue <bool>()) { var tPath = myHero.GetPath(Game.CursorPos); Vector2 lastPoint = Vector2.Zero; foreach (Vector3 point in tPath) { var point2D = point.To2D(); //Render.Circle.DrawCircle(new Vector3(point.X, point.Y, point.Z), ObjectCache.myHeroCache.boundingRadius, Color.Violet, 3); lastPoint = point2D; } foreach (KeyValuePair <int, Spell> entry in SpellDetector.spells) { Spell spell = entry.Value; Vector2 to = Game.CursorPos.To2D(); var dir = (to - myHero.Position.To2D()).Normalized(); Vector2 cPos1, cPos2; var cpa = MathUtilsCPA.CPAPointsEx(myHero.Position.To2D(), dir * ObjectCache.myHeroCache.moveSpeed, spell.endPos, spell.direction * spell.info.projectileSpeed, to, spell.endPos); var cpaTime = MathUtilsCPA.CPATime(myHero.Position.To2D(), dir * ObjectCache.myHeroCache.moveSpeed, spell.endPos, spell.direction * spell.info.projectileSpeed); //ConsolePrinter.Print("" + cpaTime); //Render.Circle.DrawCircle(cPos1.To3D(), ObjectCache.myHeroCache.boundingRadius, Color.Red, 3); if (cpa < ObjectCache.myHeroCache.boundingRadius + spell.radius) { } } } if (testMenu.Item("ShowBuffs").GetValue <bool>()) { var target = myHero; foreach (var hero in HeroManager.Enemies) { target = hero; } var buffs = target.Buffs; //ConsolePrinter.Print(myHero.ChampionName); //if(myHero.IsDead) // ConsolePrinter.Print("dead"); if (!target.IsTargetable) { ConsolePrinter.Print("invul" + EvadeUtils.TickCount); } int height = 20; foreach (var buff in buffs) { if (buff.IsValidBuff()) { Drawing.DrawText(10, height, Color.White, buff.Name); height += 20; ConsolePrinter.Print(buff.Name); } } } if (testMenu.Item("TestTracker").GetValue <bool>()) { foreach (KeyValuePair <int, ObjectTrackerInfo> entry in ObjectTracker.objTracker) { var info = entry.Value; Vector3 endPos2; if (info.usePosition == false) { endPos2 = info.obj.Position; } else { endPos2 = info.position; } Render.Circle.DrawCircle(new Vector3(endPos2.X, endPos2.Y, myHero.Position.Z), 50, Color.Green, 3); } /*foreach (var obj in ObjectManager.Get<Obj_AI_Minion>()) * { * ConsolePrinter.Print("minion: " + obj.Name); * if (obj.Name == "Ekko") * { * var pos = obj.Position; * Render.Circle.DrawCircle(pos, 100, Color.Green, 3); * } * }*/ } if (testMenu.Item("ShowMissileInfo").GetValue <bool>()) { if (testMissile != null) { //Render.Circle.DrawCircle(testMissile.Position, testMissile.BoundingRadius, Color.White, 3); } } if (testMenu.Item("TestWall").GetValue <bool>()) { /*foreach (var posInfo in sortedBestPos) * { * var posOnScreen = Drawing.WorldToScreen(posInfo.position.To3D()); * //Drawing.DrawText(posOnScreen.X, posOnScreen.Y, Color.Aqua, "" + (int)posInfo.closestDistance); * * * if (!posInfo.rejectPosition) * { * Drawing.DrawText(posOnScreen.X, posOnScreen.Y, Color.Aqua, "" + (int)posInfo.closestDistance); * } * * Drawing.DrawText(posOnScreen.X, posOnScreen.Y, Color.Aqua, "" + (int)posInfo.closestDistance); * * if (posInfo.posDangerCount <= 0) * { * var pos = posInfo.position; * Render.Circle.DrawCircle(new Vector3(pos.X, pos.Y, myHero.Position.Z), (float)25, Color.White, 3); * } * }*/ int posChecked = 0; int maxPosToCheck = 50; int posRadius = 50; int radiusIndex = 0; Vector2 heroPoint = ObjectCache.myHeroCache.serverPos2D; 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))); if (!EvadeHelper.CheckPathCollision(myHero, pos)) { Render.Circle.DrawCircle(new Vector3(pos.X, pos.Y, myHero.Position.Z), (float)25, Color.White, 3); } } } } }
private void Drawing_OnDraw(EventArgs args) { //PrintTimers(); //EvadeHelper.CheckMovePath(Game.CursorPos.To2D()); foreach (KeyValuePair <int, Spell> entry in SpellDetector.drawSpells) { Spell spell = entry.Value; if (spell.info.spellType == SpellType.Line) { Vector2 spellPos = spell.GetCurrentSpellPosition(); Render.Circle.DrawCircle(new Vector3(spellPos.X, spellPos.Y, myHero.Position.Z), spell.info.radius, Color.White, 3); /*spellPos = spellPos + spell.direction * spell.info.projectileSpeed * (60 / 1000); //move the spellPos by 50 miliseconds forwards * spellPos = spellPos + spell.direction * 200; //move the spellPos by 50 units forwards * * Render.Circle.DrawCircle(new Vector3(spellPos.X, spellPos.Y, myHero.Position.Z), spell.info.radius, Color.White, 3);*/ } } RenderTestCircles(); if (testMenu.Item("TestHeroPos").GetValue <bool>()) { var path = myHero.Path; if (path.Length > 0) { var heroPos2 = EvadeHelper.GetRealHeroPos(Game.Ping + 50);// path[path.Length - 1].To2D(); var heroPos1 = myHero.ServerPosition.To2D(); Render.Circle.DrawCircle(new Vector3(heroPos2.X, heroPos2.Y, myHero.ServerPosition.Z), myHero.BoundingRadius, Color.Red, 3); Render.Circle.DrawCircle(new Vector3(myHero.ServerPosition.X, myHero.ServerPosition.Y, myHero.ServerPosition.Z), myHero.BoundingRadius, Color.White, 3); var heroPos = Drawing.WorldToScreen(ObjectManager.Player.Position); var dimension = Drawing.GetTextExtent("Evade: ON"); Drawing.DrawText(heroPos.X - dimension.Width / 2, heroPos.Y, Color.Red, "" + (int)(heroPos2.Distance(heroPos1))); Render.Circle.DrawCircle(new Vector3(circleRenderPos.X, circleRenderPos.Y, myHero.ServerPosition.Z), 10, Color.Red, 3); } } if (testMenu.Item("DrawHeroPos").GetValue <bool>()) { Render.Circle.DrawCircle(new Vector3(myHero.ServerPosition.X, myHero.ServerPosition.Y, myHero.ServerPosition.Z), myHero.BoundingRadius, Color.White, 3); } if (testMenu.Item("TestMoveTo").GetValue <KeyBind>().Active) { var keyBind = testMenu.Item("TestMoveTo").GetValue <KeyBind>(); testMenu.Item("TestMoveTo").SetValue(new KeyBind(keyBind.Key, KeyBindType.Toggle, false)); myHero.IssueOrder(GameObjectOrder.MoveTo, Game.CursorPos); var dir = (Game.CursorPos - myHero.Position).Normalized(); var pos2 = myHero.Position - dir * Game.CursorPos.Distance(myHero.Position); Utility.DelayAction.Add(1, () => myHero.IssueOrder(GameObjectOrder.MoveTo, pos2)); } if (testMenu.Item("TestPath").GetValue <bool>()) { var tPath = myHero.GetPath(Game.CursorPos); Vector2 lastPoint = Vector2.Zero; foreach (Vector3 point in tPath) { var point2D = point.To2D(); //Render.Circle.DrawCircle(new Vector3(point.X, point.Y, point.Z), myHero.BoundingRadius, Color.Violet, 3); lastPoint = point2D; } } if (testMenu.Item("TestPath").GetValue <bool>()) { var tPath = myHero.GetPath(Game.CursorPos); Vector2 lastPoint = Vector2.Zero; foreach (Vector3 point in tPath) { var point2D = point.To2D(); //Render.Circle.DrawCircle(new Vector3(point.X, point.Y, point.Z), myHero.BoundingRadius, Color.Violet, 3); lastPoint = point2D; } foreach (KeyValuePair <int, Spell> entry in SpellDetector.spells) { Spell spell = entry.Value; Vector2 to = Game.CursorPos.To2D(); var dir = (to - myHero.Position.To2D()).Normalized(); Vector2 cPos1, cPos2; var cpa = MathUtilsCPA.CPAPointsEx(myHero.Position.To2D(), dir * myHero.MoveSpeed, spell.endPos, spell.direction * spell.info.projectileSpeed, to, spell.endPos); var cpaTime = MathUtilsCPA.CPATime(myHero.Position.To2D(), dir * myHero.MoveSpeed, spell.endPos, spell.direction * spell.info.projectileSpeed); //Game.PrintChat("" + cpaTime); //Render.Circle.DrawCircle(cPos1.To3D(), myHero.BoundingRadius, Color.Red, 3); if (cpa < myHero.BoundingRadius + spell.GetSpellRadius()) { } } } if (testMenu.Item("ShowBuffs").GetValue <bool>()) { var target = myHero; foreach (var hero in HeroManager.Enemies) { target = hero; } var buffs = target.Buffs; //Game.PrintChat(myHero.ChampionName); //if(myHero.IsDead) // Game.PrintChat("dead"); if (!target.IsTargetable) { Game.PrintChat("invul" + Evade.GetTickCount()); } int height = 20; foreach (var buff in buffs) { if (buff.IsValidBuff()) { Drawing.DrawText(10, height, Color.White, buff.Name); height += 20; Game.PrintChat(buff.Name); } } } if (testMenu.Item("TestTracker").GetValue <bool>()) { foreach (KeyValuePair <int, ObjectTrackerInfo> entry in SpecialSpells.objTracker) { var info = entry.Value; Vector3 endPos2; if (info.usePosition == false) { endPos2 = info.obj.Position; } else { endPos2 = info.position; } Render.Circle.DrawCircle(new Vector3(endPos2.X, endPos2.Y, myHero.Position.Z), 50, Color.Green, 3); } } if (testMenu.Item("TestWall").GetValue <bool>()) { foreach (var posInfo in sortedBestPos) { var posOnScreen = Drawing.WorldToScreen(posInfo.position.To3D()); //Drawing.DrawText(posOnScreen.X, posOnScreen.Y, Color.Aqua, "" + (int)posInfo.closestDistance); /* * if (!posInfo.rejectPosition) * { * Drawing.DrawText(posOnScreen.X, posOnScreen.Y, Color.Aqua, "" + (int)posInfo.closestDistance); * }*/ Drawing.DrawText(posOnScreen.X, posOnScreen.Y, Color.Aqua, "" + (int)posInfo.closestDistance); /*if (posInfo.posDangerCount <= 0) * { * var pos = posInfo.position; * Render.Circle.DrawCircle(new Vector3(pos.X, pos.Y, myHero.Position.Z), (float)25, Color.White, 3); * }*/ } } }
public static float GetClosestDistanceApproach(Spell spell, Vector2 pos, float speed, float delay, Vector2 heroPos, float extraDist) { var walkDir = (pos - heroPos).Normalized(); var zVector = new Vector2(0, 0); heroPos = heroPos - walkDir * speed * ((float)ObjectCache.gamePing) / 1000; if (spell.info.spellType == SpellType.Line && spell.info.projectileSpeed != float.MaxValue) { var spellPos = spell.GetCurrentSpellPosition(true, delay); var spellEndPos = spell.GetSpellEndPosition(); Vector2 cSpellPos; Vector2 cHeroPos; var cpa = MathUtilsCPA.CPAPointsEx(heroPos, walkDir * speed, spellPos, spell.direction * spell.info.projectileSpeed, pos, spellEndPos, out cSpellPos, out cHeroPos); var spellPos2 = spell.currentNegativePosition; Vector2 cSpellPos2; Vector2 cHeroPos2; var cpa2 = MathUtilsCPA.CPAPointsEx(heroPos, walkDir * speed, spellPos2, spell.direction * spell.info.projectileSpeed, pos, spellEndPos, out cSpellPos2, out cHeroPos2); var cHeroPosProjection = cHeroPos.ProjectOn(cSpellPos2, cSpellPos); //from predicted var checkDist = ObjectCache.myHeroCache.boundingRadius + spell.radius + extraDist; if (cHeroPosProjection.IsOnSegment) { if (cHeroPosProjection.SegmentPoint.Distance(cHeroPos) <= checkDist) { return(0); } } if (cpa <= checkDist || cpa2 <= checkDist) { return(0); } return(Math.Min(Math.Max(0, cpa - checkDist), Math.Max(0, cpa2 - checkDist))); //return MathUtils.ClosestTimeOfApproach(heroPos, walkDir * speed, spellPos, spell.direction * spell.info.projectileSpeed); } else if (spell.info.spellType == SpellType.Line && spell.info.projectileSpeed == float.MaxValue) { var spellHitTime = Math.Max(0, spell.endTime - EvadeUtils.TickCount - delay); //extraDelay var walkRange = heroPos.Distance(pos); var predictedRange = speed * (spellHitTime / 1000); var tHeroPos = heroPos + walkDir * Math.Min(predictedRange, walkRange); //Hero predicted pos var projection = tHeroPos.ProjectOn(spell.startPos, spell.endPos); return(Math.Max(0, tHeroPos.Distance(projection.SegmentPoint) - (spell.radius + ObjectCache.myHeroCache.boundingRadius + extraDist))); //+ dodgeBuffer } else if (spell.info.spellType == SpellType.Circular) { var spellHitTime = Math.Max(0, spell.endTime - EvadeUtils.TickCount - delay); //extraDelay var walkRange = heroPos.Distance(pos); var predictedRange = speed * (spellHitTime / 1000); var tHeroPos = heroPos + walkDir * Math.Min(predictedRange, walkRange); //Hero predicted pos return(Math.Max(0, tHeroPos.Distance(spell.endPos) - (spell.radius + extraDist))); //+ dodgeBuffer } return(1); }