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; }
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); }
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; }