Esempio n. 1
0
        /// <summary>
        ///     Combo Function
        /// </summary>
        // ReSharper disable once FunctionComplexityOverflow
        private void Combo()
        {
            var packets = menu.GetValue <bool>(YasuoMenu.MiscPacketsName);                     // => Packets
            var target  = TargetSelector.GetTarget(1200f, TargetSelector.DamageType.Physical); // => Target

            var useE = menu.GetValue <bool>(YasuoMenu.ComboEName);                             // => Use E

            // => E Function
            if (useE && YasuoSpells.E.IsReady())
            {
                var eMode = menu.GetValue <StringList>(YasuoMenu.ComboGapcloserModeName).SelectedIndex;
                // => Gapcloser Mode
                var efMode = menu.GetValue <bool>(YasuoMenu.ComboGapcloserFModeName); // => Gapcloser Follow Mode

                // => Mouse mode
                if (eMode == 0)
                {
                    var dashData = player.GetDashData(Game.CursorPos);
                    if (dashData != null && dashData.Value.ObjAiBase.IsValidTarget())
                    {
                        if (Environment.TickCount - _sweepingBladeDelay > 300)
                        {
                            if (dashData.Value.Vector3.Distance(Game.CursorPos) <
                                Yasuo.Player.Distance(Game.CursorPos) - 100 &&
                                dashData.Value.Vector3.Distance(Game.CursorPos) <
                                Yasuo.Menu.GetValue <Slider>(YasuoMenu.ComboERangeName).Value)
                            {
                                YasuoSpells.E.Cast(dashData.Value.ObjAiBase, packets);
                                DashingEnd          = player.GetDashingEnd(dashData.Value.ObjAiBase);
                                _sweepingBladeDelay = LastSweepingBladeTick = Environment.TickCount;
                            }
                        }
                    }
                }
                else
                {
                    // => Target mode
                    if (!target.IsValidTarget())
                    {
                        return;
                    }


                    if (player.Distance(target.ServerPosition) < player.GetAutoAttackRange() && efMode ||
                        player.Distance(target.ServerPosition) > player.GetAutoAttackRange())
                    {
                        var dashData = player.GetDashData(target.ServerPosition, target);
                        if (dashData != null && dashData.Value.ObjAiBase.IsValidTarget())
                        {
                            if (Environment.TickCount - _sweepingBladeDelay > 300)
                            {
                                if (dashData.Value.Vector3.Distance(target.ServerPosition) <
                                    Yasuo.Player.Distance(target.ServerPosition) - 100 &&
                                    dashData.Value.Vector3.Distance(target.ServerPosition) <
                                    Yasuo.Menu.GetValue <Slider>(YasuoMenu.ComboERangeName).Value)
                                {
                                    YasuoSpells.E.Cast(dashData.Value.ObjAiBase, packets);
                                    DashingEnd          = player.GetDashingEnd(dashData.Value.ObjAiBase);
                                    _sweepingBladeDelay = LastSweepingBladeTick = Environment.TickCount;
                                }
                            }
                        }
                    }
                }
            }

            if (!target.IsValidTarget())
            {
                return;
            }

            var useQ  = menu.GetValue <bool>(YasuoMenu.ComboQName);  // => Use Q
            var use3Q = menu.GetValue <bool>(YasuoMenu.Combo3QName); // => Use 3rd Q
            var useR  = menu.GetValue <bool>(YasuoMenu.ComboRName);  // => Use R

            // => Q Function
            if (useQ && !player.HasWhirlwind() && YasuoSpells.Q.QStage0.IsReady())
            {
                // => Dashing
                if (player.IsDashing())
                {
                    // => Prediction Distance
                    if (player.Distance(target.ServerPosition) < YasuoSpells.Q.DashingRange - 50f &&
                        DashingEnd.Distance(target.ServerPosition) < YasuoSpells.Q.DashingRange - 50f)
                    {
                        YasuoSpells.Q.QStage0.Cast(packets);
                    }
                }
                else if (Environment.TickCount - LastSweepingBladeTick > 420)
                {
                    // => Not dashing
                    var targetPosition =
                        Prediction.GetPrediction(target, YasuoSpells.Q.QStage0.Delay, 0f, target.MoveSpeed).UnitPosition;
                    // => Prediction
                    var castPosition =
                        Prediction.GetPrediction(target, YasuoSpells.Q.QStage0.Delay, 0f, YasuoSpells.Q.QStage0.Speed)
                        .CastPosition;     // => Prediction

                    // => Prediction Distance
                    if (player.Distance(targetPosition) < YasuoSpells.Q.QStage0.Range)
                    {
                        YasuoSpells.Q.QStage0.Cast(castPosition, packets);
                    }
                }
            }

            // => 3Q Function
            if (use3Q && player.HasWhirlwind() && YasuoSpells.Q.QStage1.IsReady())
            {
                // => Dashing
                if (player.IsDashing())
                {
                    // => Prediction Distance
                    if (player.Distance(target.ServerPosition) < YasuoSpells.Q.DashingRange - 50f &&
                        DashingEnd.Distance(target.ServerPosition) < YasuoSpells.Q.DashingRange - 50f)
                    {
                        YasuoSpells.Q.QStage1.Cast(packets);
                    }
                }
                else if (Environment.TickCount - LastSweepingBladeTick > 420)
                {
                    // => Prediction
                    var castPosition =
                        Prediction.GetPrediction(target, YasuoSpells.Q.QStage1.Delay, 0f, YasuoSpells.Q.QStage1.Speed)
                        .CastPosition;     // => Prediction

                    // => Prediction Distance
                    if (player.Distance(target.ServerPosition) < YasuoSpells.Q.QStage1.Range)
                    {
                        YasuoSpells.Q.QStage1.Cast(castPosition, packets);
                    }
                }
            }

            // => R Function
            if (useR && YasuoSpells.R.IsReady())
            {
                var rMode        = menu.GetValue <StringList>(YasuoMenu.ComboRModeName).SelectedIndex; // => R Mode
                var rMPercent    = menu.GetValue <Slider>(YasuoMenu.ComboRPercentName).Value;          // => R Min Enemies Health %
                var rSPercent    = menu.GetValue <Slider>(YasuoMenu.ComboRPercent2Name).Value;         // => R Min Enemy Health %
                var rSelfKnockup = menu.GetValue <bool>(YasuoMenu.ComboRSelfName);                     // => R only self knockedup enemies
                var rMin         = menu.GetValue <Slider>(YasuoMenu.ComboRMinName).Value;              // => R Min Enemies to use
                var rKnockupTime = menu.GetValue <Slider>(YasuoMenu.ComboRAirTimeName).Value;          // => R Min. Airtime
                var usedR        = false;

                if (rMode == 0 || rMode == 2)
                {
                    var targets =
                        ObjectManager.Get <Obj_AI_Hero>().FindAll(t => t.IsValidTarget() && t.IsKnockedup(rSelfKnockup));
                    if (targets.Count() >= rMin)
                    {
                        var totalPercent = targets.Sum(t => t.Health / t.MaxHealth * 100) / targets.Count();
                        if (totalPercent <= rMPercent)
                        {
                            var lowestAirtime = targets.OrderBy(t => Game.Time - t.KnockupTimeLeft()).FirstOrDefault();
                            var formula       = (float)rKnockupTime / 100;
                            if (lowestAirtime != null && lowestAirtime.KnockupTimeLeft() <= formula)
                            {
                                YasuoSpells.R.Cast(packets);
                                usedR = true;
                            }
                        }
                    }
                }
                if ((rMode == 1 || rMode == 2) && !usedR)
                {
                    if (target.IsKnockedup(rSelfKnockup))
                    {
                        var totalPercent = target.Health / target.MaxHealth * 100;
                        if (totalPercent <= rSPercent)
                        {
                            var formula = (float)rKnockupTime / 1000;
                            if (target.KnockupTimeLeft() <= formula)
                            {
                                YasuoSpells.R.Cast(packets);
                            }
                        }
                    }
                }
            }

            // => Items
            if (YasuoSpells.Tiamat.GetItem().IsOwned() && menu.GetValue <bool>(YasuoMenu.ComboItemsTiamatName))
            {
                // => Tiamat
                var item  = YasuoSpells.Tiamat.GetItem();
                var range = YasuoSpells.Tiamat.Range;

                if (item.IsReady())
                {
                    if (player.Distance(target) < range)
                    {
                        item.Cast();
                    }
                }
            }
            else if (YasuoSpells.RavenousHydra.GetItem().IsOwned() && menu.GetValue <bool>(YasuoMenu.ComboItemsHydraName))
            {
                // => Hydra
                var item  = YasuoSpells.RavenousHydra.GetItem();
                var range = YasuoSpells.RavenousHydra.Range;

                if (item.IsReady())
                {
                    if (player.Distance(target) < range)
                    {
                        item.Cast();
                    }
                }
            }

            if (YasuoSpells.BilgewaterCutlass.GetItem().IsOwned() &&
                menu.GetValue <bool>(YasuoMenu.ComboItemsBilgewaterName))
            {
                // => Bilgewater
                var item  = YasuoSpells.BilgewaterCutlass.GetItem();
                var range = YasuoSpells.BilgewaterCutlass.Range;

                if (item.IsReady())
                {
                    if (player.Distance(target) < range)
                    {
                        item.Cast(target);
                    }
                }
            }
            else if (YasuoSpells.BladeoftheRuinedKing.GetItem().IsOwned() &&
                     menu.GetValue <bool>(YasuoMenu.ComboItemsBotRkName))
            {
                // => BotRK
                var item  = YasuoSpells.BladeoftheRuinedKing.GetItem();
                var range = YasuoSpells.BladeoftheRuinedKing.Range;

                if (item.IsReady())
                {
                    if (player.Distance(target) < range)
                    {
                        item.Cast(target);
                    }
                }
            }
        }