Ejemplo n.º 1
0
        private BestPositionResult GetBestHitE(List <Obj_AI_Base> objAiBases)
        {
            var bestResult = new BestPositionResult();

            if (E.IsReady)
            {
                foreach (
                    var ally in
                    UnitManager.ValidAllyHeroes.Where(
                        h => E.InRange(h) && h.GetDistanceSqr(Ball) > 0))
                {
                    var pred = E.GetPrediction(ally);
                    if (pred.HitChancePercent >= E.HitChancePercent / 3)
                    {
                        var res   = E.ObjectsInLine(objAiBases, ally);
                        var count = res.Count + 1;
                        if (bestResult.Hits < count)
                        {
                            bestResult.Hits     = res.Count + 1;
                            bestResult.Position = pred.CastPosition;
                            bestResult.Target   = ally;
                            if (bestResult.Hits == objAiBases.Count)
                            {
                                break;
                            }
                        }
                    }
                }
            }
            return(bestResult);
        }
Ejemplo n.º 2
0
        private BestPositionResult GetBestHitQ(IReadOnlyCollection <Obj_AI_Base> list, Obj_AI_Base target = null)
        {
            var bestResult = new BestPositionResult();

            if (Q.IsReady)
            {
                var checkTarget = target != null;
                foreach (var obj in list)
                {
                    var pred = Q.GetPrediction(obj, new CustomSettings {
                        Width = QAoeWidth
                    });
                    if (pred.HitChancePercent >= Q.HitChancePercent)
                    {
                        var res = Q.ObjectsInLine(list.Where(o => !o.IdEquals(obj)).ToList(), obj);
                        if (!checkTarget || res.Contains(target) || obj.IdEquals(target))
                        {
                            var count = res.Count + 1;
                            if (bestResult.Hits < count)
                            {
                                bestResult.Hits     = count;
                                bestResult.Position = pred.CastPosition;
                                bestResult.Target   = obj;
                                if (bestResult.Hits == list.Count)
                                {
                                    break;
                                }
                            }
                        }
                    }
                }
            }
            return(bestResult);
        }