コード例 #1
0
 public Result(Input inp, AIBaseClient unit, Vector2 castpos, Vector2 unitpos, HitChance hc, Collision.Result col)
 {
     Input           = inp;
     Unit            = unit;
     CastPosition    = castpos;
     UnitPosition    = unitpos;
     HitChance       = hc;
     CollisionResult = col;
 }
コード例 #2
0
        /// <summary>
        /// Gets Aoe Prediction result
        /// </summary>
        /// <param name="width">Spell width</param>
        /// <param name="delay">Spell delay</param>
        /// <param name="missileSpeed">Spell missile speed</param>
        /// <param name="range">Spell range</param>
        /// <param name="from">Spell casted position</param>
        /// <param name="rangeCheckFrom"></param>
        /// <returns>Prediction result as <see cref="Prediction.AoeResult"/></returns>
        public static Prediction.AoeResult GetAoePrediction(float width, float delay, float missileSpeed, float range, Vector2 from, Vector2 rangeCheckFrom)
        {
            var result  = new Prediction.AoeResult();
            var enemies = GameObjects.EnemyHeroes.Where(p => p.IsValidTarget() && Prediction.GetFastUnitPosition(p, delay, 0, from).Distance(rangeCheckFrom) < range);

            foreach (var enemy in enemies)
            {
                Prediction.Result prediction = GetPrediction(enemy, width, delay, missileSpeed, range, false, enemy.GetWaypoints(), enemy.AvgMovChangeTime(), enemy.LastMovChangeTime(), enemy.AvgPathLenght(), enemy.LastAngleDiff(), from, rangeCheckFrom);
                if (prediction.HitChance > HitChance.Medium)
                {
                    Vector2          to        = from + (prediction.CastPosition - from).Normalized() * range;
                    Collision.Result colResult = Collision.GetCollisions(from, to, range, width, delay, missileSpeed, false);
                    if (colResult.Objects.HasFlag(Collision.Flags.EnemyChampions))
                    {
                        int collisionCount = colResult.Units.Count(p => p.IsEnemy && p.Type == GameObjectType.AIHeroClient && p.IsValid);
                        if (collisionCount > result.HitCount)
                        {
                            result = prediction.ToAoeResult(collisionCount, colResult);
                        }
                    }
                }
            }
            return(result);
        }
コード例 #3
0
 public AoeResult(Vector2 castpos, Collision.Result col, int hc)
 {
     CastPosition    = castpos;
     CollisionResult = col;
     HitCount        = hc;
 }
コード例 #4
0
 internal void Lock(bool checkDodge = true)
 {
     this.CollisionResult = Collision.GetCollisions(this.Input.From.ToVector2(), this.CastPosition, this.Input.SpellRange, this.Input.SpellWidth, this.Input.SpellDelay, this.Input.SpellMissileSpeed);
     this.CheckCollisions();
     this.CheckOutofRange(checkDodge);
 }
コード例 #5
0
        /// <summary>
        /// Gets Aoe Prediction result
        /// </summary>
        /// <param name="width">Spell 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="rangeCheckFrom"></param>
        /// <returns>Prediction result as <see cref="Prediction.AoeResult"/></returns>
        public static AoeResult GetAoePrediction(float width, float delay, float vectorSpeed, float range, float vectorLenght, Vector2 rangeCheckFrom)
        {
            AoeResult result  = new AoeResult();
            var       enemies = GameObjects.EnemyHeroes.Where(p => p.IsValidTarget() && Prediction.GetFastUnitPosition(p, delay, 0, rangeCheckFrom).Distance(rangeCheckFrom) < range);

            foreach (var enemy in enemies)
            {
                List <Vector2> path = enemy.GetWaypoints();
                if (path.Count <= 1)
                {
                    Vector2          from      = rangeCheckFrom + (enemy.PreviousPosition.ToVector2() - rangeCheckFrom).Normalized() * range;
                    Vector2          to        = from + (enemy.PreviousPosition.ToVector2() - from).Normalized() * vectorLenght;
                    Collision.Result colResult = Collision.GetCollisions(from, to, range, width, delay, vectorSpeed);

                    if (colResult.Objects.HasFlag(Collision.Flags.EnemyChampions))
                    {
                        int collisionCount = colResult.Units.Count(p => p.IsEnemy && p.Type == GameObjectType.AIHeroClient && p.IsValid);
                        if (collisionCount > result.HitCount)
                        {
                            result = new AoeResult
                            {
                                CastSourcePosition = from,
                                CastTargetPosition = enemy.PreviousPosition.ToVector2(),
                                HitCount           = collisionCount,
                                CollisionResult    = colResult
                            };
                        }
                    }
                }
                else
                {
                    if (!enemy.IsDashing())
                    {
                        for (int i = 0; i < path.Count - 1; i++)
                        {
                            Vector2           point      = Geometry.ClosestCirclePoint(rangeCheckFrom, range, path[i]);
                            Prediction.Result prediction = Prediction.GetPrediction(enemy, width, delay, vectorSpeed, vectorLenght, false, SpellType.Line, path, enemy.AvgMovChangeTime(), enemy.LastMovChangeTime(), enemy.AvgPathLenght(), enemy.LastAngleDiff(), point, rangeCheckFrom);
                            if (prediction.HitChance > HitChance.Medium)
                            {
                                Vector2          to        = point + (prediction.CastPosition - point).Normalized() * vectorLenght;
                                Collision.Result colResult = Collision.GetCollisions(point, to, range, width, delay, vectorSpeed, false);
                                if (colResult.Objects.HasFlag(Collision.Flags.EnemyChampions))
                                {
                                    int collisionCount = colResult.Units.Count(p => p.IsEnemy && p.Type == GameObjectType.AIHeroClient && p.IsValid);
                                    if (collisionCount > result.HitCount)
                                    {
                                        result = new AoeResult
                                        {
                                            CastSourcePosition = point,
                                            CastTargetPosition = prediction.CastPosition,
                                            HitCount           = collisionCount,
                                            CollisionResult    = colResult
                                        };
                                    }
                                }
                            }
                        }
                    }
                }
            }
            return(result);
        }
コード例 #6
0
 /// <summary>
 /// Converts <see cref="Prediction.Result"/> to <see cref="Prediction.AoeResult"/> with given hit count and collision result
 /// </summary>
 /// <param name="pResult">Prediction result as <see cref="Prediction.Result"/></param>
 /// <param name="hitCount">Aoe hits</param>
 /// <param name="colResult">Aoe collision result</param>
 /// <returns>Converted prediction result as <see cref="Prediction.AoeResult"/></returns>
 internal static Prediction.AoeResult ToAoeResult(this Prediction.Result pResult, int hitCount, Collision.Result colResult)
 {
     return(new Prediction.AoeResult
     {
         CastPosition = pResult.CastPosition,
         HitCount = hitCount,
         CollisionResult = colResult
     });
 }