public static bool wontHitOnDash(Skillshot ss, Obj_AI_Base jumpOn, Skillshot skillShot, Vector2 dashDir) { float currentDashSpeed = 700 + myHero.MoveSpeed;//At least has to be like this Vector2 intersectionPoint = LineIntersectionPoint(myHero.Position.To2D(), V2E(myHero.Position, jumpOn.Position, 475), ss.Start, ss.End); float arrivingTime = Vector2.Distance(myHero.Position.To2D(), intersectionPoint) / currentDashSpeed; Vector2 skillshotPosition = ss.GetMissilePosition((int)(arrivingTime * 1000)); if (Vector2.DistanceSquared(skillshotPosition, intersectionPoint) < (ss.SpellData.Radius + myHero.BoundingRadius) && !willColide(skillShot, myHero.Position.To2D(), 700f + myHero.MoveSpeed, dashDir, myHero.BoundingRadius + skillShot.SpellData.Radius)) return false; return true; }
public static Vector2 GetCollisionPoint(Skillshot skillshot) { var collisions = new List<DetectedCollision>(); var from = skillshot.GetMissilePosition(0); skillshot.ForceDisabled = false; foreach (var cObject in skillshot.SpellData.CollisionObjects) { switch (cObject) { case CollisionObjectTypes.Minion: foreach (var minion in EntityManager.MinionsAndMonsters.GetLaneMinions(EntityManager.UnitTeam.Enemy, ObjectManager.Player.ServerPosition )) { var pred = FastPrediction( from, minion, Math.Max(0, skillshot.SpellData.Delay - (Environment.TickCount - skillshot.StartTick)), skillshot.SpellData.MissileSpeed); var pos = pred.PredictedPos; var w = skillshot.SpellData.RawRadius + (!pred.IsMoving ? (minion.BoundingRadius - 15) : 0) - pos.Distance(from, skillshot.End, true); if (w > 0) { collisions.Add( new DetectedCollision { Position = pos.ProjectOn(skillshot.End, skillshot.Start).LinePoint + skillshot.Direction * 30, Unit = minion, Type = CollisionObjectTypes.Minion, Distance = pos.Distance(from), Diff = w, }); } } break; case CollisionObjectTypes.Champion: foreach (var hero in ObjectManager.Get<AIHeroClient>() .Where( h => (h.IsValidTarget(1200) && h.Team == ObjectManager.Player.Team && !h.IsMe || h.Team != ObjectManager.Player.Team))) { var pred = FastPrediction( from, hero, Math.Max(0, skillshot.SpellData.Delay - (Environment.TickCount - skillshot.StartTick)), skillshot.SpellData.MissileSpeed); var pos = pred.PredictedPos; var w = skillshot.SpellData.RawRadius + 30 - pos.Distance(from, skillshot.End, true); if (w > 0) { collisions.Add( new DetectedCollision { Position = pos.ProjectOn(skillshot.End, skillshot.Start).LinePoint + skillshot.Direction * 30, Unit = hero, Type = CollisionObjectTypes.Minion, Distance = pos.Distance(from), Diff = w, }); } } break; case CollisionObjectTypes.YasuoWall: if ( !ObjectManager.Get<AIHeroClient>() .Any( hero => hero.IsValidTarget(float.MaxValue) && hero.Team == ObjectManager.Player.Team && hero.ChampionName == "Yasuo")) { break; } GameObject wall = null; foreach (var gameObject in ObjectManager.Get<GameObject>()) { if (gameObject.IsValid && Object.Equals( gameObject.Name, "_w_windwall.\\.troy" )) { wall = gameObject; } } if (wall == null) { break; } var level = wall.Name.Substring(wall.Name.Length - 6, 1); var wallWidth = (300 + 50 * Convert.ToInt32(level)); var wallDirection = (wall.Position.To2D() - YasuoWallCastedPos).Normalized().Perpendicular(); var wallStart = wall.Position.To2D() + wallWidth / 2 * wallDirection; var wallEnd = wallStart - wallWidth * wallDirection; var wallPolygon = new Geometry.Rectangle(wallStart, wallEnd, 75).ToPolygon(); var intersection = new Vector2(); var intersections = new List<Vector2>(); for (var i = 0; i < wallPolygon.Points.Count; i++) { var inter = wallPolygon.Points[i].Intersection( wallPolygon.Points[i != wallPolygon.Points.Count - 1 ? i + 1 : 0], from, skillshot.End); if (inter.Intersects) { intersections.Add(inter.Point); } } if (intersections.Count > 0) { intersection = intersections.OrderBy(item => item.Distance(from)).ToList()[0]; var collisionT = Environment.TickCount + Math.Max( 0, skillshot.SpellData.Delay - (Environment.TickCount - skillshot.StartTick)) + 100 + (1000 * intersection.Distance(from)) / skillshot.SpellData.MissileSpeed; if (collisionT - WallCastT < 4000) { if (skillshot.SpellData.Type != SkillShotType.SkillshotMissileLine) { skillshot.ForceDisabled = true; } return intersection; } } break; } } Vector2 result; if (collisions.Count > 0) { result = collisions.OrderBy(c => c.Distance).ToList()[0].Position; } else { result = new Vector2(); } return result; }