Beispiel #1
0
        public static void UpdateDamage(Hero[] enemyHeroes, Hero[] allyHeroes)
        {
            if (!Utils.SleepCheck("GankDamage.Update"))
            {
                return;
            }
            if (!OnUpdateChecks.CanUpdate() || !MainMenu.GankDamageMenu.Item("enableGankDamage").GetValue<bool>())
            {
                return;
            }
            enemies = enemyHeroes;
            allies = allyHeroes;
            Utils.Sleep(1000, "GankDamage.Update");
            if (MainMenu.GankDamageMenu.Item("enableGankDamageEnemies").GetValue<bool>())
            {
                foreach (var enemyHero in enemyHeroes)
                {
                    var hero = enemyHero;
                    var heroName = NameManager.Name(hero);
                    if (!IncomingDamages.ContainsKey(heroName))
                    {
                        IncomingDamages.Add(heroName, 0);
                    }
                    var tempDmg = 0f;
                    foreach (
                        var allyHero in
                            allyHeroes.Where(
                                x =>
                                AllyHeroes.AbilityDictionary.ContainsKey(NameManager.Name(x))
                                && AllyHeroes.ItemDictionary.ContainsKey(NameManager.Name(x))
                                && x.Distance2D(hero) < 1700))
                    {
                        var abilities = AllyHeroes.AbilityDictionary[NameManager.Name(allyHero)];
                        var items = AllyHeroes.ItemDictionary[NameManager.Name(allyHero)].Where(x => x.IsValid).ToList();
                        var list = new List<Ability>(abilities.Count + items.Count);
                        list.AddRange(abilities);
                        list.AddRange(items);
                        tempDmg +=
                            list.Where(x => x.CanBeCasted())
                                .Sum(ability => AbilityDamage.CalculateDamage(ability, allyHero, hero));
                    }
                    IncomingDamages[heroName] = tempDmg;
                }
            }

            if (!MainMenu.GankDamageMenu.Item("enableGankDamageAllies").GetValue<bool>())
            {
                return;
            }
            foreach (var allyHero in allyHeroes)
            {
                var hero = allyHero;
                var heroName = NameManager.Name(hero);
                if (!IncomingDamages.ContainsKey(heroName))
                {
                    IncomingDamages.Add(heroName, 0);
                }
                var tempDmg = 0f;
                foreach (
                    var enemyHero in
                        enemyHeroes.Where(
                            x =>
                            EnemyHeroes.AbilityDictionary.ContainsKey(NameManager.Name(x))
                            && EnemyHeroes.ItemDictionary.ContainsKey(NameManager.Name(x)) && x.Distance2D(hero) < 1700)
                    )
                {
                    var abilities = EnemyHeroes.AbilityDictionary[NameManager.Name(enemyHero)];
                    var items = EnemyHeroes.ItemDictionary[NameManager.Name(enemyHero)].Where(x => x.IsValid).ToList();
                    var list = new List<Ability>(abilities.Count + items.Count);
                    list.AddRange(abilities);
                    list.AddRange(items);
                    tempDmg +=
                        list.Where(x => x.CanBeCasted())
                            .Sum(ability => AbilityDamage.CalculateDamage(ability, enemyHero, hero));
                }
                IncomingDamages[heroName] = tempDmg;
            }
        }