Пример #1
0
        public static void ApplyFireground(Fireground ability)
        {
            KeyValuePair <ushort, Hero>[] enemyheroes = heroes.Where(f => f.Value.GetFaction() != ability.GetFaction() && !f.Value.IsDead()).ToArray();
            foreach (KeyValuePair <ushort, Hero> enemy in enemyheroes)
            {
                if (ServerMath.Distance(ability, enemy.Value) <= 0)
                {
                    ability.Attack(enemy.Value, 5);
                }
            }

            KeyValuePair <ushort, Minion>[] enemyminions = minions.Where(f => f.Value.GetFaction() != ability.GetFaction() && !f.Value.IsDead()).ToArray();
            foreach (KeyValuePair <ushort, Minion> enemy in enemyminions)
            {
                if (ServerMath.Distance(ability, enemy.Value) <= 0)
                {
                    ability.Attack(enemy.Value, 5);
                }
            }

            foreach (KeyValuePair <ushort, Monster> enemy in monsters)
            {
                if (!enemy.Value.IsDead())
                {
                    if (ServerMath.Distance(ability, enemy.Value) <= 0)
                    {
                        ability.Attack(enemy.Value, 5);
                    }
                }
            }
        }
Пример #2
0
        public static bool ApplyFireball(Fireball ability)
        {
            KeyValuePair <ushort, Hero>[] enemyheroes = heroes.Where(f => f.Value.GetFaction() != ability.GetFaction() && !f.Value.IsDead()).ToArray();
            foreach (KeyValuePair <ushort, Hero> enemy in enemyheroes)
            {
                if (ServerMath.Distance(ability, enemy.Value) <= 0)
                {
                    ability.Attack(enemy.Value, 180);
                    return(true);
                }
            }

            return(false);
        }
Пример #3
0
        public static ServerSideObject GetNearMinionsHeroes(ServerSideObject tower, float attackRange)
        {
            ServerSideObject ret         = null;
            float            mindistance = float.MaxValue;

            foreach (KeyValuePair <ushort, Minion> minion in minions)
            {
                if (!minion.Value.IsDead() && minion.Value.GetFaction() != tower.GetFaction())
                {
                    float distance = ServerMath.Distance(tower, minion.Value);
                    if (distance <= attackRange && distance < mindistance)
                    {
                        ret         = minion.Value;
                        mindistance = distance;
                    }
                }
            }

            if (ret != null)
            {
                return(ret);
            }

            foreach (KeyValuePair <ushort, Hero> hero in heroes)
            {
                if (!hero.Value.IsDead() && hero.Value.GetFaction() != tower.GetFaction())
                {
                    float distance = ServerMath.Distance(tower, hero.Value);
                    if (distance <= attackRange && distance < mindistance)
                    {
                        ret         = hero.Value;
                        mindistance = distance;
                    }
                }
            }

            return(ret);
        }
Пример #4
0
        public static ServerSideObject GetNearMinionsCoresTowersHeroes(ServerSideObject myminion, float attackRange)
        {
            ServerSideObject ret         = null;
            float            mindistance = float.MaxValue;

            foreach (KeyValuePair <ushort, Minion> minion in minions)
            {
                if (!minion.Value.IsDead() && minion.Value.GetFaction() != myminion.GetFaction())
                {
                    float distance = ServerMath.Distance(myminion, minion.Value);
                    if (distance <= attackRange && distance < mindistance)
                    {
                        ret         = minion.Value;
                        mindistance = distance;
                    }
                }
            }

            if (ret != null)
            {
                return(ret);
            }

            foreach (KeyValuePair <ushort, Core> core in cores)
            {
                if (!core.Value.IsDead() && core.Value.GetFaction() != myminion.GetFaction())
                {
                    float distance = ServerMath.Distance(myminion, core.Value);
                    if (distance <= attackRange && distance < mindistance)
                    {
                        ret         = core.Value;
                        mindistance = distance;
                    }
                }
            }

            if (ret != null)
            {
                return(ret);
            }

            foreach (KeyValuePair <ushort, Tower> tower in towers)
            {
                if (!tower.Value.IsDead() && tower.Value.GetFaction() != myminion.GetFaction())
                {
                    float distance = ServerMath.Distance(myminion, tower.Value);
                    if (distance <= attackRange && distance < mindistance)
                    {
                        ret         = tower.Value;
                        mindistance = distance;
                    }
                }
            }

            if (ret != null)
            {
                return(ret);
            }

            foreach (KeyValuePair <ushort, Hero> hero in heroes)
            {
                if (!hero.Value.IsDead() && hero.Value.GetFaction() != myminion.GetFaction())
                {
                    float distance = ServerMath.Distance(myminion, hero.Value);
                    if (distance <= attackRange && distance < mindistance)
                    {
                        ret         = hero.Value;
                        mindistance = distance;
                    }
                }
            }

            return(ret);
        }