Example #1
0
        private static void OnCombo()
        {
            var enemiesr = EntityManager.Heroes.Enemies.OrderByDescending
                               (a => a.HealthPercent).Where(a => !a.IsMe && a.IsValidTarget() && a.Distance(Player) <= R.Range);
            var enemiesw = EntityManager.Heroes.Enemies.OrderByDescending
                               (a => a.HealthPercent).Where(a => !a.IsMe && a.IsValidTarget() && a.Distance(Player) <= W.Range);
            var enemies = EntityManager.Heroes.Enemies.OrderByDescending
                              (a => a.HealthPercent).Where(a => !a.IsMe && a.IsValidTarget() && a.Distance(Player) <= E.Range);
            var target     = TargetSelector.GetTarget(Q.Range, DamageType.Physical);
            var targetBoom =
                EntityManager.Heroes.Enemies.FirstOrDefault(
                    a => a.HasBuff("tristanaecharge") && a.Distance(Player) < Player.AttackRange);

            if (!target.IsValidTarget(Q.Range) || target == null)
            {
                return;
            }
            if (E.IsReady() && target.IsValidTarget(E.Range))
            {
                foreach (var eenemies in enemies)
                {
                    var useE = TristanaMenu.MyCombo["combo.e"
                                                    + eenemies.ChampionName].Cast <CheckBox>().CurrentValue;
                    if (useE)
                    {
                        E.Cast(eenemies);
                    }
                }
            }
            if (TristanaMenu.ComboQ() && Q.IsReady() && target.IsValidTarget(Q.Range))
            {
                Q.Cast();
            }
            if (W.IsReady() && target.IsValidTarget(W.Range) && !target.IsInvulnerable &&
                target.Position.CountEnemiesInRange(800) <= TristanaMenu.ComboW1())
            {
                foreach (var jumpenemies in enemiesw)
                {
                    var useW = TristanaMenu.MyCombo["combo.w"
                                                    + jumpenemies.ChampionName].Cast <CheckBox>().CurrentValue;
                    if (useW && W.GetPrediction(jumpenemies).HitChancePercent >= TristanaMenu.ComboWH())
                    {
                        W.Cast(W.GetPrediction(jumpenemies).CastPosition);
                    }
                }
            }

            if (targetBoom != null)
            {
                if (TristanaMenu.ComboEr() && !E.IsReady() && R.IsReady() && targetBoom.IsValidTarget(R.Range) && !targetBoom.IsInvulnerable &&
                    (targetBoom.Health + targetBoom.AllShield + TristanaMenu.ComboEr1()) -
                    (Player.GetSpellDamage(targetBoom, SpellSlot.E) +
                     (targetBoom.Buffs.Find(a => a.Name == "tristanaecharge").Count *
                      Player.GetSpellDamage(targetBoom, SpellSlot.E, DamageLibrary.SpellStages.Detonation))) <
                    Player.GetSpellDamage(targetBoom, SpellSlot.R))
                {
                    R.Cast(targetBoom);
                }
            }

            if (R.IsReady() && target.IsValidTarget(R.Range) && !target.IsInvulnerable &&
                target.Health + target.AttackShield + TristanaMenu.ComboR1() <
                Player.GetSpellDamage(target, SpellSlot.R))
            {
                foreach (var ultenemies in enemiesr)
                {
                    var useR = TristanaMenu.MyCombo["combo.r"
                                                    + ultenemies.ChampionName].Cast <CheckBox>().CurrentValue;
                    if (useR)
                    {
                        R.Cast(ultenemies);
                    }
                }
            }

            if ((ObjectManager.Player.CountEnemiesInRange(ObjectManager.Player.AttackRange) >=
                 TristanaMenu.YoumusEnemies() || Player.HealthPercent >= TristanaMenu.ItemsYoumuShp()) &&
                MyActivator.Youmus.IsReady() && TristanaMenu.Youmus() && MyActivator.Youmus.IsOwned())
            {
                MyActivator.Youmus.Cast();
                return;
            }
            if (Player.HealthPercent <= TristanaMenu.BilgewaterHp() && TristanaMenu.Bilgewater() &&
                MyActivator.Bilgewater.IsReady() && MyActivator.Bilgewater.IsOwned())
            {
                MyActivator.Bilgewater.Cast(target);
                return;
            }

            if (Player.HealthPercent <= TristanaMenu.BotrkHp() && TristanaMenu.Botrk() && MyActivator.Botrk.IsReady() &&
                MyActivator.Botrk.IsOwned())
            {
                MyActivator.Botrk.Cast(target);
            }
        }