Britbot

This method checks if this enemy group could be approaching the given island first checks if it moves in the general direction of the island compares difference in trajectory to a MAGIC constant.

Parameters:
sIslandthe island we check
Returns:
true if it is possible that the enemy is approching the island

Definition at line 473 of file EnemyGroup.cs.

        {
            //if the group is stationary just check if it is close
            if (this.GetHeading().NormSquared() <= 2)
            {
                return Bot.Game.EuclidianDistanceSquared(this.GetLocation(), sIsland.Loc) <=
                       Magic.ApproachDistanceSquaredOfStationaryTarget;
            }
            //check if the enemy group is on the island
            if (this.MinimalSquaredDistanceTo(sIsland.Loc) < 20)
                return true;

            //calculate the difference vector between the enemy group and the island
            HeadingVector difference = HeadingVector.CalcDifference(this.GetLocation(), sIsland.Loc);

            //check if it isn't moving in the general direction of the island, if so return false
            if (difference * this.GetHeading() <= 0)
            {
                return false;
            }
            //read the distance between the trajectory of the enemy group and the island
            double distance = Navigator.CalcDistFromLine(sIsland.Loc, this.GetLocation(), this.GetHeading());
            /*Logger.Write("Loc " + sIsland.Loc + " line loc: " + this.GetLocation().ToString() + " heading: " + this.GetHeading().ToString());
            Logger.Write("Distance: " + distance);*/
            //compare it to the constant defined in magic
            return distance <= Magic.EnemyPredictionSensitivity;
        }