/// <summary> /// Stasis calculations /// </summary> /// <param name="spell">The spell.</param> internal void Process(Spell spell) { float arrivalT = Prediction.GetArrivalTime(spell.From.Distance(this.Unit.ServerPosition), spell.Delay, spell.Speed) * 1000f; if (Utils.TickCount - this.StartTick >= this.Duration - arrivalT) { var pred = new Prediction.Result(); pred.Input = new Prediction.Input(this.Unit, spell.Delay, spell.Speed, spell.Width, spell.Range, spell.Collision, spell.Type, spell.From, spell.RangeCheckFrom); pred.Unit = this.Unit; pred.CastPosition = this.Unit.ServerPosition.To2D(); pred.UnitPosition = pred.CastPosition; pred.HitChance = HitChance.VeryHigh; pred.Lock(false); var result = new Result(); result.Spell = spell; result.Prediction = pred; if (OnGuaranteedHit != null && pred.HitChance != HitChance.Collision && pred.HitChance != HitChance.OutOfRange) { OnGuaranteedHit(MethodBase.GetCurrentMethod().DeclaringType, result); } this.Processed = true; } }
/// <summary> /// Gets Prediction result /// </summary> /// <param name="target">Target</param> /// <returns>Prediction result as <see cref="Prediction.Result"/></returns> public static Prediction.Result GetSPrediction(this Spell s, AIHeroClient target) { #region if common prediction selected if (ConfigMenu.SelectedPrediction.Index == 1) { var pred = s.GetPrediction(target); var result = new Prediction.Result(new Prediction.Input(target, s), target, pred.CastPosition.ToVector2(), pred.UnitPosition.ToVector2(), pred.Hitchance, default(Collision.Result)); result.Lock(false); return(result); } #endregion switch (s.Type) { case SkillshotType.Line: return(LinePrediction.GetPrediction(target, s.Width, s.Delay, s.Speed, s.Range, s.Collision, target.GetWaypoints(), target.AvgMovChangeTime(), target.LastMovChangeTime(), target.AvgPathLenght(), target.LastAngleDiff(), s.From.ToVector2(), s.RangeCheckFrom.ToVector2())); case SkillshotType.Circle: return(CirclePrediction.GetPrediction(target, s.Width, s.Delay, s.Speed, s.Range, s.Collision, target.GetWaypoints(), target.AvgMovChangeTime(), target.LastMovChangeTime(), target.AvgPathLenght(), target.LastAngleDiff(), s.From.ToVector2(), s.RangeCheckFrom.ToVector2())); case SkillshotType.Cone: return(ConePrediction.GetPrediction(target, s.Width, s.Delay, s.Speed, s.Range, s.Collision, target.GetWaypoints(), target.AvgMovChangeTime(), target.LastMovChangeTime(), target.AvgPathLenght(), target.LastAngleDiff(), s.From.ToVector2(), s.RangeCheckFrom.ToVector2())); } throw new NotSupportedException("Unknown skill shot type"); }
/// <summary> /// Stasis calculations /// </summary> /// <param name="spell">The spell.</param> internal void Process(Spell spell) { var arrivalT = Prediction.GetArrivalTime(spell.From.LSDistance(Unit.ServerPosition), spell.Delay, spell.Speed) * 1000f; if (Utils.TickCount - StartTick >= Duration - arrivalT) { var pred = new Prediction.Result { Input = new Prediction.Input(Unit, spell.Delay, spell.Speed, spell.Width, spell.Range, spell.Collision, spell.Type, spell.From, spell.RangeCheckFrom), Unit = Unit, CastPosition = Unit.ServerPosition.LSTo2D() }; pred.UnitPosition = pred.CastPosition; pred.HitChance = EloBuddy.SDK.Enumerations.HitChance.High; pred.Lock(false); var result = new Result { Spell = spell, Prediction = pred }; if (OnGuaranteedHit != null && pred.HitChance != EloBuddy.SDK.Enumerations.HitChance.Collision && pred.HitChance != EloBuddy.SDK.Enumerations.HitChance.Unknown) { OnGuaranteedHit(MethodBase.GetCurrentMethod().DeclaringType, result); } Processed = true; } }
/// <summary> /// Gets Prediction result /// </summary> /// <param name="target">Target</param> /// <returns>Prediction result as <see cref="Prediction.Result" /></returns> public static Prediction.Result GetSPrediction(this Spell s, AIHeroClient target) { var pred = s.GetPrediction(target); var result = new Prediction.Result(new Prediction.Input(target, s), target, pred.CastPosition.To2D(), pred.UnitPosition.To2D(), pred.Hitchance, default(Collision.Result)); result.Lock(false); return(result); }
/// <summary> /// Stasis calculations /// </summary> /// <param name="spell">The spell.</param> internal void Process(Spell spell) { var arrivalT = Prediction.GetArrivalTime(spell.From.LSDistance(Unit.ServerPosition), spell.Delay, spell.Speed)*1000f; if (Utils.TickCount - StartTick >= Duration - arrivalT) { var pred = new Prediction.Result { Input = new Prediction.Input(Unit, spell.Delay, spell.Speed, spell.Width, spell.Range, spell.Collision, spell.Type, spell.From, spell.RangeCheckFrom), Unit = Unit, CastPosition = Unit.ServerPosition.LSTo2D() }; pred.UnitPosition = pred.CastPosition; pred.HitChance = HitChance.VeryHigh; pred.Lock(false); var result = new Result { Spell = spell, Prediction = pred }; if (OnGuaranteedHit != null && pred.HitChance != HitChance.Collision && pred.HitChance != HitChance.OutOfRange) OnGuaranteedHit(MethodBase.GetCurrentMethod().DeclaringType, result); Processed = true; } }
/// <summary> /// Gets prediction result /// </summary> /// <param name="target">Target</param> /// <param name="width">Vector width</param> /// <param name="delay">Spell delay</param> /// <param name="vectorSpeed">Vector speed</param> /// <param name="range">Spell range</param> /// <param name="vectorLenght">Vector lenght</param> /// <param name="path">Waypoints of target</param> /// <param name="avgt">Average reaction time (in ms)</param> /// <param name="movt">Passed time from last movement change (in ms)</param> /// <param name="avgp">Average Path Lenght</param> /// <param name="rangeCheckFrom"></param> /// <returns>Prediction result as <see cref="Prediction.Vector.Result"/></returns> public static Result GetPrediction(Obj_AI_Base target, float width, float delay, float vectorSpeed, float range, float vectorLenght, List <Vector2> path, float avgt, float movt, float avgp, Vector2 rangeCheckFrom) { Prediction.AssertInitializationMode(); Result result = new Result(); //auto aoe hit (2 hits with using one target as from position) if (target.IsChampion()) //do these calcs if champion kappa { if (ObjectManager.Player.CountEnemiesInRange(range) > 0 && ObjectManager.Player.CountEnemiesInRange(range + vectorLenght) > 1) //if there is at least 1 enemy in range && at least 2 enemy which laser can hit { Vector2 predPos1 = Prediction.GetFastUnitPosition(target, delay); //get target unit position after delay foreach (var enemy in HeroManager.Enemies) //loop all enemies { if (enemy.NetworkId != target.NetworkId && enemy.Distance(rangeCheckFrom) < range + vectorLenght) //if enemy is not given target and enemy is hitable by laser { Vector2 predPos2 = Prediction.GetFastUnitPosition(enemy, delay); //get enemy unit position after delay if (predPos1.Distance(rangeCheckFrom) < range) //if target is in range { Prediction.Result predRes = LinePrediction.GetPrediction(enemy, width, delay, vectorSpeed, vectorLenght, false, enemy.GetWaypoints(), enemy.AvgMovChangeTime(), enemy.LastMovChangeTime(), enemy.AvgPathLenght(), 360, predPos1 - (predPos1 - rangeCheckFrom).Normalized().Perpendicular() * 30, predPos1 - (predPos1 - rangeCheckFrom).Normalized().Perpendicular() * 30); //get enemy prediciton with from = target's position (a bit backward) if (predRes.HitChance >= HitChance.Low) { return(predRes.AsVectorResult(predPos1 - (predPos1 - rangeCheckFrom).Normalized().Perpendicular() * 30)); } } else if (predPos2.Distance(rangeCheckFrom) < range) //if enemy is in range { Prediction.Result predRes = LinePrediction.GetPrediction(target, width, delay, vectorSpeed, vectorLenght, false, path, avgt, movt, avgp, 360, predPos2 - (predPos2 - rangeCheckFrom).Normalized().Perpendicular() * 30, predPos2 - (predPos2 - rangeCheckFrom).Normalized().Perpendicular() * 30); //get target prediction with from = enemy's position (a bit backward) if (predRes.HitChance >= HitChance.Low) { return(predRes.AsVectorResult(predPos2 - (predPos2 - rangeCheckFrom).Normalized().Perpendicular() * 30)); } } } } } } Vector2 immobileFrom = rangeCheckFrom + (target.ServerPosition.To2D() - rangeCheckFrom).Normalized() * range; if (path.Count <= 1) //if target is not moving, easy to hit { result.HitChance = HitChance.VeryHigh; result.CastSourcePosition = immobileFrom; result.CastTargetPosition = target.ServerPosition.To2D(); result.UnitPosition = result.CastTargetPosition; result.CollisionResult = Collision.GetCollisions(immobileFrom, result.CastTargetPosition, range, width, delay, vectorSpeed); if (immobileFrom.Distance(result.CastTargetPosition) > vectorLenght - Prediction.GetArrivalTime(immobileFrom.Distance(result.CastTargetPosition), delay, vectorSpeed) * target.MoveSpeed) { result.HitChance = HitChance.OutOfRange; } return(result); } if (target is AIHeroClient) { if (((AIHeroClient)target).IsChannelingImportantSpell()) { result.HitChance = HitChance.VeryHigh; result.CastSourcePosition = immobileFrom; result.CastTargetPosition = target.ServerPosition.To2D(); result.UnitPosition = result.CastTargetPosition; result.CollisionResult = Collision.GetCollisions(immobileFrom, result.CastTargetPosition, range, width, delay, vectorSpeed); //check if target can dodge with moving backward if (immobileFrom.Distance(result.CastTargetPosition) > range - Prediction.GetArrivalTime(immobileFrom.Distance(result.CastTargetPosition), delay, vectorSpeed) * target.MoveSpeed) { result.HitChance = HitChance.OutOfRange; } return(result); } //to do: find a fuking logic if (avgp < 400 && movt < 100) { result.HitChance = HitChance.High; result.CastTargetPosition = target.ServerPosition.To2D(); result.CastSourcePosition = immobileFrom; result.UnitPosition = result.CastTargetPosition; result.CollisionResult = Collision.GetCollisions(immobileFrom, result.CastTargetPosition, range, width, delay, vectorSpeed); //check if target can dodge with moving backward if (immobileFrom.Distance(result.CastTargetPosition) > range - Prediction.GetArrivalTime(immobileFrom.Distance(result.CastTargetPosition), delay, vectorSpeed) * target.MoveSpeed) { result.HitChance = HitChance.OutOfRange; } return(result); } } if (target.IsDashing()) { return(Prediction.GetDashingPrediction(target, width, delay, vectorSpeed, range, false, SkillshotType.SkillshotLine, immobileFrom, rangeCheckFrom).AsVectorResult(immobileFrom)); } if (SPrediction.Utility.IsImmobileTarget(target)) { return(Prediction.GetImmobilePrediction(target, width, delay, vectorSpeed, range, false, SkillshotType.SkillshotLine, immobileFrom, rangeCheckFrom).AsVectorResult(immobileFrom)); } for (int i = 0; i < path.Count - 1; i++) { Vector2 point = Vector2.Zero; if (path[i].Distance(ObjectManager.Player.ServerPosition) < range) { point = path[i]; } else { point = Geometry.ClosestCirclePoint(rangeCheckFrom, range, path[i]); } Prediction.Result res = Prediction.WaypointAnlysis(target, width, delay, vectorSpeed, vectorLenght, false, SkillshotType.SkillshotLine, path, avgt, movt, avgp, 360, point); res.Lock(); if (res.HitChance >= HitChance.Low) { return(res.AsVectorResult(point)); } } result.CastSourcePosition = immobileFrom; result.CastTargetPosition = target.ServerPosition.To2D(); result.HitChance = HitChance.Impossible; return(result); }
/// <summary> /// Gets Prediction result /// </summary> /// <param name="target">Target</param> /// <returns>Prediction result as <see cref="Prediction.Result" /></returns> public static Prediction.Result GetSPrediction(this Spell s, AIHeroClient target) { #region if common prediction selected if (ConfigMenu.SelectedPrediction == 1) { var pred = s.GetPrediction(target); var result = new Prediction.Result(new Prediction.Input(target, s), target, pred.CastPosition.LSTo2D(), pred.UnitPosition.LSTo2D(), pred.Hitchance, default(Collision.Result)); result.Lock(false); return result; } #endregion switch (s.Type) { case SkillshotType.SkillshotLine: return LinePrediction.GetPrediction(target, s.Width, s.Delay, s.Speed, s.Range, s.Collision, target.GetWaypoints(), target.AvgMovChangeTime(), target.LastMovChangeTime(), target.AvgPathLenght(), target.LastAngleDiff(), s.From.LSTo2D(), s.RangeCheckFrom.LSTo2D()); case SkillshotType.SkillshotCircle: return CirclePrediction.GetPrediction(target, s.Width, s.Delay, s.Speed, s.Range, s.Collision, target.GetWaypoints(), target.AvgMovChangeTime(), target.LastMovChangeTime(), target.AvgPathLenght(), target.LastAngleDiff(), s.From.LSTo2D(), s.RangeCheckFrom.LSTo2D()); case SkillshotType.SkillshotCone: return ConePrediction.GetPrediction(target, s.Width, s.Delay, s.Speed, s.Range, s.Collision, target.GetWaypoints(), target.AvgMovChangeTime(), target.LastMovChangeTime(), target.AvgPathLenght(), target.LastAngleDiff(), s.From.LSTo2D(), s.RangeCheckFrom.LSTo2D()); } throw new NotSupportedException("Unknown skill shot type"); }
/// <summary> /// Stasis calculations /// </summary> /// <param name="spell">The spell.</param> internal void Process(Spell spell) { float arrivalT = Prediction.GetArrivalTime(spell.From.Distance(this.Unit.ServerPosition), spell.Delay, spell.Speed) * 1000f; if (Utils.TickCount - this.StartTick >= this.Duration - arrivalT) { var pred = new Prediction.Result(); pred.Input = new Prediction.Input(this.Unit, spell.Delay, spell.Speed, spell.Width, spell.Range, spell.Collision, spell.Type, spell.From, spell.RangeCheckFrom); pred.Unit = this.Unit; pred.CastPosition = this.Unit.ServerPosition.To2D(); pred.UnitPosition = pred.CastPosition; pred.HitChance = HitChance.VeryHigh; pred.Lock(false); var result = new Result(); result.Spell = spell; result.Prediction = pred; if (OnGuaranteedHit != null) OnGuaranteedHit(MethodBase.GetCurrentMethod().DeclaringType, result); this.Processed = true; } }