Example #1
0
        public static void Elogic(bool OnlyChamp = false, bool Onlypoison = false, bool Pushing = false)
        {
            if (!E.IsReady())
            {
                return;
            }
            var TStarget = TargetSelector.GetTarget(Q.Range, TargetSelector.DamageType.Magical);

            Obj_AI_Base[] enemies;

            enemies = ObjectManager.Get <AIHeroClient>().Where(a => a.IsValidTarget(E.Range, true)).ToArray();
            if (!OnlyChamp)
            {
                enemies = enemies.Concat(ObjectManager.Get <Obj_AI_Minion>().Where(a => a.IsValidTarget(E.Range, true))).ToArray();
            }

            if (enemies.Count() == 0)
            {
                return;
            }
            List <int> worthCasting = new List <int>();

            int worth;

            foreach (var enemy in enemies)
            {
                if (Onlypoison && !Calculation.isPoisonned(enemy)) // TODO : proper cd check (opt) ( Q ready && pushing )
                {
                    worthCasting.Add(0);
                    continue;
                }
                worth = 0;
                if (enemy.ObjectType == GameObjectType.AIHeroClient)
                {
                    worth += 2;
                }
                else
                {
                    if (enemy.Health < E.GetDamage(enemy) || (Pushing && Calculation.isPoisonned(enemy)))
                    {
                        worth += 1;
                    }
                }
                if (enemy == TStarget)
                {
                    worth += 1;
                }
                worthCasting.Add(worth);
            }
            int i = 0;

            if (worthCasting.Max() == 0)
            {
                return;
            }
            foreach (var enemy in enemies)
            {
                if (worthCasting[i] == worthCasting.Max())
                {
                    E.Cast(enemy);
                }
                i += 1;
            }
        }