Britbot
int Britbot.EnemyGroup.MaxFightCount ( ) [inline, private]

Calculates the maximum amount of pirates supporting each other in the enemy formation.

Returns:
The maximum amount of pirates supporting each other in the enemy formation

Definition at line 291 of file EnemyGroup.cs.

        {
            //initialize maximum variable
            int maxFightCount = 0;

            //go over all pirates
            foreach (int pirate in this.EnemyPirates)
            {
                //convert to pirate
                Pirate pete = Bot.Game.GetEnemyPirate(pirate);

                //check if this pirate counts
                if (Bot.Game.isCapturing(pete))
                    continue;
                //count how many pirates are supporting him
                int supportCount = 0;

                //go over all other pirates
                foreach (int otherPirate in this.EnemyPirates)
                {
                    //convert to pirate
                    Pirate otherPete = Bot.Game.GetEnemyPirate(otherPirate);

                    //check if this pirate counts
                    if (Bot.Game.isCapturing(otherPete))
                        continue;

                    //check if in range
                    if (Bot.Game.EuclidianDistanceSquared(pete.Loc, otherPete.Loc) <= Bot.Game.GetAttackRadius())
                        supportCount++;
                }

                //check if the support count is bigger then the maximum
                if (maxFightCount < supportCount)
                    maxFightCount = supportCount;
            }

            //return result
            return maxFightCount;
        }