Esempio n. 1
0
 public ConditionalItem(ItemId pri, ItemId sec = ItemId.Unknown, ItemCondition cond = ItemCondition.TAKE_PRIMARY)
 {
     primary   = AutoShop.getData((int)pri);
     secondary = (sec == ItemId.Unknown) ? null : AutoShop.getData((int)sec);
     condition = cond;
 }
Esempio n. 2
0
        public FullItem getBest()
        {
            if (selected != null)
            {
                return(selected);
            }
            if (condition == ItemCondition.TAKE_PRIMARY)
            {
                selected = primary;
            }
            if (condition == ItemCondition.ENEMY_MR)
            {
                if (HeroManager.Enemies.Sum(ene => ene.SpellBlock) > HeroManager.Enemies.Sum(ene => ene.Armor))
                {
                    selected = primary;
                }
                else
                {
                    selected = secondary;
                }
            }

            if (condition == ItemCondition.ENEMY_RANGED)
            {
                if (HeroManager.Enemies.Count(ene => ene.IsRanged) > HeroManager.Enemies.Count(ene => ene.IsMelee))
                {
                    selected = primary;
                }
                else
                {
                    selected = secondary;
                }
            }

            if (condition == ItemCondition.ENEMY_AP)
            {
                if (HeroManager.Enemies.Sum(ene => ene.FlatMagicDamageMod) > HeroManager.Enemies.Sum(ene => ene.FlatPhysicalDamageMod) * 2.0f)
                {
                    selected = primary;
                }
                else
                {
                    selected = secondary;
                }
            }
            if (condition == ItemCondition.ENEMY_LOSING)
            {
                var allTowers = ObjectManager.Get <Obj_AI_Turret>().ToList();
                if (allTowers.Count(tow => tow.IsDead && tow.IsEnemy) > allTowers.Count(tow => tow.IsDead && tow.IsAlly))
                {
                    selected = primary;
                }
                else
                {
                    selected = secondary;
                }
            }


            return(selected);
        }
Esempio n. 3
0
 public ConditionalItem(int pri, int sec = -1, ItemCondition cond = ItemCondition.TAKE_PRIMARY)
 {
     primary   = AutoShop.getData(pri);
     secondary = (sec == -1) ? null : AutoShop.getData(sec);
     condition = cond;
 }