private void CastW()
        {
            if (!W.IsReady())
            {
                return;
            }

            var target = TargetSelector.GetAATarget();

            if (target != null)
            {
                W.Cast();
            }

            if (Orbwalker.CurrentMode != Orbwalker.Mode.LaneClear)
            {
                return;
            }
            var allMinion = MinionManager.GetMinions(PUC.Player.Position,
                                                     Orbwalker.GetAutoAttackRangeto(), MinionTypes.All, MinionTeam.NotAlly);

            if (!allMinion.Any(minion => minion.IsValidTarget(Orbwalker.GetAutoAttackRangeto(minion))))
            {
                return;
            }
            W.Cast();
        }
Beispiel #2
0
        public static Obj_AI_Base GetPossibleTarget()
        {
            Obj_AI_Base tempTarget = null;

            if (PUC.Menu.Item("orb_Priority").GetValue <StringList>().SelectedIndex == 1 &&
                (CurrentMode == Mode.Harass || CurrentMode == Mode.LaneClear))
            {
                tempTarget = TargetSelector.GetAATarget();
                if (tempTarget != null)
                {
                    return(tempTarget);
                }
            }

            if (CurrentMode == Mode.Harass || CurrentMode == Mode.Lasthit || CurrentMode == Mode.LaneClear)
            {
                foreach (var minion in from minion in ObjectManager.Get <Obj_AI_Minion>().Where(minion => minion.IsValidTarget(GetAutoAttackRangeto(minion)) && minion.Health > 0)
                         let time = (int)(Player.AttackCastDelay * 1000) + Game.Ping / 2 - 100 +
                                    (int)(1000 * Player.Distance(minion) / (Player.ChampionName == "Thresh" ? Player.BasicAttack.MissileSpeed :(Player.IsMelee() ? float.MaxValue : Player.BasicAttack.MissileSpeed)))
                                    let predHealth = HealthPrediction.GetHealthPrediction(minion, time, GetFarmDelay)
                                                     where minion.Team != GameObjectTeam.Neutral &&
                                                     predHealth > 0 &&
                                                     predHealth <= Player.GetAutoAttackDamage(minion, true)
                                                     select minion)
                {
                    return(minion);
                }
            }

            if (CurrentMode == Mode.Harass || CurrentMode == Mode.LaneClear)
            {
                foreach (var turret in ObjectManager.Get <Obj_AI_Turret>().Where(turret => turret.IsValidTarget(GetAutoAttackRangeto(turret))))
                {
                    return(turret);
                }
            }

            if (CurrentMode != Mode.Lasthit)
            {
                tempTarget = TargetSelector.GetAATarget();
                if (tempTarget != null)
                {
                    return(tempTarget);
                }
            }

            float[] maxhealth;
            if (CurrentMode == Mode.LaneClear || CurrentMode == Mode.Harass)
            {
                maxhealth = new float[] { 0 };
                var maxhealth1 = maxhealth;
                foreach (var minion in ObjectManager.Get <Obj_AI_Minion>().Where(minion => minion.IsValidTarget(GetAutoAttackRangeto(minion)) && minion.Team == GameObjectTeam.Neutral).Where(minion => minion.MaxHealth >= maxhealth1[0] || Math.Abs(maxhealth1[0] - float.MaxValue) < float.Epsilon))
                {
                    tempTarget   = minion;
                    maxhealth[0] = minion.MaxHealth;
                }
                if (tempTarget != null)
                {
                    return(tempTarget);
                }
            }

            if (CurrentMode != Mode.LaneClear || ShouldWait())
            {
                return(null);
            }
            maxhealth = new float[] { 0 };
            foreach (var minion in from minion in ObjectManager.Get <Obj_AI_Minion>()
                     .Where(minion => minion.IsValidTarget(GetAutoAttackRangeto(minion))) let predHealth = HealthPrediction.LaneClearHealthPrediction(
                         minion, (int)((Player.AttackDelay * 1000) * LaneClearWaitTimeMod), GetFarmDelay) where predHealth >=
                                                                                                           2 *
                                                                                                           Player.GetAutoAttackDamage(minion, true) ||
                                                                                                           Math.Abs(predHealth - minion.Health) < float.Epsilon where minion.Health >= maxhealth[0] || Math.Abs(maxhealth[0] - float.MaxValue) < float.Epsilon select minion)
            {
                tempTarget   = minion;
                maxhealth[0] = minion.MaxHealth;
            }
            return(tempTarget);
        }
