private static PredictionOutput GetPrediction(this PredictionInput input, bool ft, bool checkCollision) { if (!input.Unit.IsValidTarget(float.MaxValue, false)) { return(new PredictionOutput()); } if (ft) { input.Delay += Game.Ping / 2000f + 0.06f; if (input.AoE) { return(Cluster.GetAoEPrediction(input)); } } if (Math.Abs(input.Range - float.MaxValue) > float.Epsilon && input.Unit.DistanceSquared(input.RangeCheckFrom) > Math.Pow(input.Range * 1.5, 2)) { return(new PredictionOutput { Input = input, Hitchance = HitChance.OutOfRange }); } PredictionOutput result = null; if (input.Unit.IsDashing()) { result = input.GetDashingPrediction(); } else { var remainingImmobileT = input.Unit.IsImmobileUntil(); if (remainingImmobileT >= 0d) { result = input.GetImmobilePrediction(remainingImmobileT); } } if (result == null) { result = input.GetStandardPrediction(); } if (Math.Abs(input.Range - float.MaxValue) > float.Epsilon) { if (result.Hitchance >= HitChance.High && input.RangeCheckFrom.DistanceSquared(input.Unit.Position) > Math.Pow(input.Range + input.RealRadius * 3 / 4, 2)) { result.Hitchance = HitChance.Medium; } if (input.RangeCheckFrom.DistanceSquared(result.UnitPosition) > Math.Pow(input.Range + (input.Type == SkillshotType.SkillshotCircle ? input.RealRadius : 0), 2)) { result.Hitchance = HitChance.OutOfRange; } if (input.RangeCheckFrom.DistanceSquared(result.CastPosition) > Math.Pow(input.Range, 2)) { if (result.Hitchance != HitChance.OutOfRange) { result.CastPosition = input.RangeCheckFrom.Extend(result.UnitPosition, input.Range); } else { result.Hitchance = HitChance.OutOfRange; } } } if (result.Hitchance == HitChance.High) { result.Hitchance = input.GetHitChance(); } if (checkCollision && input.Collision && result.Hitchance > HitChance.Impossible) { var originalUnit = input.Unit; result.CollisionObjects = Collisions.GetCollision(result.UnitPosition, input); result.CollisionObjects.RemoveAll(i => i.Compare(originalUnit)); if (result.CollisionObjects.Count > 0) { result.Hitchance = HitChance.Collision; } } return(result); }