public static PredictionOutput GetPrediction(PredictionInput input, bool ft, bool checkCollision) { PredictionOutput predictionOutput = null; if (!input.Unit.IsValidTarget(float.MaxValue, false)) { return(new PredictionOutput()); } if (ft) { input.Delay += Game.Ping / 2000f + 0.06f; if (input.Aoe) { return(AoePrediction.GetPrediction(input)); } } if (Math.Abs(input.Range - 3.40282347E+38f) > 1.401298E-45f && (double)input.Unit.DistanceSquared(input.RangeCheckFrom) > Math.Pow((double)input.Range * 1.5, 2.0)) { return(new PredictionOutput { Input = input }); } if (input.Unit.IsDashing()) { predictionOutput = Prediction.GetDashingPrediction(input); } else { double num = Prediction.UnitIsImmobileUntil(input.Unit); if (num >= 0.0) { predictionOutput = Prediction.GetImmobilePrediction(input, num); } else { input.Range = input.Range * item.Value / 100f; } } if (predictionOutput == null) { predictionOutput = Prediction.GetStandardPrediction(input); } if (Math.Abs(input.Range - 3.40282347E+38f) > 1.401298E-45f) { if (predictionOutput.Hitchance >= HitChance.High && (double)input.RangeCheckFrom.DistanceSquared(input.Unit.Position) > Math.Pow((double)(input.Range + input.RealRadius * 3f / 4f), 2.0)) { predictionOutput.Hitchance = HitChance.Medium; } if ((double)input.RangeCheckFrom.DistanceSquared(predictionOutput.UnitPosition) > Math.Pow((double)(input.Range + ((input.Type == SkillshotType.SkillshotCircle) ? input.RealRadius : 0f)), 2.0)) { predictionOutput.Hitchance = HitChance.OutOfRange; } if ((double)input.RangeCheckFrom.DistanceSquared(predictionOutput.CastPosition) > Math.Pow((double)input.Range, 2.0)) { if (predictionOutput.Hitchance != HitChance.OutOfRange) { predictionOutput.CastPosition = input.RangeCheckFrom + input.Range * (predictionOutput.UnitPosition - input.RangeCheckFrom).ToVector2().Normalized().ToVector3(); } else { predictionOutput.Hitchance = HitChance.OutOfRange; } } } if (checkCollision && input.Collision) { var positions = new List <Vector3> { predictionOutput.UnitPosition, predictionOutput.CastPosition }; AIBaseClient originalUnit = input.Unit; predictionOutput.CollisionObjects = Collision.GetCollision(positions, input); predictionOutput.CollisionObjects.RemoveAll(x => x.NetworkId == originalUnit.NetworkId); predictionOutput.Hitchance = ((predictionOutput.CollisionObjects.Count > 0) ? HitChance.Collision : predictionOutput.Hitchance); } if (input.CollisionYasuoWall && predictionOutput.Hitchance > HitChance.Impossible && new List <Vector3> { predictionOutput.UnitPosition, predictionOutput.CastPosition, input.Unit.Position }.GetYasuoWallCollision(input.From)) { predictionOutput.Hitchance = HitChance.Collision; } if (predictionOutput.Hitchance == HitChance.High || predictionOutput.Hitchance == HitChance.VeryHigh) { List <Vector2> waypoints = input.Unit.GetWaypoints(); if (waypoints.Count > 1 != input.Unit.IsMoving) { predictionOutput.Hitchance = HitChance.Medium; } else if (waypoints.Count > 0) { Vector3 v = waypoints.Last <Vector2>().ToVector3(); float num2 = v.Distance(input.Unit.Position); float num3 = input.From.Distance(input.Unit.Position); float num4 = v.Distance(input.From); float num5 = num3 / input.Speed; if (Math.Abs(input.Speed - 3.40282347E+38f) < 1.401298E-45f) { num5 = 0f; } float num6 = num5 + input.Delay; float num7 = input.Unit.MoveSpeed * num6 * 0.35f; if (input.Type == SkillshotType.SkillshotCircle) { num7 -= input.Radius / 2f; } if (num4 <= num3 && num3 > input.Range - num7) { predictionOutput.Hitchance = HitChance.Medium; } if (num2 > 0f && num2 < 100f) { predictionOutput.Hitchance = HitChance.Medium; } } } return(predictionOutput); }
public static PredictionOutput GetPrediction(PredictionInput input) { return(Prediction.GetPrediction(input, true, true)); }