Britbot
int Britbot.SmartIsland.NearbyEnemyCount ( int  dangerRadius = 15) [inline]

Checks if there are enemies near said Island that will probably attack it.

Returns:
The amount of enemies near the target

Definition at line 247 of file SmartIsland.cs.

        {
            int enemyCount = 0; //amount of enemy pirates in proximity to the Island
            /*int closestIslandDistance = 0; //The distance between this Island and the one nearest too it
            foreach (SmartIsland eIsland in SmartIsland.IslandList)
                //Calculates the distance between this island and the one nearest
            {
                int temp = Bot.Game.Distance(eIsland.Loc, this.Loc);
                if (temp < closestIslandDistance)
                {
                    closestIslandDistance = temp;
                }
            }*/
            foreach (EnemyGroup eGroup in Enemy.Groups)
            {
                double distance = eGroup.MinimalSquaredDistanceTo(this.Loc);
                //Checks if the group of islands is near the island and if they are getting closer or farther
                if (distance <= dangerRadius)
                {
                    //Calculates the sum of pirates in proximity to the island
                    //if distance is 0 then one of the pirates in on the island and we dont need to count it
                    if (distance == 0)
                        enemyCount = enemyCount + eGroup.EnemyPirates.Count - 1;
                    else
                        enemyCount = enemyCount + eGroup.EnemyPirates.Count;
                }
            }

            return enemyCount;
        }