Beispiel #3
0
            private static void CheckUseage(Database.ActiveItem item)
            {
                if (!item.IsReady() || !item.IsEnabled())
                {
                    return;
                }
                switch (item.TypeItem)
                {
                case Database.ActiveItem.ItemType.Buff:
                    break;

                case Database.ActiveItem.ItemType.OnHit:
                    // Inside SpellBlock
                    break;

                case Database.ActiveItem.ItemType.Cleanse:

                    // Dervish Blade, Mercurial Scimitar, Quicksilver Sash
                    if (item.Id == 3137 || item.Id == 3139 || item.Id == 3140)
                    {
                        if (BuffnamesCC.Any(bufftype => PUC.Player.HasBuffOfType(bufftype) && PUC.Menu.Item("act_debuff_" + bufftype).GetValue <bool>() && CleanseIsDown()))
                        {
                            item.CastItem();
                        }
                    }
                    if (item.Id == 3137 || item.Id == 3140)
                    {
                        if (BuffnamesExtendet.Any(bufftype => PUC.Player.HasBuffOfType(bufftype) && PUC.Menu.Item("act_debuff_" + bufftype).GetValue <bool>() && CleanseIsDown()))
                        {
                            item.CastItem();
                        }
                    }
                    // Mikael's Crucible
                    if (item.Id == 3222)
                    {
                        var friend = PUC.AllHerosFriend.FirstOrDefault(hero => !hero.IsDead && hero.Distance(PUC.Player) < 750 && (BuffnamesCC.Any(hero.HasBuffOfType)));
                        if (friend == null)
                        {
                            return;
                        }
                        item.CastItem(friend);
                    }
                    break;

                case Database.ActiveItem.ItemType.Offensive:
                    // Muramana
                    if (item.Id == 3042 || item.Id == 3043)
                    {
                        var muramanaActive = false;
                        var muramanaNeeded = false;
                        if (PUC.Player.Buffs.Any(buff => PUC.Player.HasBuff(item.Name)))
                        {
                            muramanaActive = true;
                        }
                        if (Orbwalker.CurrentMode == Orbwalker.Mode.Combo &&
                            PUC.Menu.Item("act_item_" + item.Id + "_useCombo").GetValue <bool>() ||
                            Orbwalker.CurrentMode == Orbwalker.Mode.Harass &&
                            PUC.Menu.Item("act_item_" + item.Id + "_useHarass").GetValue <bool>())
                        {
                            if (Utility.CountEnemysInRange((int)PUC.Player.AttackRange + 100) >= 1)
                            {
                                muramanaNeeded = true;
                            }
                        }
                        if ((muramanaNeeded && !muramanaActive) || (!muramanaNeeded && muramanaActive))
                        {
                            item.CastItem();
                        }
                    }
                    // Youmuu's Ghostblade
                    if (item.Id == 3142)
                    {
                        if (Orbwalker.CurrentMode == Orbwalker.Mode.Combo &&
                            PUC.Menu.Item("act_item_" + item.Id + "_useCombo").GetValue <bool>() ||
                            Orbwalker.CurrentMode == Orbwalker.Mode.Harass &&
                            PUC.Menu.Item("act_item_" + item.Id + "_useHarass").GetValue <bool>())
                        {
                            if (TargetSelector.GetAATarget() != null)
                            {
                                item.CastItem();
                            }
                        }
                    }
                    // List below
                    if (item.Id == 3077 || item.Id == 3074 || item.Id == 3146 || item.Id == 3144 || item.Id == 3153 || item.Id == 3128)
                    {
                        var range   = 0;
                        var onenemy = true;
                        switch (item.Id)
                        {
                        case 3074:
                        case 3077:
                            range   = 400;
                            onenemy = false;
                            break;

                        case 3146:
                            range = 700;
                            break;

                        case 3153:
                        case 3144:
                            range = 450;
                            break;

                        case 3128:
                            range = 750;
                            break;
                        }

                        if (Orbwalker.CurrentMode == Orbwalker.Mode.Combo &&
                            PUC.Menu.Item("act_item_" + item.Id + "_useCombo").GetValue <bool>() ||
                            Orbwalker.CurrentMode == Orbwalker.Mode.Harass &&
                            PUC.Menu.Item("act_item_" + item.Id + "_useHarass").GetValue <bool>())
                        {
                            if (TargetSelector.GetTarget(range) != null)
                            {
                                if (onenemy)
                                {
                                    item.CastItem(TargetSelector.GetTarget(range));
                                }
                                else
                                {
                                    item.CastItem();
                                }
                            }
                        }
                    }
                    break;
                }
            }