private static Tuple <Vector3, int> GetMecqFarmPos() { List <Vector2> pointsList = (from current in ObjectManager.Get <Obj_AI_Minion>() where current.IsEnemy && Vector3.Distance(ObjectManager.Player.ServerPosition, current.Position) <= (Q.Range + (W.Width / 2)) let prediction = Q.GetPrediction(current) let damage = ObjectManager.Player.GetSpellDamage(current, SpellSlot.W) * 0.75 where prediction.Hitchance >= HitChance.High && damage > current.Health select prediction.CastPosition.To2D()).ToList(); while (pointsList.Count != 0) { MEC.MecCircle circle = MEC.GetMec(pointsList); int numPoints = pointsList.Count; if (circle.Radius <= (W.Width / 2) && numPoints >= 2 && W.IsReady()) { return(Tuple.Create(circle.Center.To3D(), numPoints)); } try { float distance = -1f; int index = 0; Vector2 point = pointsList.ElementAt(0); for (int i = 1; i == numPoints; i++) { if (Vector2.Distance(pointsList.ElementAt(i), point) >= distance) { distance = Vector2.Distance(pointsList.ElementAt(i), point); index = i; } } pointsList.RemoveAt(index); } catch (ArgumentOutOfRangeException) { var outOfRange = new Vector3(0); return(Tuple.Create(outOfRange, -1)); } } var noResult = new Vector3(0); return(Tuple.Create(noResult, -1)); }
private static Tuple <Vector3, int> getMECQPos(Obj_AI_Hero target) { var pointsList = new List <Vector2>(); PredictionOutput targetPred = Q.GetPrediction(target); if (targetPred.Hitchance >= HitChance.High) { pointsList.Add(targetPred.CastPosition.To2D()); } foreach (Obj_AI_Hero current in ObjectManager.Get <Obj_AI_Hero>()) { if (!current.IsMe && current.NetworkId != target.NetworkId && current.IsEnemy && current.IsValidTarget(Q.Range + (R.Width / 2))) { PredictionOutput prediction = Q.GetPrediction(current); if (prediction.Hitchance >= HitChance.High) { pointsList.Add(prediction.CastPosition.To2D()); } } } while (pointsList.Count != 0) { MEC.MecCircle circle = MEC.GetMec(pointsList); int numPoints = pointsList.Count; if (circle.Radius <= (R.Width / 2) && numPoints >= 3 && R.IsReady()) { return(Tuple.Create(circle.Center.To3D(), 3)); } if (circle.Radius <= (W.Width / 2) && numPoints >= 2 && W.IsReady()) { return(Tuple.Create(circle.Center.To3D(), 2)); } if (pointsList.Count == 1) { return(Tuple.Create(circle.Center.To3D(), 1)); } if (circle.Radius <= ((Q.Width / 2) + 50) && numPoints > 1) { return(Tuple.Create(circle.Center.To3D(), 4)); } try { float distance = -1f; int index = 0; Vector2 point = pointsList.ElementAt(0); for (int i = 1; i == numPoints; i++) { if (Vector2.Distance(pointsList.ElementAt(i), point) >= distance) { distance = Vector2.Distance(pointsList.ElementAt(i), point); index = i; } } pointsList.RemoveAt(index); } catch (ArgumentOutOfRangeException) { var outOfRange = new Vector3(0); return(Tuple.Create(outOfRange, -1)); } } var noResult = new Vector3(0); return(Tuple.Create(noResult, -1)); }
// Token: 0x0600004A RID: 74 RVA: 0x0000FBAC File Offset: 0x0000DDAC private void GetAreaOfEffectPrediction(PredictionInput9 input, PredictionOutput9 output) { List <PredictionOutput9> targets = new List <PredictionOutput9>(); IEnumerable <Unit9> areaOfEffectTargets = input.AreaOfEffectTargets; Func <Unit9, bool> < > 9__2; Func <Unit9, bool> predicate; if ((predicate = < > 9__2) == null) { predicate = (< > 9__2 = ((Unit9 x) => !x.Equals(output.Target))); } foreach (Unit9 target in areaOfEffectTargets.Where(predicate)) { PredictionInput9 input2 = new PredictionInput9 { Target = target, Caster = input.Caster, Delay = input.Delay, Speed = input.Speed, CastRange = input.CastRange, Radius = input.Radius, RequiresToTurn = input.RequiresToTurn }; PredictionOutput9 simplePrediction = this.GetSimplePrediction(input2); float num = (input.SkillShotType == SkillShotType.Line) ? (input.Range + input.CastRange) : input.Range; if (input.Caster.Distance(simplePrediction.CastPosition) < num) { targets.Add(simplePrediction); } } switch (input.SkillShotType) { case SkillShotType.AreaOfEffect: targets.Insert(0, output); output.CastPosition = ((input.CastRange > 0f) ? input.Caster.InFront(input.CastRange, 0f, true) : input.Caster.Position); output.AoeTargetsHit = (from x in targets where output.CastPosition.IsInRange(x.TargetPosition, input.Radius) select x).ToList <PredictionOutput9>(); return; case SkillShotType.RangedAreaOfEffect: targets.Insert(0, output); output.CastPosition = input.Target.Position; output.AoeTargetsHit = (from x in targets where output.CastPosition.IsInRange(x.TargetPosition, input.Radius) select x).ToList <PredictionOutput9>(); if (!output.AoeTargetsHit.Contains(output)) { output.AoeTargetsHit.Add(output); return; } break; case SkillShotType.Line: targets.Insert(0, output); if (targets.Count > 1) { Dictionary <Polygon.Rectangle, List <PredictionOutput9> > dictionary = new Dictionary <Polygon.Rectangle, List <PredictionOutput9> >(); if (input.UseBlink) { Vector3 targetPosition = output.TargetPosition; List <PredictionOutput9> list = targets.Skip(1).ToList <PredictionOutput9>(); using (List <PredictionOutput9> .Enumerator enumerator2 = list.GetEnumerator()) { while (enumerator2.MoveNext()) { PredictionOutput9 predictionOutput = enumerator2.Current; Vector3 targetPosition2 = predictionOutput.TargetPosition; Vector3 vector = (targetPosition + targetPosition2) / 2f; Vector3 vector2 = targetPosition.Extend2D(targetPosition2, -100f); Vector3 end = vector2.Extend2D(targetPosition2, input.Range); Polygon.Rectangle rec = new Polygon.Rectangle(vector2, end, input.Radius); foreach (PredictionOutput9 predictionOutput2 in list) { if (!(predictionOutput2.Target == predictionOutput.Target)) { Vector3 to = (vector + predictionOutput2.TargetPosition) / 2f; Vector3 vector3 = targetPosition.Extend2D(to, -100f); Vector3 end2 = vector3.Extend2D(to, input.Range); Polygon.Rectangle rectangle = new Polygon.Rectangle(vector3, end2, input.Radius + 50f); if (rectangle.IsInside(targetPosition2) && rectangle.IsInside(predictionOutput2.TargetPosition)) { rec = rectangle; } } } dictionary[rec] = (from x in targets where rec.IsInside(x.TargetPosition) select x).ToList <PredictionOutput9>(); } goto IL_C36; } } Vector3 position = input.Caster.Position; foreach (PredictionOutput9 predictionOutput3 in targets) { Vector3 end3 = position.Extend2D(predictionOutput3.TargetPosition, input.Range); Polygon.Rectangle rec = new Polygon.Rectangle(position, end3, input.Radius * 1.3f); if (!rec.IsOutside(output.TargetPosition.To2D())) { dictionary[rec] = (from x in targets where rec.IsInside(x.TargetPosition) select x).ToList <PredictionOutput9>(); } } IL_C36: KeyValuePair <Polygon.Rectangle, List <PredictionOutput9> > keyValuePair = dictionary.MaxOrDefault((KeyValuePair <Polygon.Rectangle, List <PredictionOutput9> > x) => x.Value.Count); if (keyValuePair.Key != null) { List <PredictionOutput9> list2 = keyValuePair.Value.ToList <PredictionOutput9>(); Vector3 to2 = list2.Aggregate(default(Vector3), (Vector3 sum, PredictionOutput9 pos) => sum + pos.TargetPosition) / (float)list2.Count; if (list2.Count == 0) { output.HitChance = HitChance.Impossible; return; } float val = list2.Max(delegate(PredictionOutput9 x) { if (!input.UseBlink) { return(input.Caster.Distance(x.TargetPosition)); } return(output.TargetPosition.Distance(x.TargetPosition)); }); float distance = Math.Min(input.UseBlink ? input.Range : input.CastRange, val); output.CastPosition = (input.UseBlink ? output.TargetPosition.Extend2D(to2, distance) : input.Caster.Position.Extend2D(to2, distance)); output.AoeTargetsHit = keyValuePair.Value; } } else { output.AoeTargetsHit.Add(output); if (input.UseBlink) { input.AreaOfEffect = false; } } if (input.UseBlink) { output.BlinkLinePosition = ((input.Caster.Distance(output.TargetPosition) > input.CastRange) ? input.Caster.Position.Extend2D(output.TargetPosition, input.CastRange) : output.TargetPosition.Extend2D(output.CastPosition, -100f)); if (input.Caster.Distance(output.BlinkLinePosition) > input.CastRange) { output.HitChance = HitChance.Impossible; } } break; case SkillShotType.Circle: { targets.Insert(0, output); if (targets.Count == 1) { output.AoeTargetsHit.Add(output); return; } Func <PredictionOutput9, bool> < > 9__4; Func <PredictionOutput9, float> < > 9__5; while (targets.Count > 1) { MEC.MecCircle mec = MEC.GetMec((from x in targets select x.TargetPosition.ToVector2()).ToList <Vector2>()); if (mec.Radius > 0f && mec.Radius < input.Radius && input.Caster.Distance(mec.Center.ToVector3(0f)) < input.Range) { output.CastPosition = new Vector3((targets.Count <= 2) ? ((targets[0].TargetPosition.ToVector2() + targets[1].TargetPosition.ToVector2()) / 2f) : mec.Center, output.CastPosition.Z); PredictionOutput9 output2 = output; IEnumerable <PredictionOutput9> targets3 = targets; Func <PredictionOutput9, bool> predicate2; if ((predicate2 = < > 9__4) == null) { predicate2 = (< > 9__4 = ((PredictionOutput9 x) => output.CastPosition.IsInRange(x.TargetPosition, input.Radius))); } output2.AoeTargetsHit = targets3.Where(predicate2).ToList <PredictionOutput9>(); return; } IEnumerable <PredictionOutput9> targets2 = targets; Func <PredictionOutput9, float> comparer; if ((comparer = < > 9__5) == null) { comparer = (< > 9__5 = ((PredictionOutput9 x) => targets[0].TargetPosition.DistanceSquared(x.TargetPosition))); } PredictionOutput9 item = targets2.MaxOrDefault(comparer); targets.Remove(item); output.AoeTargetsHit.Add(output); } return; } case SkillShotType.Cone: targets.Insert(0, output); if (targets.Count > 1) { Dictionary <Polygon.Trapezoid, List <PredictionOutput9> > dictionary2 = new Dictionary <Polygon.Trapezoid, List <PredictionOutput9> >(); if (input.UseBlink) { Vector3 targetPosition3 = output.TargetPosition; List <PredictionOutput9> list3 = targets.Skip(1).ToList <PredictionOutput9>(); using (List <PredictionOutput9> .Enumerator enumerator2 = list3.GetEnumerator()) { while (enumerator2.MoveNext()) { PredictionOutput9 predictionOutput4 = enumerator2.Current; Vector3 targetPosition4 = predictionOutput4.TargetPosition; Vector3 vector4 = (targetPosition3 + targetPosition4) / 2f; Vector3 vector5 = targetPosition3.Extend2D(targetPosition4, -100f); Vector3 end4 = vector5.Extend2D(targetPosition4, input.Range); Polygon.Trapezoid rec = new Polygon.Trapezoid(vector5, end4, input.Radius, input.EndRadius); foreach (PredictionOutput9 predictionOutput5 in list3) { if (!(predictionOutput5.Target == predictionOutput4.Target)) { Vector3 to3 = (vector4 + predictionOutput5.TargetPosition) / 2f; Vector3 vector6 = targetPosition3.Extend2D(to3, -100f); Vector3 end5 = vector6.Extend2D(to3, input.Range); Polygon.Trapezoid trapezoid = new Polygon.Trapezoid(vector6, end5, input.Radius + 50f, input.EndRadius + 50f); if (trapezoid.IsInside(targetPosition4) && trapezoid.IsInside(predictionOutput5.TargetPosition)) { rec = trapezoid; } } } dictionary2[rec] = (from x in targets where rec.IsInside(x.TargetPosition) select x).ToList <PredictionOutput9>(); } goto IL_751; } } Vector3 position2 = input.Caster.Position; foreach (PredictionOutput9 predictionOutput6 in targets) { Vector3 end6 = position2.Extend2D(predictionOutput6.TargetPosition, input.Range); Polygon.Trapezoid rec = new Polygon.Trapezoid(position2, end6, input.Radius * 1.4f, input.EndRadius * 1.8f); if (!rec.IsOutside(output.TargetPosition.To2D())) { dictionary2[rec] = (from x in targets where rec.IsInside(x.TargetPosition) select x).ToList <PredictionOutput9>(); } } IL_751: KeyValuePair <Polygon.Trapezoid, List <PredictionOutput9> > keyValuePair2 = dictionary2.MaxOrDefault((KeyValuePair <Polygon.Trapezoid, List <PredictionOutput9> > x) => x.Value.Count); if (keyValuePair2.Key != null) { List <PredictionOutput9> list4 = keyValuePair2.Value.ToList <PredictionOutput9>(); Vector3 to4 = list4.Aggregate(default(Vector3), (Vector3 sum, PredictionOutput9 pos) => sum + pos.TargetPosition) / (float)list4.Count; if (list4.Count == 0) { output.HitChance = HitChance.Impossible; return; } float val2 = list4.Max(delegate(PredictionOutput9 x) { if (!input.UseBlink) { return(input.Caster.Distance(x.TargetPosition)); } return(output.TargetPosition.Distance(x.TargetPosition)); }); float distance2 = Math.Min(input.UseBlink ? input.Range : input.CastRange, val2); output.CastPosition = (input.UseBlink ? output.TargetPosition.Extend2D(to4, distance2) : input.Caster.Position.Extend2D(to4, distance2)); output.AoeTargetsHit = keyValuePair2.Value; } } else { output.AoeTargetsHit.Add(output); if (input.UseBlink) { input.AreaOfEffect = false; } } if (input.UseBlink) { output.BlinkLinePosition = ((input.Caster.Distance(output.TargetPosition) > input.CastRange) ? input.Caster.Position.Extend2D(output.TargetPosition, input.CastRange) : output.TargetPosition.Extend2D(output.CastPosition, -100f)); if (input.Caster.Distance(output.BlinkLinePosition) > input.CastRange) { output.HitChance = HitChance.Impossible; return; } } break; default: return; } }