protected override void Flee()
 {
     if (Menu.Item(Menu.Name + ".flee.w").GetValue <bool>())
     {
         if (W.IsReady() || Cards.Status == SelectStatus.Ready)
         {
             var target = TargetSelector.GetTarget(W, false);
             if (target != null)
             {
                 var best = GetBestCard(target, "flee");
                 if (best.Any())
                 {
                     Cards.Select(best);
                     Orbwalker.ForceTarget(target);
                 }
             }
         }
         if (Player.CanAttack && (Cards.Has(CardColor.Red) || Cards.Has(CardColor.Gold)))
         {
             var target =
                 GameObjects.EnemyHeroes.Where(e => Orbwalking.InAutoAttackRange(e) && e.IsValidTarget())
                 .OrderBy(e => e.Distance(Player))
                 .FirstOrDefault();
             if (target != null)
             {
                 Player.IssueOrder(GameObjectOrder.AttackUnit, target);
             }
         }
     }
 }
Exemple #2
0
 void IChampion.Flee()
 {
     try
     {
         Orbwalker.SetAttack(false);
         Orbwalking.MoveTo(Game.CursorPos, Orbwalker.HoldAreaRadius);
         Flee();
         Utility.DelayAction.Add(
             750, delegate
         {
             if (Orbwalker.ActiveMode == Orbwalking.OrbwalkingMode.Flee)
             {
                 ItemManager.UseFleeItems();
             }
         });
         Utility.DelayAction.Add(
             125, delegate
         {
             if (Orbwalker.ActiveMode != Orbwalking.OrbwalkingMode.Flee)
             {
                 Orbwalker.SetAttack(true);
             }
         });
     }
     catch (Exception ex)
     {
         Global.Logger.AddItem(new LogItem(ex));
     }
 }
        private void OnCoreBoot(EventArgs args)
        {
            try
            {
                OnLoad();
                SetupSpells();
                SetupMenu();

                Weights.Range = Math.Max(
                    Weights.Range,
                    Spells.Select(e => e.Range).DefaultIfEmpty(Orbwalking.GetRealAutoAttackRange(null) * 1.2f).Max());

                Core.OnPreUpdate  += OnCorePreUpdate;
                Core.OnPostUpdate += OnCorePostUpdate;

                Orbwalking.BeforeAttack        += OnOrbwalkingBeforeAttack;
                Orbwalking.AfterAttack         += OnOrbwalkingAfterAttack;
                Obj_AI_Base.OnProcessSpellCast += OnObjAiBaseProcessSpellCast;

                Drawing.OnDraw += OnDrawingDraw;
            }
            catch (Exception ex)
            {
                Global.Logger.AddItem(new LogItem(ex));
            }
        }
 private void OnInterruptableTarget(Obj_AI_Hero sender, Interrupter2.InterruptableTargetEventArgs args)
 {
     try
     {
         if (sender != null && sender.IsEnemy && args.DangerLevel == Interrupter2.DangerLevel.High &&
             Orbwalking.InAutoAttackRange(sender))
         {
             if (Cards.Has(CardColor.Gold))
             {
                 Orbwalker.ForceTarget(sender);
                 Player.IssueOrder(GameObjectOrder.AttackUnit, sender);
             }
         }
     }
     catch (Exception ex)
     {
         Global.Logger.AddItem(new LogItem(ex));
     }
 }
 public static void Muramana(Obj_AI_Hero target, bool activate, float overrideRange = -1f)
 {
     try
     {
         var muramana = ObjectManager.Player.GetSpellSlot("Muramana");
         if (muramana == SpellSlot.Unknown || !muramana.IsReady())
         {
             return;
         }
         var hasBuff = ObjectManager.Player.HasBuff("Muramana");
         if ((activate && !hasBuff &&
              (_menu == null ||
               _menu.Item(_menu.Name + ".muramana.combo").GetValue <bool>() &&
               ObjectManager.Player.CountEnemiesInRange(
                   overrideRange > 0 ? overrideRange : Orbwalking.GetRealAutoAttackRange(ObjectManager.Player)) >=
               _menu.Item(_menu.Name + ".muramana.min-enemies-range").GetValue <Slider>().Value&&
               ObjectManager.Player.ManaPercent >=
               _menu.Item(_menu.Name + ".muramana.player-mana-above").GetValue <Slider>().Value&&
               ObjectManager.Player.HealthPercent <=
               _menu.Item(_menu.Name + ".muramana.player-health-below").GetValue <Slider>().Value&&
               ObjectManager.Player.HealthPercent >=
               _menu.Item(_menu.Name + ".muramana.player-health-above").GetValue <Slider>().Value&&
               (target == null ||
                target.HealthPercent <=
                _menu.Item(_menu.Name + ".muramana.target-health-below").GetValue <Slider>().Value&&
                target.HealthPercent >=
                _menu.Item(_menu.Name + ".muramana.target-health-above").GetValue <Slider>().Value))) ||
             !activate && hasBuff)
         {
             ObjectManager.Player.Spellbook.CastSpell(muramana);
         }
     }
     catch (Exception ex)
     {
         Global.Logger.AddItem(new LogItem(ex));
     }
 }
        private void OnOrbwalkingBeforeAttack(Orbwalking.BeforeAttackEventArgs args)
        {
            try
            {
                var hero = args.Target as Obj_AI_Hero;
                if (hero != null)
                {
                    args.Process = Cards.Status != SelectStatus.Selecting && !Cards.ShouldWait;
                    if (args.Process)
                    {
                        if (Cards.Has(CardColor.Gold))
                        {
                            _qDelay =
                                (int)
                                    (((hero.ServerPosition.Distance(Player.ServerPosition) *
                                       (hero.IsFacing(Player) ? 0.9f : 1.1f) / Orbwalking.GetMyProjectileSpeed() +
                                       ObjectManager.Player.AttackCastDelay) * 1000f + Game.Ping / 2f) * 0.8f);
                            _wTarget = hero;
                            _wTargetEndTime = Game.Time + (Game.Ping / 2000f) + 3f;

                            var target = TargetSelector.GetTarget(W, false);
                            if (target != null && !target.NetworkId.Equals(hero.NetworkId))
                            {
                                Orbwalker.ForceTarget(target);
                                args.Process = false;
                            }
                        }
                    }
                }
                else
                {
                    if (Orbwalker.ActiveMode != Orbwalking.OrbwalkingMode.Flee &&
                        Orbwalker.ActiveMode != Orbwalking.OrbwalkingMode.None)
                    {
                        if (Cards.Has(CardColor.Gold) || Cards.Has(CardColor.Blue))
                        {
                            var targets = TargetSelector.GetTargets(
                                Orbwalking.GetRealAutoAttackRange(null) * 1.25f, DamageType.Magical);
                            if (targets != null)
                            {
                                var target = targets.FirstOrDefault(Orbwalking.InAutoAttackRange);
                                if (target != null)
                                {
                                    Orbwalker.ForceTarget(target);
                                    args.Process = false;
                                }
                            }
                        }
                    }
                }
                if (Orbwalker.ActiveMode == Orbwalking.OrbwalkingMode.LaneClear ||
                    Orbwalker.ActiveMode == Orbwalking.OrbwalkingMode.LastHit)
                {
                    if (Cards.Has(CardColor.Red))
                    {
                        var target = Orbwalker.ForcedTarget();
                        if (target != null && target.NetworkId != args.Target.NetworkId)
                        {
                            args.Process = false;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Global.Logger.AddItem(new LogItem(ex));
            }
        }
 private void OnOrbwalkingBeforeAttack(Orbwalking.BeforeAttackEventArgs args)
 {
     try
     {
         if (args.Unit.IsMe)
         {
             if (Orbwalker.ActiveMode == Orbwalking.OrbwalkingMode.Combo)
             {
                 var enemy = args.Target as Obj_AI_Hero;
                 if (enemy != null)
                 {
                     ItemManager.Muramana(enemy, true);
                 }
             }
             else
             {
                 ItemManager.Muramana(null, false);
             }
         }
     }
     catch (Exception ex)
     {
         Global.Logger.AddItem(new LogItem(ex));
     }
 }
        static ItemManager()
        {
            try
            {
                // Speed + Atk Speed
                Youmuu = new CustomItem
                {
                    Name        = "youmuus-ghostblade",
                    DisplayName = "Youmuu's Ghostblade",
                    Item        = ItemData.Youmuus_Ghostblade.GetItem(),
                    Flags       = ItemFlags.Offensive | ItemFlags.Flee,
                    CombatFlags = CombatFlags.Melee | CombatFlags.Ranged,
                    EffectFlags = EffectFlags.AttackSpeed | EffectFlags.MovementSpeed,
                    CastType    = CastType.Self,
                    Range       =
                        ObjectManager.Player.IsMelee
                            ? ObjectManager.Player.AttackRange * 3
                            : Orbwalking.GetRealAutoAttackRange(ObjectManager.Player)
                };

                // AOE damage, only melee
                Tiamat = new CustomItem
                {
                    Name        = "tiamat",
                    DisplayName = "Tiamat",
                    Item        = ItemData.Tiamat_Melee_Only.GetItem(),
                    Flags       = ItemFlags.Offensive,
                    CombatFlags = CombatFlags.Melee,
                    EffectFlags = EffectFlags.Damage,
                    CastType    = CastType.Self,
                    Damage      = Damage.DamageItems.Tiamat,
                    Range       = ItemData.Tiamat_Melee_Only.GetItem().Range
                };

                // AOE damage, only melee
                Hydra = new CustomItem
                {
                    Name        = "hydra",
                    DisplayName = "Hydra",
                    Item        = ItemData.Ravenous_Hydra_Melee_Only.GetItem(),
                    Flags       = ItemFlags.Offensive,
                    CombatFlags = CombatFlags.Melee,
                    EffectFlags = EffectFlags.Damage,
                    CastType    = CastType.Self,
                    Damage      = Damage.DamageItems.Hydra,
                    Range       = ItemData.Ravenous_Hydra_Melee_Only.GetItem().Range
                };

                // Slow + Damage
                BilgewaterCutlass = new CustomItem
                {
                    Name        = "bilgewater-cutlass",
                    DisplayName = "Bilgewater Cutlass",
                    Item        = ItemData.Bilgewater_Cutlass.GetItem(),
                    Flags       = ItemFlags.Offensive | ItemFlags.Flee,
                    CombatFlags = CombatFlags.Melee | CombatFlags.Ranged,
                    EffectFlags = EffectFlags.Damage | EffectFlags.MovementSlow,
                    CastType    = CastType.Target,
                    Damage      = Damage.DamageItems.Bilgewater,
                    Range       = ItemData.Bilgewater_Cutlass.GetItem().Range
                };

                // Slow + Damage
                BladeRuinedKing = new CustomItem
                {
                    Name        = "blade-ruined-king",
                    DisplayName = "Blade of the Ruined King",
                    Item        = ItemData.Blade_of_the_Ruined_King.GetItem(),
                    Flags       = ItemFlags.Offensive | ItemFlags.Flee,
                    CombatFlags = CombatFlags.Melee | CombatFlags.Ranged,
                    EffectFlags = EffectFlags.Damage | EffectFlags.MovementSlow,
                    CastType    = CastType.Target,
                    Damage      = Damage.DamageItems.Botrk,
                    Range       = ItemData.Blade_of_the_Ruined_King.GetItem().Range
                };

                // Damage + Slow
                HextechGunblade = new CustomItem
                {
                    Name        = "hextech-gunblade",
                    DisplayName = "Hextech Gunblade",
                    Item        = ItemData.Hextech_Gunblade.GetItem(),
                    Flags       = ItemFlags.Offensive | ItemFlags.Flee,
                    CombatFlags = CombatFlags.Melee | CombatFlags.Ranged,
                    EffectFlags = EffectFlags.Damage | EffectFlags.MovementSlow,
                    CastType    = CastType.Target,
                    Damage      = Damage.DamageItems.Hexgun,
                    Range       = ItemData.Hextech_Gunblade.GetItem().Range
                };

                // AOE Shield
                LocketIronSolari = new CustomItem
                {
                    Name        = "locket-iron-solari",
                    DisplayName = "Locket of the Iron Solari",
                    Item        = ItemData.Locket_of_the_Iron_Solari.GetItem(),
                    Flags       = ItemFlags.Supportive | ItemFlags.Defensive,
                    CombatFlags = CombatFlags.Melee | CombatFlags.Ranged,
                    EffectFlags = EffectFlags.Shield,
                    CastType    = CastType.Self,
                    Range       = ItemData.Locket_of_the_Iron_Solari.GetItem().Range
                };

                // Remove stun + heal
                MikaelsCrucible = new CustomItem
                {
                    Name        = "mikaels-crucible",
                    DisplayName = "Mikael's Crucible",
                    Item        = ItemData.Mikaels_Crucible.GetItem(),
                    Flags       = ItemFlags.Supportive,
                    CombatFlags = CombatFlags.Melee | CombatFlags.Ranged,
                    EffectFlags = EffectFlags.RemoveStun | EffectFlags.Heal,
                    CastType    = CastType.Target,
                    Range       = ItemData.Mikaels_Crucible.GetItem().Range
                };

                // Place wards
                Sightstone = new CustomItem
                {
                    Name        = "sightstone",
                    DisplayName = "Sightstone",
                    Item        = ItemData.Sightstone.GetItem(),
                    Flags       = ItemFlags.Supportive,
                    CombatFlags = CombatFlags.Melee | CombatFlags.Ranged,
                    CastType    = CastType.Position,
                    Range       = ItemData.Sightstone.GetItem().Range
                };

                // Place wards
                RubySightstone = new CustomItem
                {
                    Name        = "ruby-sightstone",
                    DisplayName = "Ruby Sightstone",
                    Item        = ItemData.Ruby_Sightstone.GetItem(),
                    Flags       = ItemFlags.Supportive,
                    CombatFlags = CombatFlags.Melee | CombatFlags.Ranged,
                    CastType    = CastType.Position,
                    Range       = ItemData.Ruby_Sightstone.GetItem().Range
                };

                Items = new List <CustomItem>
                {
                    Youmuu,
                    Tiamat,
                    Hydra,
                    BilgewaterCutlass,
                    BladeRuinedKing,
                    HextechGunblade,
                    MikaelsCrucible,
                    LocketIronSolari,
                    Sightstone,
                    RubySightstone
                };

                MaxRange = Items.Max(s => s.Range);
            }
            catch (Exception ex)
            {
                Global.Logger.AddItem(new LogItem(ex));
            }
        }
        private void OnOrbwalkingBeforeAttack(Orbwalking.BeforeAttackEventArgs args)
        {
            try
            {
                var hero = args.Target as Obj_AI_Hero;
                if (hero != null)
                {
                    args.Process = Cards.Status != SelectStatus.Selecting && !Cards.ShouldWait;
                    if (args.Process)
                    {
                        if (Cards.Has(CardColor.Gold))
                        {
                            _wTarget = hero;
                            _wTargetEndTime = Game.Time + 5f;

                            var target = TargetSelector.GetTarget(W, false);
                            if (target != null && !target.NetworkId.Equals(hero.NetworkId))
                            {
                                Orbwalker.ForceTarget(target);
                                args.Process = false;
                            }
                        }
                    }
                }
                else
                {
                    if (Orbwalker.ActiveMode != Orbwalking.OrbwalkingMode.Flee &&
                        Orbwalker.ActiveMode != Orbwalking.OrbwalkingMode.None)
                    {
                        if (Cards.Has(CardColor.Gold) || Cards.Has(CardColor.Blue))
                        {
                            var targets = TargetSelector.GetTargets(
                                Orbwalking.GetRealAutoAttackRange(null) * 1.25f, DamageType.Magical);
                            if (targets != null)
                            {
                                var target = targets.FirstOrDefault(Orbwalking.InAutoAttackRange);
                                if (target != null)
                                {
                                    Orbwalker.ForceTarget(target);
                                    args.Process = false;
                                }
                            }
                        }
                    }
                }
                if (Orbwalker.ActiveMode == Orbwalking.OrbwalkingMode.LaneClear ||
                    Orbwalker.ActiveMode == Orbwalking.OrbwalkingMode.LastHit)
                {
                    if (Cards.Has(CardColor.Red))
                    {
                        var target = Orbwalker.ForcedTarget();
                        if (target != null && target.NetworkId != args.Target.NetworkId)
                        {
                            args.Process = false;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Global.Logger.AddItem(new LogItem(ex));
            }
        }
Exemple #10
0
        private List <CardColor> GetBestCard(Obj_AI_Hero target, string mode)
        {
            var cards = new List <CardColor>();

            if (target == null || !target.IsValid)
            {
                return(cards);
            }
            try
            {
                if (IsWKillable(target, 2) && !target.IsDead)
                {
                    cards.Add(CardColor.Gold);
                }
                if (IsWKillable(target) && !target.IsDead)
                {
                    cards.Add(CardColor.Blue);
                }
                if (IsWKillable(target, 1) && !target.IsDead)
                {
                    cards.Add(CardColor.Red);
                }
                if (cards.Any())
                {
                    return(cards);
                }
                var burst = Menu.Item(Menu.Name + ".miscellaneous.mode").GetValue <StringList>().SelectedIndex == 0;
                var red   = 0;
                var blue  = 0;
                var gold  = 0;
                if (!burst &&
                    (mode == "combo" || mode == "harass" && Menu.Item(Menu.Name + ".harass.w-auto").GetValue <bool>()))
                {
                    if (Q.Level == 0)
                    {
                        return(new List <CardColor> {
                            CardColor.Blue
                        });
                    }
                    gold++;
                    if (target.Distance(Player) > W.Range * 0.8f)
                    {
                        gold++;
                    }
                    if (!ManaManager.Check(mode + "-blue"))
                    {
                        blue = 4;
                    }
                    var minRed  = Menu.Item(Menu.Name + ".combo.red-min").GetValue <Slider>().Value;
                    var redHits = GetWHits(target, GameObjects.EnemyHeroes.Cast <Obj_AI_Base>().ToList(), CardColor.Red);
                    red += redHits;
                    if (red > blue && red > gold && redHits >= minRed)
                    {
                        cards.Add(CardColor.Red);
                        if (red == blue)
                        {
                            cards.Add(CardColor.Blue);
                        }
                        if (red == gold)
                        {
                            cards.Add(CardColor.Gold);
                        }
                    }
                    else if (gold > blue && gold > red)
                    {
                        cards.Add(CardColor.Gold);
                        if (gold == blue)
                        {
                            cards.Add(CardColor.Blue);
                        }
                        if (gold == red && redHits >= minRed)
                        {
                            cards.Add(CardColor.Red);
                        }
                    }
                    else if (blue > red && blue > gold)
                    {
                        cards.Add(CardColor.Blue);
                        if (blue == red && redHits >= minRed)
                        {
                            cards.Add(CardColor.Red);
                        }
                        if (blue == gold)
                        {
                            cards.Add(CardColor.Gold);
                        }
                    }
                }
                if (mode == "combo" && !cards.Any())
                {
                    if (Q.Level == 0)
                    {
                        return(new List <CardColor> {
                            CardColor.Blue
                        });
                    }
                    var distance = target.Distance(Player);
                    var damage   = ItemManager.CalculateComboDamage(target) - target.HPRegenRate * 2f - 10;
                    if (HasEBuff())
                    {
                        damage += E.GetDamage(target);
                    }
                    if (Q.IsReady() && (Utils.GetStunTime(target) > 0.5f || distance < Q.Range / 4f))
                    {
                        damage += Q.GetDamage(target);
                    }
                    if (W.GetDamage(target, 2) + damage > target.Health)
                    {
                        cards.Add(CardColor.Gold);
                    }
                    if (distance < Orbwalking.GetRealAutoAttackRange(target) * 0.85f)
                    {
                        if (W.GetDamage(target) + damage > target.Health)
                        {
                            cards.Add(CardColor.Blue);
                        }
                        if (W.GetDamage(target, 1) + damage > target.Health)
                        {
                            cards.Add(CardColor.Red);
                        }
                    }

                    var blueMana1 = (ObjectManager.Player.Mana <(W.Instance.ManaCost + Q.Instance.ManaCost) &&
                                                                ObjectManager.Player.Mana> (Q.Instance.ManaCost - 10));
                    var blueMana2 = (ObjectManager.Player.Mana <(W.Instance.ManaCost + Q.Instance.ManaCost) &&
                                                                ObjectManager.Player.Mana> (Q.Instance.ManaCost - 20));
                    var blueMana3 = (ObjectManager.Player.Mana < (W.Instance.ManaCost + Q.Instance.ManaCost));
                    if (!cards.Any())
                    {
                        if (ObjectManager.Player.HealthPercent <=
                            Menu.Item(Menu.Name + ".combo.gold-percent").GetValue <Slider>().Value)
                        {
                            cards.Add(CardColor.Gold);
                        }
                        else if ((!ManaManager.Check("combo-blue") || (W.Level == 1 && blueMana1) ||
                                  W.Level == 2 && blueMana2) || W.Level > 2 && blueMana3)
                        {
                            cards.Add(CardColor.Blue);
                        }
                        else
                        {
                            var redHits = GetWHits(
                                target, GameObjects.EnemyHeroes.Cast <Obj_AI_Base>().ToList(), CardColor.Red);
                            if (redHits >= Menu.Item(Menu.Name + ".combo.red-min").GetValue <Slider>().Value)
                            {
                                cards.Add(CardColor.Red);
                            }
                        }
                    }
                    if (!cards.Any())
                    {
                        cards.Add(CardColor.Gold);
                    }
                }
                else if (mode == "harass" && !cards.Any())
                {
                    if (Menu.Item(Menu.Name + ".harass.w-auto").GetValue <bool>() && burst)
                    {
                        cards.Add(target.Distance(Player) > W.Range * 0.8f ? CardColor.Gold : CardColor.Blue);
                    }
                    else
                    {
                        var card = !ManaManager.Check("harass-blue")
                            ? CardColor.Blue
                            : GetSelectedCardColor(
                            Menu.Item(Menu.Name + ".harass.w-card").GetValue <StringList>().SelectedIndex);
                        if (card != CardColor.None)
                        {
                            cards.Add(card);
                        }
                    }
                }
                else if (mode == "flee")
                {
                    cards.Add(
                        GetWHits(target, GameObjects.EnemyHeroes.Cast <Obj_AI_Base>().ToList(), CardColor.Red) >= 2
                            ? CardColor.Red
                            : CardColor.Gold);
                }
                if (!cards.Any())
                {
                    cards.Add(CardColor.Gold);
                }
            }
            catch (Exception ex)
            {
                Global.Logger.AddItem(new LogItem(ex));
            }
            return(cards);
        }
Exemple #11
0
        protected override void Combo()
        {
            var q = Menu.Item(Menu.Name + ".combo.q").GetValue <bool>();
            var w = Menu.Item(Menu.Name + ".combo.w").GetValue <bool>();

            if (w && W.IsReady())
            {
                var target = TargetSelector.GetTarget(W, false);
                if (target != null)
                {
                    var best = GetBestCard(target, "combo");
                    if (best.Any())
                    {
                        Cards.Select(best);
                    }
                }
            }
            if (q && Q.IsReady())
            {
                var target         = TargetSelector.GetTarget(Q);
                var goldCardTarget = _wTarget != null && _wTarget.IsValidTarget(Q.Range) && Game.Time <= _wTargetEndTime;
                if (goldCardTarget)
                {
                    target = _wTarget;
                }
                if (target == null || target.Distance(Player) < Player.BoundingRadius)
                {
                    return;
                }
                if (!goldCardTarget && (Cards.Has() || HasEBuff()) &&
                    GameObjects.EnemyHeroes.Any(e => Orbwalking.InAutoAttackRange(e) && e.IsValidTarget()))
                {
                    return;
                }
                var cd = W.Instance.CooldownExpires - Game.Time;
                if (goldCardTarget)
                {
                    Utility.DelayAction.Add(
                        (Utils.IsStunned(target) ? 1 : _qDelay), delegate
                    {
                        if (Q.IsReady())
                        {
                            var best = BestQPosition(
                                target, GameObjects.EnemyHeroes.Cast <Obj_AI_Base>().ToList(),
                                (Q.GetHitChance("combo") - 1));
                            if (!best.Item2.Equals(Vector3.Zero) && best.Item1 >= 1)
                            {
                                Q.Cast(best.Item2);
                                _wTarget        = null;
                                _qDelay         = 0;
                                _wTargetEndTime = 0;
                            }
                        }
                    });
                }
                else if (Utils.IsStunned(target) || cd >= 2 || W.Level == 0)
                {
                    var best = BestQPosition(
                        target, GameObjects.EnemyHeroes.Cast <Obj_AI_Base>().ToList(), Q.GetHitChance("combo"));
                    if (!best.Item2.Equals(Vector3.Zero) && best.Item1 >= 1)
                    {
                        Q.Cast(best.Item2);
                    }
                }
            }
        }
Exemple #12
0
        private void OnOrbwalkingBeforeAttack(Orbwalking.BeforeAttackEventArgs args)
        {
            try
            {
                var hero = args.Target as Obj_AI_Hero;
                if (hero != null)
                {
                    args.Process = Cards.Status != SelectStatus.Selecting && !Cards.ShouldWait;
                    if (args.Process)
                    {
                        if (Cards.Has(CardColor.Gold))
                        {
                            _qDelay =
                                (int)
                                (((hero.ServerPosition.Distance(Player.ServerPosition) *
                                   (hero.IsFacing(Player) ? 0.9f : 1.1f) / Orbwalking.GetMyProjectileSpeed() +
                                   ObjectManager.Player.AttackCastDelay) * 1000f + Game.Ping / 2f) * 0.8f);
                            _wTarget        = hero;
                            _wTargetEndTime = Game.Time + (Game.Ping / 2000f) + 3f;

                            var target = TargetSelector.GetTarget(W, false);
                            if (target != null && !target.NetworkId.Equals(hero.NetworkId))
                            {
                                Orbwalker.ForceTarget(target);
                                args.Process = false;
                            }
                        }
                    }
                }
                else
                {
                    if (Orbwalker.ActiveMode != Orbwalking.OrbwalkingMode.Flee &&
                        Orbwalker.ActiveMode != Orbwalking.OrbwalkingMode.None)
                    {
                        if (Cards.Has(CardColor.Gold) || Cards.Has(CardColor.Blue))
                        {
                            var targets = TargetSelector.GetTargets(
                                Orbwalking.GetRealAutoAttackRange(null) * 1.25f, DamageType.Magical);
                            if (targets != null)
                            {
                                var target = targets.FirstOrDefault(Orbwalking.InAutoAttackRange);
                                if (target != null)
                                {
                                    Orbwalker.ForceTarget(target);
                                    args.Process = false;
                                }
                            }
                        }
                    }
                }
                if (Orbwalker.ActiveMode == Orbwalking.OrbwalkingMode.LaneClear ||
                    Orbwalker.ActiveMode == Orbwalking.OrbwalkingMode.LastHit)
                {
                    if (Cards.Has(CardColor.Red))
                    {
                        var target = Orbwalker.ForcedTarget();
                        if (target != null && target.NetworkId != args.Target.NetworkId)
                        {
                            args.Process = false;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Global.Logger.AddItem(new LogItem(ex));
            }
        }
        private void OnOrbwalkingBeforeAttack(Orbwalking.BeforeAttackEventArgs args)
        {
            try
            {
                var hero = args.Target as Obj_AI_Hero;
                if (hero != null)
                {
                    args.Process = Cards.Status != SelectStatus.Selecting && !Cards.ShouldWait;
                    if (args.Process)
                    {
                        if (Cards.Has(CardColor.Gold))
                        {
                            _qDelay = Game.Time + W.Delay / 2f +
                                      hero.Distance(Player) * 1.5f / Player.BasicAttack.MissileSpeed;
                            _qTarget = hero;

                            var target = TargetSelector.GetTarget(W, false);
                            if (target != null && !target.NetworkId.Equals(hero.NetworkId))
                            {
                                Orbwalker.ForceTarget(target);
                                args.Process = false;
                            }
                        }
                    }
                }
                if (Orbwalker.ActiveMode == Orbwalking.OrbwalkingMode.LaneClear ||
                    Orbwalker.ActiveMode == Orbwalking.OrbwalkingMode.LastHit)
                {
                    if (Cards.Has(CardColor.Red))
                    {
                        var target = Orbwalker.ForcedTarget();
                        if (target != null && target.NetworkId != args.Target.NetworkId)
                        {
                            args.Process = false;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Global.Logger.AddItem(new LogItem(ex));
            }
        }
Exemple #14
0
        protected override void Combo()
        {
            var q = Menu.Item(Menu.Name + ".combo.q").GetValue <bool>();
            var w = Menu.Item(Menu.Name + ".combo.w").GetValue <bool>();

            if (w && W.IsReady())
            {
                var target = TargetSelector.GetTarget(W, false);
                if (target != null)
                {
                    var best = GetBestCard(target, "combo");
                    if (best.Any())
                    {
                        Cards.Select(best);
                    }
                }
            }
            if (q && Q.IsReady())
            {
                var target         = TargetSelector.GetTarget(Q);
                var goldCardTarget = _wTarget != null && _wTarget.IsValidTarget(Q.Range) && _wTargetEndTime > Game.Time;
                if (goldCardTarget)
                {
                    target = _wTarget;
                }
                if (target == null || target.Distance(Player) < Player.BoundingRadius && !Utils.IsImmobile(target))
                {
                    return;
                }
                if (!goldCardTarget && (Cards.Has() || HasEBuff()) &&
                    GameObjects.EnemyHeroes.Any(e => Orbwalking.InAutoAttackRange(e) && e.IsValidTarget()) ||
                    Cards.Has(CardColor.Gold))
                {
                    return;
                }
                if (goldCardTarget)
                {
                    if (target.Distance(Player) > 250 && !Utils.IsImmobile(target))
                    {
                        return;
                    }
                    var best = BestQPosition(
                        target, GameObjects.EnemyHeroes.Select(e => e as Obj_AI_Base).ToList(), Q.GetHitChance("combo"));
                    if (!best.Item2.Equals(Vector3.Zero) && best.Item1 >= 1)
                    {
                        Q.Cast(best.Item2);
                        _wTarget        = null;
                        _wTargetEndTime = 0;
                    }
                }
                else if (Utils.IsImmobile(target) || (W.Instance.CooldownExpires - Game.Time) >= 2 || W.Level == 0)
                {
                    var best = BestQPosition(
                        target, GameObjects.EnemyHeroes.Select(e => e as Obj_AI_Base).ToList(), Q.GetHitChance("combo"));
                    if (!best.Item2.Equals(Vector3.Zero) && best.Item1 >= 1)
                    {
                        Q.Cast(best.Item2);
                    }
                }
            }
        }
Exemple #15
0
        private void OnOrbwalkingBeforeAttack(Orbwalking.BeforeAttackEventArgs args)
        {
            try
            {
                var hero = args.Target as Obj_AI_Hero;
                if (hero != null)
                {
                    args.Process = Cards.Status != SelectStatus.Selecting && !Cards.ShouldWait;
                    if (args.Process)
                    {
                        if (Cards.Has(CardColor.Gold))
                        {
                            _wTarget        = hero;
                            _wTargetEndTime = Game.Time + 5f;

                            var target = TargetSelector.GetTarget(W, false);
                            if (target != null && !target.NetworkId.Equals(hero.NetworkId))
                            {
                                Orbwalker.ForceTarget(target);
                                args.Process = false;
                            }
                        }
                    }
                }
                else
                {
                    if (Orbwalker.ActiveMode != Orbwalking.OrbwalkingMode.Flee &&
                        Orbwalker.ActiveMode != Orbwalking.OrbwalkingMode.None)
                    {
                        if (Cards.Has(CardColor.Gold) || Cards.Has(CardColor.Blue))
                        {
                            var targets = TargetSelector.GetTargets(
                                Orbwalking.GetRealAutoAttackRange(null) * 1.25f, DamageType.Magical);
                            if (targets != null)
                            {
                                var target = targets.FirstOrDefault(Orbwalking.InAutoAttackRange);
                                if (target != null)
                                {
                                    Orbwalker.ForceTarget(target);
                                    args.Process = false;
                                }
                            }
                        }
                    }
                }
                if (Orbwalker.ActiveMode == Orbwalking.OrbwalkingMode.LaneClear ||
                    Orbwalker.ActiveMode == Orbwalking.OrbwalkingMode.LastHit)
                {
                    if (Cards.Has(CardColor.Red))
                    {
                        var target = Orbwalker.ForcedTarget();
                        if (target != null && target.NetworkId != args.Target.NetworkId)
                        {
                            args.Process = false;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Global.Logger.AddItem(new LogItem(ex));
            }
        }
        private void OnOrbwalkingBeforeAttack(Orbwalking.BeforeAttackEventArgs args)
        {
            try
            {
                if (!args.Unit.IsMe)
                {
                    return;
                }
                var hero = args.Target as Obj_AI_Hero;
                if (hero != null)
                {
                    args.Process = Cards.Status != SelectStatus.Selecting && !Cards.ShouldWait;
                    if (args.Process)
                    {
                        if (Cards.Has(CardColor.Gold))
                        {
                            _wTarget = hero;
                            _wTargetEndTime = Game.Time + 5f;

                            var target = TargetSelector.GetTarget(W, false);
                            if (target != null && !target.NetworkId.Equals(hero.NetworkId))
                            {
                                Orbwalker.ForceTarget(target);
                                args.Process = false;
                            }
                        }
                    }
                }
                else
                {
                    if (Orbwalker.ActiveMode != Orbwalking.OrbwalkingMode.Flee &&
                        Orbwalker.ActiveMode != Orbwalking.OrbwalkingMode.None)
                    {
                        if (Cards.Has(CardColor.Gold) || Cards.Has(CardColor.Blue))
                        {
                            var targets = TargetSelector.GetTargets(
                                Orbwalking.GetRealAutoAttackRange(null) * 1.25f, DamageType.Magical);
                            if (targets != null)
                            {
                                var target = targets.FirstOrDefault(Orbwalking.InAutoAttackRange);
                                if (target != null)
                                {
                                    Orbwalker.ForceTarget(target);
                                    args.Process = false;
                                }
                            }
                        }
                    }
                }
                if (Orbwalker.ActiveMode == Orbwalking.OrbwalkingMode.LaneClear ||
                    Orbwalker.ActiveMode == Orbwalking.OrbwalkingMode.LastHit)
                {
                    if (Cards.Has(CardColor.Red))
                    {
                        var bestMinion = BestRedMinion();
                        var buff = ObjectManager.Player.GetBuff("redcardpreattack");
                        if (bestMinion != null && bestMinion.NetworkId != args.Target.NetworkId &&
                            (buff == null || buff.EndTime - Game.Time > 0.15f))
                        {
                            Orbwalker.ForceTarget(bestMinion);
                            args.Process = false;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Global.Logger.AddItem(new LogItem(ex));
            }
        }