private static void ECast(AIHeroClient enemy) { var range = Orbwalking.GetRealAutoAttackRange(enemy); var path = Geometry.CircleCircleIntersection(ObjectManager.Player.ServerPosition.LSTo2D(), Prediction.GetPrediction(enemy, 0.25f).UnitPosition.LSTo2D(), LucianSpells.E.Range, range); if (path.Count() > 0) { var epos = path.MinOrDefault(x => x.LSDistance(Game.CursorPos)); if (epos.To3D().UnderTurret(true) || epos.To3D().LSIsWall()) { return; } if (epos.To3D().CountEnemiesInRange(LucianSpells.E.Range - 100) > 0) { return; } LucianSpells.E.Cast(epos); } if (path.Count() == 0) { var epos = ObjectManager.Player.ServerPosition.LSExtend(enemy.ServerPosition, -LucianSpells.E.Range); if (epos.UnderTurret(true) || epos.LSIsWall()) { return; } // no intersection or target to close LucianSpells.E.Cast(ObjectManager.Player.ServerPosition.LSExtend(enemy.ServerPosition, -LucianSpells.E.Range)); } }
public static void CastSafePosition(Spell spell, AIHeroClient hero) { if ( Geometry.CircleCircleIntersection(ObjectManager.Player.ServerPosition.To2D(), Prediction.GetPrediction(hero, 0f, hero.AttackRange).UnitPosition.To2D(), spell.Range, Orbwalking.GetRealAutoAttackRange(hero)).Count() > 0) { spell.Cast( Geometry.CircleCircleIntersection(ObjectManager.Player.ServerPosition.To2D(), Prediction.GetPrediction(hero, 0f, hero.AttackRange).UnitPosition.To2D(), spell.Range, Orbwalking.GetRealAutoAttackRange(hero)).MinOrDefault(i => i.Distance(Game.CursorPos))); } else { spell.Cast(ObjectManager.Player.ServerPosition.Extend(hero.ServerPosition, -spell.Range)); } }
internal static Vector2[] GetCandidates(Vector2 from, Vector2 to, float radius, float range) { var middlePoint = (from + to) / 2; var intersections = Geometry.CircleCircleIntersection( from, middlePoint, radius, from.Distance(middlePoint)); if (intersections.Length > 1) { var c1 = intersections[0]; var c2 = intersections[1]; c1 = from + range * (to - c1).Normalized(); c2 = from + range * (to - c2).Normalized(); return(new[] { c1, c2 }); } return(new Vector2[] { }); }