public static bool LineIntersectLinearSpell(this Spell spell, Vector2 a, Vector2 b) { var myBoundingRadius = ObjectManager.Player.BoundingRadius; var spellDir = spell.direction; var pSpellDir = spell.direction.Perpendicular(); var spellRadius = spell.radius; var spellPos = spell.currentSpellPosition; // -spellDir * myBoundingRadius; //leave some space at back of spell var endPos = spell.GetSpellEndPosition(); // +spellDir * myBoundingRadius; //leave some space at the front of spell var startRightPos = spellPos + pSpellDir * (spellRadius + myBoundingRadius); var startLeftPos = spellPos - pSpellDir * (spellRadius + myBoundingRadius); var endRightPos = endPos + pSpellDir * (spellRadius + myBoundingRadius); var endLeftPos = endPos - pSpellDir * (spellRadius + myBoundingRadius); bool int1 = MathUtils.CheckLineIntersection(a, b, startRightPos, startLeftPos); bool int2 = MathUtils.CheckLineIntersection(a, b, endRightPos, endLeftPos); bool int3 = MathUtils.CheckLineIntersection(a, b, startRightPos, endRightPos); bool int4 = MathUtils.CheckLineIntersection(a, b, startLeftPos, endLeftPos); if (int1 || int2 || int3 || int4) { return(true); } return(false); }
public static bool LineIntersectLinearSpellEx(this Spell spell, Vector2 a, Vector2 b, out Vector2 intersection) //edited { var myBoundingRadius = ObjectManager.Player.BoundingRadius; var spellDir = spell.direction; var pSpellDir = spell.direction.Perpendicular(); var spellRadius = spell.radius; var spellPos = spell.currentSpellPosition - spellDir * myBoundingRadius; //leave some space at back of spell var endPos = spell.GetSpellEndPosition() + spellDir * myBoundingRadius; //leave some space at the front of spell var startRightPos = spellPos + pSpellDir * (spellRadius + myBoundingRadius); var startLeftPos = spellPos - pSpellDir * (spellRadius + myBoundingRadius); var endRightPos = endPos + pSpellDir * (spellRadius + myBoundingRadius); var endLeftPos = endPos - pSpellDir * (spellRadius + myBoundingRadius); List <Geometry.IntersectionResult> intersects = new List <Geometry.IntersectionResult>(); Vector2 heroPos = ObjectManager.Player.ServerPosition.To2D(); intersects.Add(a.Intersection(b, startRightPos, startLeftPos)); intersects.Add(a.Intersection(b, endRightPos, endLeftPos)); intersects.Add(a.Intersection(b, startRightPos, endRightPos)); intersects.Add(a.Intersection(b, startLeftPos, endLeftPos)); var sortedIntersects = intersects.Where(i => i.Intersects).OrderBy(i => i.Point.Distance(heroPos)); //Get first intersection if (sortedIntersects.Count() > 0) { intersection = sortedIntersects.First().Point; return(true); } intersection = Vector2.Zero; return(false); }
public static bool InSkillShot(this Vector2 position, Spell spell, float radius, bool predictCollision = true) { if (spell.info.spellType == SpellType.Line) { Vector2 spellPos = spell.currentSpellPosition; //leave little space at back of skillshot Vector2 spellEndPos = predictCollision ? spell.GetSpellEndPosition() : spell.endPos; /*if (spell.info.projectileSpeed == float.MaxValue * && Evade.GetTickCount - spell.startTime > spell.info.spellDelay) * { * return false; * }*/ var projection = position.ProjectOn(spellPos, spellEndPos); /*if (projection.SegmentPoint.Distance(spellEndPos) < 100) //Check Skillshot endpoints * { * //unfinished * }*/ return(projection.SegmentPoint.Distance(position) <= spell.radius + radius); } else if (spell.info.spellType == SpellType.Circular) { return(position.Distance(spell.endPos) <= spell.radius + radius - ObjectCache.myHeroCache.boundingRadius); } else if (spell.info.spellType == SpellType.Cone) { } return(false); }
public static bool CanHeroWalkIntoSpell(Spell spell) { if (ObjectCache.menuCache.cache["AdvancedSpellDetection"].GetValue <bool>()) { Vector2 heroPos = myHero.Position.To2D(); var extraDist = myHero.Distance(ObjectCache.myHeroCache.serverPos2D); if (spell.info.spellType == SpellType.Line) { var walkRadius = ObjectCache.myHeroCache.moveSpeed * (spell.endTime - EvadeUtils.TickCount) / 1000 + ObjectCache.myHeroCache.boundingRadius + spell.info.radius + extraDist + 10; var spellPos = spell.currentSpellPosition; var spellEndPos = spell.GetSpellEndPosition(); var projection = heroPos.ProjectOn(spellPos, spellEndPos); return(projection.SegmentPoint.Distance(heroPos) <= walkRadius); } else if (spell.info.spellType == SpellType.Circular) { var walkRadius = ObjectCache.myHeroCache.moveSpeed * (spell.endTime - EvadeUtils.TickCount) / 1000 + ObjectCache.myHeroCache.boundingRadius + spell.info.radius + extraDist + 10; if (heroPos.Distance(spell.endPos) < walkRadius) { return(true); } } return(false); } return(true); }
public static bool InSkillShot(this Vector2 position, Spell spell, float radius, bool predictCollision = true) { if (spell.spellType == SpellType.Line) { Vector2 spellPos = spell.currentSpellPosition; Vector2 spellEndPos = predictCollision ? spell.GetSpellEndPosition() : spell.endPos; //spellPos = spellPos - spell.direction * radius; //leave some space at back of spell //spellEndPos = spellEndPos + spell.direction * radius; //leave some space at the front of spell /*if (spell.info.projectileSpeed == float.MaxValue && Evade.GetTickCount - spell.startTime > spell.info.spellDelay) { return false; }*/ var projection = position.ProjectOn(spellPos, spellEndPos); /*if (projection.SegmentPoint.Distance(spellEndPos) < 100) //Check Skillshot endpoints { //unfinished }*/ return projection.IsOnSegment && projection.SegmentPoint.Distance(position) <= spell.radius + radius; } else if (spell.spellType == SpellType.Circular) { if (spell.info.spellName == "VeigarEventHorizon") { return position.Distance(spell.endPos) <= spell.radius + radius - ObjectCache.myHeroCache.boundingRadius && position.Distance(spell.endPos) >= spell.radius + radius - ObjectCache.myHeroCache.boundingRadius - 125; } return position.Distance(spell.endPos) <= spell.radius + radius - ObjectCache.myHeroCache.boundingRadius; } else if (spell.spellType == SpellType.Arc) { if (position.isLeftOfLineSegment(spell.startPos, spell.endPos)) { return false; } var spellRange = spell.startPos.Distance(spell.endPos); var midPoint = spell.startPos + spell.direction * (spellRange/2); return position.Distance(midPoint) <= spell.radius + radius - ObjectCache.myHeroCache.boundingRadius; } else if (spell.spellType == SpellType.Cone) { } return false; }
public static bool InSkillShot(this Vector2 position, Spell spell, float radius, bool predictCollision = true) { if (spell.spellType == SpellType.Line) { Vector2 spellPos = spell.currentSpellPosition; Vector2 spellEndPos = predictCollision ? spell.GetSpellEndPosition() : spell.endPos; //spellPos = spellPos - spell.direction * radius; //leave some space at back of spell //spellEndPos = spellEndPos + spell.direction * radius; //leave some space at the front of spell /*if (spell.info.projectileSpeed == float.MaxValue * && Evade.GetTickCount - spell.startTime > spell.info.spellDelay) * { * return false; * }*/ var projection = position.ProjectOn(spellPos, spellEndPos); /*if (projection.SegmentPoint.Distance(spellEndPos) < 100) //Check Skillshot endpoints * { * //unfinished * }*/ return(projection.IsOnSegment && projection.SegmentPoint.Distance(position) <= spell.radius + radius); } else if (spell.spellType == SpellType.Circular) { if (spell.info.spellName == "VeigarEventHorizon") { return(position.Distance(spell.endPos) <= spell.radius + radius - ObjectCache.myHeroCache.boundingRadius && position.Distance(spell.endPos) >= spell.radius + radius - ObjectCache.myHeroCache.boundingRadius - 125); } return(position.Distance(spell.endPos) <= spell.radius + radius - ObjectCache.myHeroCache.boundingRadius); } else if (spell.spellType == SpellType.Arc) { if (position.isLeftOfLineSegment(spell.startPos, spell.endPos)) { return(false); } var spellRange = spell.startPos.Distance(spell.endPos); var midPoint = spell.startPos + spell.direction * (spellRange / 2); return(position.Distance(midPoint) <= spell.radius + radius - ObjectCache.myHeroCache.boundingRadius); } else if (spell.spellType == SpellType.Cone) { } return(false); }
public static Vector2 GetSpellProjection(this Spell spell, Vector2 pos, bool predictPos = false) { if (spell.spellType == SpellType.Line) { if (predictPos) { var spellPos = spell.currentSpellPosition; var spellEndPos = spell.GetSpellEndPosition(); return(pos.ProjectOn(spellPos, spellEndPos).SegmentPoint); } return(pos.ProjectOn(spell.startPos, spell.endPos).SegmentPoint); } if (spell.spellType == SpellType.Arc) { if (predictPos) { var spellPos = spell.currentSpellPosition; var spellEndPos = spell.GetSpellEndPosition(); return(pos.ProjectOn(spellPos, spellEndPos).SegmentPoint); } return(pos.ProjectOn(spell.startPos, spell.endPos).SegmentPoint); } if (spell.spellType == SpellType.Circular) { return(spell.endPos); } if (spell.spellType == SpellType.Cone) { } return(Vector2.Zero); }
public static bool InSkillShot(this Vector2 position, Spell spell, float radius, bool predictCollision = true) { if (spell.spellType == SpellType.Line) { Vector2 spellPos = spell.currentSpellPosition; Vector2 spellEndPos = predictCollision ? spell.GetSpellEndPosition() : spell.endPos; var projection = position.ProjectOn(spellPos, spellEndPos); return projection.IsOnSegment && projection.SegmentPoint.Distance(position) <= spell.radius + radius; } if (spell.spellType == SpellType.Circular) { if (spell.info.spellName == "VeigarEventHorizon") { return position.Distance(spell.endPos) <= spell.radius + radius - ObjectCache.myHeroCache.boundingRadius && position.Distance(spell.endPos) >= spell.radius + radius - ObjectCache.myHeroCache.boundingRadius - 125; } if (spell.info.spellName == "DariusCleave") { return position.Distance(spell.endPos) <= spell.radius + radius - ObjectCache.myHeroCache.boundingRadius && position.Distance(spell.endPos) >= spell.radius + radius - ObjectCache.myHeroCache.boundingRadius - 220; } return position.Distance(spell.endPos) <= spell.radius + radius - ObjectCache.myHeroCache.boundingRadius; } if (spell.spellType == SpellType.Arc) { if (position.isLeftOfLineSegment(spell.startPos, spell.endPos)) { return false; } var spellRange = spell.startPos.Distance(spell.endPos); var midPoint = spell.startPos + spell.direction * (spellRange/2); return position.Distance(midPoint) <= spell.radius + radius - ObjectCache.myHeroCache.boundingRadius; } if (spell.spellType == SpellType.Cone) { var a = spell.startPos + spell.direction; var ab = spell.endPos + spell.direction.Perpendicular() * spell.radius; var ac = spell.endPos - spell.direction.Perpendicular() * spell.radius; return !position.isLeftOfLineSegment(a, ab) && !position.isLeftOfLineSegment(ab, ac) && !position.isLeftOfLineSegment(ac, a); } return false; }
public static bool CanHeroWalkIntoSpell(Spell spell) { if (ObjectCache.menuCache.cache["AdvancedSpellDetection"].Cast <CheckBox>().CurrentValue) { Vector2 heroPos = myHero.Position.LSTo2D(); var extraDist = myHero.LSDistance(ObjectCache.myHeroCache.serverPos2D); if (spell.spellType == SpellType.Line) { var walkRadius = ObjectCache.myHeroCache.moveSpeed * (spell.endTime - EvadeUtils.TickCount) / 1000 + ObjectCache.myHeroCache.boundingRadius + spell.info.radius + extraDist + 10; var spellPos = spell.currentSpellPosition; var spellEndPos = spell.GetSpellEndPosition(); var projection = heroPos.ProjectOn(spellPos, spellEndPos); return(projection.SegmentPoint.LSDistance(heroPos) <= walkRadius); } else if (spell.spellType == SpellType.Circular) { var walkRadius = ObjectCache.myHeroCache.moveSpeed * (spell.endTime - EvadeUtils.TickCount) / 1000 + ObjectCache.myHeroCache.boundingRadius + spell.info.radius + extraDist + 10; if (heroPos.LSDistance(spell.endPos) < walkRadius) { return(true); } } else if (spell.spellType == SpellType.Arc) { var spellRange = spell.startPos.LSDistance(spell.endPos); var midPoint = spell.startPos + spell.direction * (spellRange / 2); var arcRadius = spell.info.radius * (1 + spellRange / 100); var walkRadius = ObjectCache.myHeroCache.moveSpeed * (spell.endTime - EvadeUtils.TickCount) / 1000 + ObjectCache.myHeroCache.boundingRadius + arcRadius + extraDist + 10; if (heroPos.LSDistance(midPoint) < walkRadius) { return(true); } } return(false); } return(true); }
public static BoundingBox GetLinearSpellBoundingBox(this Spell spell) { var myBoundingRadius = ObjectCache.myHeroCache.boundingRadius; var spellDir = spell.direction; var pSpellDir = spell.direction.Perpendicular(); var spellRadius = spell.radius; var spellPos = spell.currentSpellPosition - spellDir * myBoundingRadius; //leave some space at back of spell var endPos = spell.GetSpellEndPosition() + 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))); }
private void Drawing_OnDraw(EventArgs args) { if (ObjectCache.menuCache.cache["DrawEvadePosition"].Cast <CheckBox>().CurrentValue) { //Render.Circle.DrawCircle(myHero.Position.ExtendDir(dir, 500), 65, Color.Red, 10); /*foreach (var point in myHero.Path) * { * Render.Circle.DrawCircle(point, 65, Color.Red, 10); * }*/ if (Evade.lastPosInfo != null) { var pos = Evade.lastPosInfo.position; //Evade.lastEvadeCommand.targetPosition; Render.Circle.DrawCircle(new Vector3(pos.X, pos.Y, myHero.Position.Z), 65, Color.Red, 10); } } DrawEvadeStatus(); if (ObjectCache.menuCache.cache["DrawSkillShots"].Cast <CheckBox>().CurrentValue == false) { return; } foreach (KeyValuePair <int, Spell> entry in SpellDetector.drawSpells) { Spell spell = entry.Value; var dangerStr = spell.GetSpellDangerString(); //var spellDrawingConfig = ObjectCache.menuCache.cache[dangerStr + "Color"].GetValue<Circle>(); var spellDrawingWidth = ObjectCache.menuCache.cache[dangerStr + "Width"].Cast <Slider>().CurrentValue; if (ObjectCache.menuCache.cache[spell.info.spellName + "DrawSpell"].Cast <CheckBox>().CurrentValue) { if (spell.spellType == SpellType.Line) { Vector2 spellPos = spell.currentSpellPosition; Vector2 spellEndPos = spell.GetSpellEndPosition(); DrawLineRectangle(spellPos, spellEndPos, (int)spell.radius, spellDrawingWidth, Color.White); /*foreach (var hero in ObjectManager.Get<AIHeroClient>()) * { * Render.Circle.DrawCircle(new Vector3(hero.ServerPosition.X, hero.ServerPosition.Y, myHero.Position.Z), (int)spell.radius, Color.Red, 5); * }*/ if (ObjectCache.menuCache.cache["DrawSpellPos"].Cast <CheckBox>().CurrentValue)// && spell.spellObject != null) { //spellPos = SpellDetector.GetCurrentSpellPosition(spell, true, ObjectCache.gamePing); /*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)ObjectCache.gamePing / 1000); * Render.Circle.DrawCircle(new Vector3(spellPos2.X, spellPos2.Y, myHero.Position.Z), (int)spell.radius, Color.Red, 8); * }*/ /*if (spell.spellObject != null && spell.spellObject.IsValid && spell.spellObject.IsVisible && * spell.spellObject.Position.To2D().Distance(ObjectCache.myHeroCache.serverPos2D) < spell.info.range + 1000)*/ Render.Circle.DrawCircle(new Vector3(spellPos.X, spellPos.Y, myHero.Position.Z), (int)spell.radius, Color.White, spellDrawingWidth); } } else if (spell.spellType == SpellType.Circular) { Render.Circle.DrawCircle(new Vector3(spell.endPos.X, spell.endPos.Y, spell.height), (int)spell.radius, Color.White, spellDrawingWidth); if (spell.info.spellName == "VeigarEventHorizon") { Render.Circle.DrawCircle(new Vector3(spell.endPos.X, spell.endPos.Y, spell.height), (int)spell.radius - 125, Color.White, spellDrawingWidth); } } else if (spell.spellType == SpellType.Arc) { /*var spellRange = spell.startPos.Distance(spell.endPos); * var midPoint = spell.startPos + spell.direction * (spellRange / 2); * * Render.Circle.DrawCircle(new Vector3(midPoint.X, midPoint.Y, myHero.Position.Z), (int)spell.radius, spellDrawingConfig.Color, spellDrawingWidth); * * Drawing.DrawLine(Drawing.WorldToScreen(spell.startPos.To3D()), * Drawing.WorldToScreen(spell.endPos.To3D()), * spellDrawingWidth, spellDrawingConfig.Color);*/ } else if (spell.spellType == SpellType.Cone) { } } } }
private void Drawing_OnDraw(EventArgs args) { if (ObjectCache.menuCache.cache["DrawSkillShots"].GetValue <bool>() == false) { return; } if (ObjectCache.menuCache.cache["DrawEvadePosition"].GetValue <bool>()) { /*Render.Circle.DrawCircle(myHero.Position, 35, Color.White, 10); * Render.Circle.DrawCircle(myHero.ServerPosition, 65, Color.Red, 10); * var dist = (int)myHero.Position.Distance(myHero.ServerPosition); * //Drawing.DrawText(0, 0, Color.White, "Evade: " + (int)dist); * //Console.WriteLine(dist);*/ if (Evade.lastPosInfo != null) { var pos = Evade.lastPosInfo.position; //Evade.lastEvadeCommand.targetPosition; 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 = ObjectCache.menuCache.cache[dangerStr + "Color"].GetValue <Circle>(); var spellDrawingWidth = ObjectCache.menuCache.cache[dangerStr + "Width"].GetValue <Slider>().Value; if (ObjectCache.menuCache.cache[spell.info.spellName + "DrawSpell"].GetValue <bool>() && spellDrawingConfig.Active) { if (spell.info.spellType == SpellType.Line) { Vector2 spellPos = spell.currentSpellPosition; Vector2 spellEndPos = spell.GetSpellEndPosition(); DrawLineRectangle(spellPos, spellEndPos, (int)spell.radius, 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.radius, Color.Red, 5); * }*/ if (ObjectCache.menuCache.cache["DrawSpellPos"].GetValue <bool>())// && spell.spellObject != null) { //spellPos = SpellDetector.GetCurrentSpellPosition(spell, true, ObjectCache.gamePing); /*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)ObjectCache.gamePing / 1000); * Render.Circle.DrawCircle(new Vector3(spellPos2.X, spellPos2.Y, myHero.Position.Z), (int)spell.radius, Color.Red, 8); * }*/ /*if (spell.spellObject != null && spell.spellObject.IsValid && spell.spellObject.IsVisible && * spell.spellObject.Position.To2D().Distance(ObjectCache.myHeroCache.serverPos2D) < spell.info.range + 1000)*/ Render.Circle.DrawCircle(new Vector3(spellPos.X, spellPos.Y, myHero.Position.Z), (int)spell.radius, 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.radius, spellDrawingConfig.Color, spellDrawingWidth); } else if (spell.info.spellType == SpellType.Cone) { } } } }
public static bool CanHeroWalkIntoSpell(Spell spell) { if (ObjectCache.menuCache.cache["AdvancedSpellDetection"].Cast<CheckBox>().CurrentValue) { Vector2 heroPos = myHero.Position.To2D(); var extraDist = myHero.Distance(ObjectCache.myHeroCache.serverPos2D); if (spell.spellType == SpellType.Line) { var walkRadius = ObjectCache.myHeroCache.moveSpeed * (spell.endTime - EvadeUtils.TickCount) / 1000 + ObjectCache.myHeroCache.boundingRadius + spell.info.radius + extraDist + 10; var spellPos = spell.currentSpellPosition; var spellEndPos = spell.GetSpellEndPosition(); var projection = heroPos.ProjectOn(spellPos, spellEndPos); return projection.SegmentPoint.Distance(heroPos) <= walkRadius; } else if (spell.spellType == SpellType.Circular) { var walkRadius = ObjectCache.myHeroCache.moveSpeed * (spell.endTime - EvadeUtils.TickCount) / 1000 + ObjectCache.myHeroCache.boundingRadius + spell.info.radius + extraDist + 10; if (heroPos.Distance(spell.endPos) < walkRadius) { return true; } } else if (spell.spellType == SpellType.Arc) { var spellRange = spell.startPos.Distance(spell.endPos); var midPoint = spell.startPos + spell.direction * (spellRange / 2); var arcRadius = spell.info.radius * (1 + spellRange / 100); var walkRadius = ObjectCache.myHeroCache.moveSpeed * (spell.endTime - EvadeUtils.TickCount) / 1000 + ObjectCache.myHeroCache.boundingRadius + arcRadius + extraDist + 10; if (heroPos.Distance(midPoint) < walkRadius) { return true; } } return false; } return true; }
private void Drawing_OnDraw(EventArgs args) { if (ObjectCache.menuCache.cache["DrawEvadePosition"].GetValue <bool>()) { //Render.Circle.DrawCircle(myHero.Position.ExtendDir(dir, 500), 65, Color.Red, 10); /*foreach (var point in myHero.Path) * { * Render.Circle.DrawCircle(point, 65, Color.Red, 10); * }*/ if (Evade.lastPosInfo != null) { var pos = Evade.lastPosInfo.position; //Evade.lastEvadeCommand.targetPosition; Render.Circle.DrawCircle(new Vector3(pos.X, pos.Y, myHero.Position.Z), 65, Color.Red, 10); } } DrawEvadeStatus(); if (ObjectCache.menuCache.cache["DrawSkillShots"].GetValue <bool>() == false) { return; } foreach (KeyValuePair <int, Spell> entry in SpellDetector.drawSpells) { Spell spell = entry.Value; var dangerStr = spell.GetSpellDangerString(); var spellDrawingConfig = ObjectCache.menuCache.cache[dangerStr + "Color"].GetValue <Circle>(); var spellDrawingWidth = ObjectCache.menuCache.cache[dangerStr + "Width"].GetValue <Slider>().Value; var avoidRadius = ObjectCache.menuCache.cache["ExtraAvoidDistance"].GetValue <Slider>().Value; if (ObjectCache.menuCache.cache[spell.info.spellName + "DrawSpell"].GetValue <bool>() && spellDrawingConfig.Active) { bool canEvade = !(Evade.lastPosInfo != null && Evade.lastPosInfo.undodgeableSpells.Contains(spell.spellID)) || !Evade.devModeOn; if (spell.spellType == SpellType.Line) { Vector2 spellPos = spell.currentSpellPosition; Vector2 spellEndPos = spell.GetSpellEndPosition(); DrawLineRectangle(spellPos, spellEndPos, (int)spell.radius, spellDrawingWidth, !canEvade ? Color.Yellow : spellDrawingConfig.Color); if (ObjectCache.menuCache.cache["DrawSpellPos"].GetValue <bool>())// && spell.spellObject != null) { Render.Circle.DrawCircle(new Vector3(spellPos.X, spellPos.Y, spell.height), (int)spell.radius, !canEvade ? Color.Yellow : spellDrawingConfig.Color, spellDrawingWidth); } } else if (spell.spellType == SpellType.Circular) { Render.Circle.DrawCircle(new Vector3(spell.endPos.X, spell.endPos.Y, spell.height), (int)spell.radius, !canEvade ? Color.Yellow : spellDrawingConfig.Color, spellDrawingWidth); if (spell.info.spellName == "VeigarEventHorizon") { Render.Circle.DrawCircle(new Vector3(spell.endPos.X, spell.endPos.Y, spell.height), (int)spell.radius - 125, !canEvade ? Color.Yellow : spellDrawingConfig.Color, spellDrawingWidth); } else if (spell.info.spellName == "DariusCleave") { Render.Circle.DrawCircle(new Vector3(spell.endPos.X, spell.endPos.Y, spell.height), (int)spell.radius - 220, !canEvade ? Color.Yellow : spellDrawingConfig.Color, spellDrawingWidth); } } else if (spell.spellType == SpellType.Arc) { /*var spellRange = spell.startPos.Distance(spell.endPos); * var midPoint = spell.startPos + spell.direction * (spellRange / 2); * * Render.Circle.DrawCircle(new Vector3(midPoint.X, midPoint.Y, myHero.Position.Z), (int)spell.radius, spellDrawingConfig.Color, spellDrawingWidth); * * Drawing.DrawLine(Drawing.WorldToScreen(spell.startPos.To3D()), * Drawing.WorldToScreen(spell.endPos.To3D()), * spellDrawingWidth, spellDrawingConfig.Color);*/ } else if (spell.spellType == SpellType.Cone) { DrawLineTriangle(spell.startPos, spell.endPos, (int)spell.radius, spellDrawingWidth, !canEvade ? Color.Yellow : spellDrawingConfig.Color); } } } }
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; }
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(); 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); }