Пример #1
0
        private void Combo()
        {
            Obj_AI_Hero target = TargetSelector.GetTarget(
                E.Range, TargetSelector.DamageType.Physical, true, HeroManager.Enemies.Where(h => h.IsInvulnerable));

            if (target == null)
            {
                return;
            }
            var  ignitedmg = (float)player.GetSummonerSpellDamage(target, Damage.SummonerSpell.Ignite);
            bool hasIgnite = player.Spellbook.CanUseSpell(player.GetSpellSlot("SummonerDot")) == SpellState.Ready;

            if (config.Item("useIgnite", true).GetValue <bool>() &&
                ignitedmg > HealthPrediction.GetHealthPrediction(target, 700) && hasIgnite &&
                !CombatHelper.CheckCriticalBuffs(target) && !Q.IsReady() && !justQ)
            {
                player.Spellbook.CastSpell(player.GetSpellSlot("SummonerDot"), target);
            }
            if (config.Item("usew", true).GetValue <Slider>().Value > player.HealthPercent &&
                player.CountEnemiesInRange(500) > 0)
            {
                W.Cast();
            }
            if (R.IsReady() && config.Item("user", true).GetValue <bool>())
            {
                var Rtarget =
                    HeroManager.Enemies.FirstOrDefault(e => e.HealthPercent < 50 && e.CountAlliesInRange(660) > 0);
                if (Rtarget != null)
                {
                    R.CastIfWillHit(Rtarget, config.Item("Rmin", true).GetValue <Slider>().Value);
                }
            }
            if (config.Item("useItems").GetValue <bool>())
            {
                ItemHandler.UseItems(target, config, ComboDamage(target), config.Item("AutoW", true).GetValue <bool>());
            }
            var barrels =
                GetBarrels()
                .Where(
                    o =>
                    o.IsValid && !o.IsDead && o.Distance(player) < 1600 && o.SkinName == "GangplankBarrel" &&
                    o.GetBuff("gangplankebarrellife").Caster.IsMe)
                .ToList();

            if (config.Item("useq", true).GetValue <bool>() && Q.IsReady() && config.Item("usee", true).GetValue <bool>() &&
                E.IsReady() && Orbwalking.CanMove(100) && !justE)
            {
                var Qbarrels = GetBarrels().Where(o => o.Distance(player) < Q.Range && KillableBarrel(o));
                foreach (var Qbarrel in Qbarrels)
                {
                    if (Qbarrel.Distance(target) < BarrelExplosionRange)
                    {
                        continue;
                    }
                    var point =
                        GetBarrelPoints(Qbarrel.Position)
                        .Where(
                            p =>
                            p.IsValid() && !p.IsWall() && p.Distance(player.Position) < E.Range &&
                            p.Distance(Prediction.GetPrediction(target, GetQTime(Qbarrel)).UnitPosition) <
                            BarrelExplosionRange && Qbarrel.Distance(p) < BarrelConnectionRange &&
                            savedBarrels.Count(b => b.barrel.Position.Distance(p) < BarrelExplosionRange) < 1)
                        .OrderBy(p => p.Distance(target.Position))
                        .FirstOrDefault();
                    if (point != null)
                    {
                        E.Cast(point);
                        Utility.DelayAction.Add(1, () => Q.CastOnUnit(Qbarrel));
                        return;
                    }
                }
            }
            var meleeRangeBarrel =
                barrels.FirstOrDefault(
                    b =>
                    (b.Health < 2 || (b.Health == 2 && Q.IsReady())) &&
                    b.Distance(player) < Orbwalking.GetAutoAttackRange(player, b) &&
                    b.CountEnemiesInRange(BarrelExplosionRange) > 0);

            if (meleeRangeBarrel != null && Orbwalking.CanMove(100))
            {
                player.IssueOrder(GameObjectOrder.AutoAttack, meleeRangeBarrel);
            }
            if (Q.IsReady())
            {
                if (barrels.Any())
                {
                    var detoneateTargetBarrels = barrels.Where(b => b.Distance(player) < Q.Range);
                    if (config.Item("detoneateTarget", true).GetValue <bool>())
                    {
                        if (detoneateTargetBarrels.Any())
                        {
                            foreach (var detoneateTargetBarrel in detoneateTargetBarrels)
                            {
                                if (!KillableBarrel(detoneateTargetBarrel))
                                {
                                    continue;
                                }
                                if (
                                    detoneateTargetBarrel.Distance(
                                        Prediction.GetPrediction(target, GetQTime(detoneateTargetBarrel)).UnitPosition) <
                                    BarrelExplosionRange &&
                                    target.Distance(detoneateTargetBarrel.Position) < BarrelExplosionRange)
                                {
                                    Q.CastOnUnit(detoneateTargetBarrel, config.Item("packets").GetValue <bool>());
                                    return;
                                }
                                var detoneateTargetBarrelSeconds =
                                    barrels.Where(b => b.Distance(detoneateTargetBarrel) < BarrelConnectionRange);
                                if (detoneateTargetBarrelSeconds.Any())
                                {
                                    foreach (var detoneateTargetBarrelSecond in detoneateTargetBarrelSeconds)
                                    {
                                        if (
                                            detoneateTargetBarrelSecond.Distance(
                                                Prediction.GetPrediction(
                                                    target, GetQTime(detoneateTargetBarrel) + 0.15f).UnitPosition) <
                                            BarrelExplosionRange &&
                                            target.Distance(detoneateTargetBarrelSecond.Position) < BarrelExplosionRange)
                                        {
                                            Q.CastOnUnit(detoneateTargetBarrel, config.Item("packets").GetValue <bool>());
                                            return;
                                        }
                                    }
                                }
                            }
                        }

                        if (config.Item("detoneateTargets", true).GetValue <Slider>().Value > 1)
                        {
                            var enemies =
                                HeroManager.Enemies.Where(e => e.IsValidTarget() && e.Distance(player) < 600)
                                .Select(e => Prediction.GetPrediction(e, 0.25f));
                            var enemies2 =
                                HeroManager.Enemies.Where(e => e.IsValidTarget() && e.Distance(player) < 600)
                                .Select(e => Prediction.GetPrediction(e, 0.35f));
                            if (detoneateTargetBarrels.Any())
                            {
                                foreach (var detoneateTargetBarrel in detoneateTargetBarrels)
                                {
                                    if (!KillableBarrel(detoneateTargetBarrel))
                                    {
                                        continue;
                                    }
                                    var enemyCount =
                                        enemies.Count(
                                            e =>
                                            e.UnitPosition.Distance(detoneateTargetBarrel.Position) <
                                            BarrelExplosionRange);
                                    if (enemyCount >= config.Item("detoneateTargets", true).GetValue <Slider>().Value&&
                                        detoneateTargetBarrel.CountEnemiesInRange(BarrelExplosionRange) >=
                                        config.Item("detoneateTargets", true).GetValue <Slider>().Value)
                                    {
                                        Q.CastOnUnit(detoneateTargetBarrel, config.Item("packets").GetValue <bool>());
                                        return;
                                    }
                                    var detoneateTargetBarrelSeconds =
                                        barrels.Where(b => b.Distance(detoneateTargetBarrel) < BarrelConnectionRange);
                                    if (detoneateTargetBarrelSeconds.Any())
                                    {
                                        foreach (var detoneateTargetBarrelSecond in detoneateTargetBarrelSeconds)
                                        {
                                            if (enemyCount +
                                                enemies2.Count(
                                                    e =>
                                                    e.UnitPosition.Distance(detoneateTargetBarrelSecond.Position) <
                                                    BarrelExplosionRange) >=
                                                config.Item("detoneateTargets", true).GetValue <Slider>().Value&&
                                                detoneateTargetBarrelSecond.CountEnemiesInRange(BarrelExplosionRange) >=
                                                config.Item("detoneateTargets", true).GetValue <Slider>().Value)
                                            {
                                                Q.CastOnUnit(
                                                    detoneateTargetBarrel, config.Item("packets").GetValue <bool>());
                                                return;
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                if (config.Item("useq", true).GetValue <bool>() && Q.CanCast(target) && Orbwalking.CanMove(100) && !justE)
                {
                    CastQonHero(target, barrels);
                }
            }
        }