private void QLogic()
        {
            try
            {
                var target = TargetSelector.GetTarget(Q.Range);
                if (target != null)
                {
                    Q.CastOnUnit(target);
                }
                else if (Menu.Item(Menu.Name + ".miscellaneous.extended-q").GetValue<bool>())
                {
                    target = TargetSelector.GetTarget(Q1);
                    if (target != null)
                    {
                        var heroPositions = (from t in GameObjects.EnemyHeroes
                            where t.IsValidTarget(Q1.Range)
                            let prediction = Q.GetPrediction(t)
                            select new CPrediction.Position(t, prediction.UnitPosition)).Where(
                                t => t.UnitPosition.Distance(Player.Position) < Q1.Range).ToList();
                        if (heroPositions.Any())
                        {
                            var minions = MinionManager.GetMinions(
                                Q1.Range, MinionTypes.All, MinionTeam.NotAlly, MinionOrderTypes.None);

                            if (minions.Any(m => m.IsMoving) && !heroPositions.Any(h => HasPassiveDebuff(h.Hero)))
                            {
                                return;
                            }

                            var outerMinions = minions.Where(m => m.Distance(Player) > Q.Range).ToList();
                            var innerPositions = minions.Where(m => m.Distance(Player) < Q.Range).ToList();
                            foreach (var minion in innerPositions)
                            {
                                var lMinion = minion;
                                var coneBuff = new Geometry.Polygon.Sector(
                                    minion.Position,
                                    Player.Position.Extend(minion.Position, Player.Distance(minion) + Q.Range * 0.5f),
                                    (float) (40 * Math.PI / 180), Q1.Range - Q.Range);
                                var coneNormal = new Geometry.Polygon.Sector(
                                    minion.Position,
                                    Player.Position.Extend(minion.Position, Player.Distance(minion) + Q.Range * 0.5f),
                                    (float) (60 * Math.PI / 180), Q1.Range - Q.Range);
                                foreach (var enemy in
                                    heroPositions.Where(
                                        m => m.UnitPosition.Distance(lMinion.Position) < Q1.Range - Q.Range))
                                {
                                    if (coneBuff.IsInside(enemy.Hero) && HasPassiveDebuff(enemy.Hero))
                                    {
                                        Q.CastOnUnit(minion);
                                        return;
                                    }
                                    if (coneNormal.IsInside(enemy.UnitPosition))
                                    {
                                        var insideCone =
                                            outerMinions.Where(m => coneNormal.IsInside(m.Position)).ToList();
                                        if (!insideCone.Any() ||
                                            enemy.UnitPosition.Distance(minion.Position) <
                                            insideCone.Select(
                                                m => m.Position.Distance(minion.Position) - m.BoundingRadius)
                                                .DefaultIfEmpty(float.MaxValue)
                                                .Min())
                                        {
                                            Q.CastOnUnit(minion);
                                            return;
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Global.Logger.AddItem(new LogItem(ex));
            }
        }
Example #2
0
        private bool Q2Logic()
        {
            /*
            --Not Trusted-- http://leagueoflegends.wikia.com/wiki/Miss_Fortune
            The second shot follows a priority order on targets within 500 units of the primary target:
            Enemy champions in a 40° cone marked by Love Tap.
            Minions and neutral monsters within a 40° cone.
            Enemy champions within a 40° cone.
            Enemy or neutral units within a 110° cone.
            Enemy or neutral units within a 150-range 160° cone.
            Double Up's range is not listed as spell range, but instead matches her basic attack range.
            Double Up can bounce to units in brush or fog of war if they are in range of the target the spell is initially cast on.
            Double Up must kill the first target for the second hit to deal enhanced damage. If the first target dies before the first hit lands, the second target receives the normal second target bonus damage.
            */
            if (Q.isReadyPerfectly())
            {
                float Q2Range = Q.Range + 450;
                var LongRangeTarget = TargetSelector.GetTarget(Q2Range, Q.DamageType);

                if (LongRangeTarget != null)
                {
                    Obj_AI_Base BestTarget = null;

                    List<Obj_AI_Base> Targets = new List<Obj_AI_Base>();
                    Targets.AddRange(MinionManager.GetMinions(Q.Range, MinionTypes.All, MinionTeam.NotAlly).Where(x => x.IsValidTarget()));
                    Targets.AddRange(HeroManager.Enemies.Where(x => x.IsValidTarget(Q.Range)));
                    Targets.OrderBy(x => x.Health);

                    foreach (var Target in MenuProvider.Champion.Misc.getBoolValue("Harass Q2 Only if Kills Unit") ? Targets.Where(x => x.isKillableAndValidTarget(Q.GetDamage(x), Q.DamageType, Q.Range)) : Targets)
                    {
                        var Direction = Target.ServerPosition.Extend(ObjectManager.Player.ServerPosition, -500);
                        var Radian = (float)Math.PI / 180f;
                        var TargetServerPosition = Target.ServerPosition;
                        var Time = (ObjectManager.Player.ServerPosition.Distance(Target.ServerPosition) / Q.Speed) + Q.Delay;
                        var Predic = Prediction.GetPrediction(LongRangeTarget, Time);

                        var Cone40 = new Geometry.Polygon.Sector(TargetServerPosition, Direction, 40f * Radian, 450f);

                        if (Cone40.IsInside(LongRangeTarget.ServerPosition))
                        {
                            if (Cone40.IsInside(Predic.UnitPosition))
                            {
                                if (LongRangeTarget.NetworkId == LoveTapTargetNetworkId)
                                {
                                    BestTarget = Target;
                                    break;
                                }
                                else
                                if (!MinionManager.GetMinions(Q2Range).Where(x => x.IsValidTarget() && x.NetworkId != Target.NetworkId && Cone40.IsInside(x)).Any(x => Target.ServerPosition.Distance(LongRangeTarget.ServerPosition) >= Target.ServerPosition.Distance(x.ServerPosition)))
                                {
                                    BestTarget = Target;
                                    break;
                                }
                            }
                        }
                    }

                    if (BestTarget != null)
                    {
                        return Q.CastOnUnit(BestTarget);
                    }
                    else
                    {
                        return false;
                    }
                }
                else
                {
                    return false;
                }
            }
            else
            {
                return false;
            }
        }