private static PredictionOutput GetStandardPrediction(this PredictionInput input) { var speed = input.Unit.MoveSpeed; if (input.Unit.DistanceSquared(input.From) < 200 * 200) { speed /= 1.5f; } /*var hero = input.Unit as Obj_AI_Hero; * if (hero != null && UnitTracker.CanTrack(hero) && UnitTracker.IsSpamClick(hero)) * { * return input.GetPositionOnPath(UnitTracker.GetWaypoints(hero), speed); * }*/ return(input.GetPositionOnPath(input.Unit.GetWaypoints(), speed)); }
private static PredictionOutput GetDashingPrediction(this PredictionInput input) { var dashData = input.Unit.GetDashInfo(); var result = new PredictionOutput { Input = input }; if (!dashData.IsBlink) { var endP = dashData.EndPos; var dashPred = input.GetPositionOnPath( new List <Vector2> { input.Unit.ServerPosition.ToVector2(), endP }, dashData.Speed); if (dashPred.Hitchance >= HitChance.High && dashPred.UnitPosition.ToVector2().Distance(input.Unit.Position.ToVector2(), endP, true) < 200) { dashPred.CastPosition = dashPred.UnitPosition; dashPred.Hitchance = HitChance.Dashing; return(dashPred); } if (dashData.Path.PathLength() > 200) { var timeToPoint = input.Delay / 2f + input.From.Distance(endP) / input.Speed - 0.25f; if (timeToPoint <= input.Unit.Distance(endP) / dashData.Speed + input.RealRadius / input.Unit.MoveSpeed) { result.Hitchance = HitChance.Dashing; } } dashPred.CastPosition = endP.ToVector3(); dashPred.UnitPosition = dashPred.CastPosition; } return(result); }