public static void UpdateSpellInfo(this Spell spell) { spell.currentSpellPosition = spell.GetCurrentSpellPosition(); spell.currentNegativePosition = spell.GetCurrentSpellPosition(true, 0); spell.dangerlevel = spell.GetSpellDangerLevel(); if (spell.info.name == "TaricE") { var taric = HeroManager.Enemies.FirstOrDefault(x => x.ChampionName == "Taric"); if (taric != null) { spell.currentSpellPosition = taric.ServerPosition.To2D(); spell.endPos = taric.ServerPosition.To2D() + spell.direction * spell.info.range; } } if (spell.info.name == "TaricE2") { var partner = HeroManager.Enemies.FirstOrDefault(x => x.HasBuff("taricwleashactive") && x.ChampionName != "Taric"); if (partner != null) { spell.currentSpellPosition = partner.ServerPosition.To2D(); spell.endPos = partner.ServerPosition.To2D() + spell.direction * spell.info.range; } } }
public static void UpdateSpellInfo(this Spell spell) { spell.currentSpellPosition = spell.GetCurrentSpellPosition(); spell.currentNegativePosition = spell.GetCurrentSpellPosition(true, 0); spell.dangerlevel = spell.GetSpellDangerLevel(); //spell.radius = spell.GetSpellRadius(); }
public static bool CanHeroWalkIntoSpell(Spell spell) { Vector2 heroPos = myHero.Position.To2D(); if (spell.info.spellType == SpellType.Line) { var walkRadius = myHero.MoveSpeed * (spell.endTime - Evade.GetTickCount()) / 1000 + myHero.BoundingRadius + spell.info.radius; var spellPos = spell.GetCurrentSpellPosition(); var projection = heroPos.ProjectOn(spellPos, spell.endPos); return(projection.SegmentPoint.Distance(heroPos) <= walkRadius); } else if (spell.info.spellType == SpellType.Circular) { var walkRadius = myHero.MoveSpeed * (spell.endTime - Evade.GetTickCount()) / 1000 + myHero.BoundingRadius + spell.info.radius; if (heroPos.Distance(spell.endPos) < walkRadius) { return(true); } } return(false); }
private void CompareSpellLocation(Spell spell, Vector2 pos, float time) { var pos2 = spell.GetCurrentSpellPosition(); if (spell.spellObject != null) { Game.PrintChat("Compare: " + (pos2.Distance(pos)) / (Evade.GetTickCount() - time)); } }
private void CompareSpellLocation2(Spell spell) { var pos1 = spell.GetCurrentSpellPosition(); var timeNow = Evade.GetTickCount(); if (spell.spellObject != null) { Game.PrintChat("start distance: " + (spell.startPos.Distance(pos1))); } Utility.DelayAction.Add(250, () => CompareSpellLocation(spell, pos1, timeNow)); }
public static float GetMovementBlockPositionValue(Vector2 pos, Vector2 movePos) { float value = 0;// pos.LSDistance(movePos); foreach (KeyValuePair <int, Spell> entry in SpellDetector.spells) { Spell spell = entry.Value; var spellPos = spell.GetCurrentSpellPosition(true, ObjectCache.gamePing); var extraDist = 100 + spell.radius; value -= Math.Max(0, -(10 * ((float)0.8 * extraDist) / pos.LSDistance(spell.GetSpellProjection(pos))) + extraDist); } return(value); }
public static BoundingBox GetLinearSpellBoundingBox(this Spell spell) { var myBoundingRadius = Evade.myHero.BoundingRadius; var spellDir = spell.direction; var pSpellDir = spell.direction.Perpendicular(); var spellRadius = spell.GetSpellRadius(); var spellPos = spell.GetCurrentSpellPosition() - spellDir * myBoundingRadius; //leave some space at back of spell var endPos = spell.endPos + spellDir * myBoundingRadius; //leave some space at the front of spell var startRightPos = spellPos + pSpellDir * (spellRadius + myBoundingRadius); var endLeftPos = endPos - pSpellDir * (spellRadius + myBoundingRadius); return(new BoundingBox(new Vector3(endLeftPos.X, endLeftPos.Y, -1), new Vector3(startRightPos.X, startRightPos.Y, 1))); }
public static float GetSpellHitTime(this Spell spell, Vector2 pos) { if (spell.spellType == SpellType.Line) { if (spell.info.projectileSpeed == float.MaxValue) { return(Math.Max(0, spell.endTime - EvadeUtils.TickCount - ObjectCache.gamePing)); } var spellPos = spell.GetCurrentSpellPosition(true, ObjectCache.gamePing); return(1000 * spellPos.Distance(pos) / spell.info.projectileSpeed); } else if (spell.spellType == SpellType.Circular) { return(Math.Max(0, spell.endTime - EvadeUtils.TickCount - ObjectCache.gamePing)); } return(float.MaxValue); }
public static bool CheckSpellCollision(this Spell spell) { if (spell.info.collisionObjects.Count() < 1) { return(false); } List <Obj_AI_Base> collisionCandidates = new List <Obj_AI_Base>(); var spellPos = spell.GetCurrentSpellPosition(); var distanceToHero = spellPos.Distance(Evade.myHero.ServerPosition.To2D()); if (spell.info.collisionObjects.Contains(CollisionObjectType.EnemyChampions)) { foreach (var hero in HeroManager.Allies.Where(h => h.Distance(spellPos) < distanceToHero && !h.IsDead)) { collisionCandidates.Add(hero); } } if (spell.info.collisionObjects.Contains(CollisionObjectType.EnemyMinions)) { foreach (var minion in ObjectManager.Get <Obj_AI_Minion>() .Where(h => h.Team == Evade.myHero.Team && h.Distance(spellPos) < distanceToHero && !h.IsDead)) { collisionCandidates.Add(minion); } } var sortedCandidates = collisionCandidates.OrderBy(h => h.Distance(spellPos)); foreach (var candidate in sortedCandidates) { if (EvadeHelper.InSkillShot(spell, candidate.ServerPosition.To2D(), candidate.BoundingRadius)) { return(true); } } return(false); }
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 float GetClosestDistanceApproach(Spell spell, Vector2 pos, float speed, float delay, Vector2 heroPos, float extraDist) { var walkDir = (pos - heroPos).Normalized(); 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.ProjectOn(heroPos, extendedPos); var cSpellPosProjection = cSpellPos.ProjectOn(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.ProjectOn(heroPos, extendedPos); cSpellPosProjection = cSpellPos.ProjectOn(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.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.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 if (spell.info.spellName == "VeigarEventHorizon") { var wallRadius = 65; var midRadius = spell.radius - wallRadius; if (spellHitTime == 0) { return 0; } if (tHeroPos.Distance(spell.endPos) >= spell.radius) { return Math.Max(0, tHeroPos.Distance(spell.endPos) - midRadius - wallRadius); } else { return Math.Max(0, midRadius - tHeroPos.Distance(spell.endPos) - wallRadius); } } var closestDist = Math.Max(0, tHeroPos.Distance(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.Perpendicular(); 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.ProjectOn(heroPos, extendedPos); var cSpellPosProjection = cSpellPos.ProjectOn(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; }
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); * }*/ } } }
private void Game_OnIssueOrder(Obj_AI_Base hero, GameObjectIssueOrderEventArgs args) { if (!hero.IsMe) { return; } if (args.Order == GameObjectOrder.HoldPosition) { var path = myHero.Path; var heroPoint = myHero.ServerPosition.To2D(); if (path.Length > 0) { var movePos = path[path.Length - 1].To2D(); var walkDir = (movePos - heroPoint).Normalized(); //circleRenderPos = EvadeHelper.GetRealHeroPos(); //heroPoint;// +walkDir * myHero.MoveSpeed * (((float)Game.Ping) / 1000); } } /* * if (args.Order == GameObjectOrder.MoveTo) * { * if (testingCollision) * { * if (args.TargetPosition.To2D().Distance(testCollisionPos) < 3) * { * //var path = myHero.GetPath(); * //circleRenderPos * * args.Process = false; * } * } * }*/ if (args.Order == GameObjectOrder.MoveTo) { Vector2 heroPos = myHero.ServerPosition.To2D(); Vector2 pos = args.TargetPosition.To2D(); float speed = myHero.MoveSpeed; startWalkPos = heroPos; startWalkTime = Evade.GetTickCount(); foreach (KeyValuePair <int, Spell> entry in SpellDetector.spells) { Spell spell = entry.Value; var spellPos = spell.GetCurrentSpellPosition(); var walkDir = (pos - heroPos).Normalized(); float spellTime = (Evade.GetTickCount() - spell.startTime) - spell.info.spellDelay; spellPos = spell.startPos + spell.direction * spell.info.projectileSpeed * (spellTime / 1000); //Game.PrintChat("aaaa" + spellTime); bool isCollision = false; float movingCollisionTime = MathUtils.GetCollisionTime(heroPos, spellPos, walkDir * (speed - 25), spell.direction * (spell.info.projectileSpeed - 200), myHero.BoundingRadius, spell.GetSpellRadius(), out isCollision); if (isCollision) { //Game.PrintChat("aaaa" + spellPos.Distance(spell.endPos) / spell.info.projectileSpeed); if (true)//spellPos.Distance(spell.endPos) / spell.info.projectileSpeed > movingCollisionTime) { Game.PrintChat("movingCollisionTime: " + movingCollisionTime); //circleRenderPos = heroPos + walkDir * speed * movingCollisionTime; } } } } }
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); }
private void Drawing_OnDraw(EventArgs args) { if (menu.SubMenu("Draw").Item("DrawSkillShots").GetValue <bool>() == false) { return; } if (menu.SubMenu("Draw").Item("DrawEvadePosition").GetValue <bool>()) { if (Evade.lastPosInfo != null) { var pos = Evade.lastPosInfo.position; Render.Circle.DrawCircle(new Vector3(pos.X, pos.Y, myHero.Position.Z), 65, Color.Red, 10); } } DrawEvadeStatus(); foreach (KeyValuePair <int, Spell> entry in SpellDetector.drawSpells) { Spell spell = entry.Value; var dangerStr = spell.GetSpellDangerString(); var spellDrawingConfig = Evade.menu.SubMenu("Draw").SubMenu("DangerLevelDrawings") .SubMenu(dangerStr + "Drawing").Item(dangerStr + "Color").GetValue <Circle>(); var spellDrawingWidth = Evade.menu.SubMenu("Draw").SubMenu("DangerLevelDrawings") .SubMenu(dangerStr + "Drawing").Item(dangerStr + "Width").GetValue <Slider>().Value; if (Evade.menu.SubMenu("Spells").SubMenu(spell.info.charName + spell.info.spellName + "Settings") .Item(spell.info.spellName + "DrawSpell").GetValue <bool>() && spellDrawingConfig.Active) { if (spell.info.spellType == SpellType.Line) { Vector2 spellPos = spell.GetCurrentSpellPosition(); DrawLineRectangle(spellPos, spell.endPos, (int)spell.GetSpellRadius(), spellDrawingWidth, spellDrawingConfig.Color); /*foreach (var hero in ObjectManager.Get<Obj_AI_Hero>()) * { * Render.Circle.DrawCircle(new Vector3(hero.ServerPosition.X, hero.ServerPosition.Y, myHero.Position.Z), (int)spell.GetSpellRadius(), Color.Red, 5); * }*/ if (menu.SubMenu("Draw").Item("DrawSpellPos").GetValue <bool>())// && spell.spellObject != null) { //spellPos = SpellDetector.GetCurrentSpellPosition(spell, true, Game.Ping); /*if (true) * { * var spellPos2 = spell.startPos + spell.direction * spell.info.projectileSpeed * (Evade.GetTickCount() - spell.startTime - spell.info.spellDelay) / 1000 + spell.direction * spell.info.projectileSpeed * ((float)Game.Ping / 1000); * Render.Circle.DrawCircle(new Vector3(spellPos2.X, spellPos2.Y, myHero.Position.Z), (int)spell.GetSpellRadius(), Color.Red, 8); * }*/ Render.Circle.DrawCircle(new Vector3(spellPos.X, spellPos.Y, myHero.Position.Z), (int)spell.GetSpellRadius(), spellDrawingConfig.Color, spellDrawingWidth); } } else if (spell.info.spellType == SpellType.Circular) { Render.Circle.DrawCircle(new Vector3(spell.endPos.X, spell.endPos.Y, myHero.Position.Z), (int)spell.GetSpellRadius(), spellDrawingConfig.Color, spellDrawingWidth); } else if (spell.info.spellType == SpellType.Cone) { } } } }