|
Britbot
|
This method calculates if you would be able to reach an enemy group or it would run away.
Definition at line 211 of file Navigator.cs. {
//if the target is stationary then return true
if (targetHeading.Norm() == 0)
return true;
//first check if it is running away (its direction is about the same as the difference between you
if (HeadingVector.CalcDifference(group, target) * targetHeading > 0)
return false;
//----------------------calculation of naive maximum intersection----------------------
HeadingVector diffVector = HeadingVector.CalcDifference(target, group);
double cosAlpha = diffVector.Normalize() * targetHeading.Normalize();
double sacleCoeff = diffVector.Norm() * cosAlpha;
Location maxIntersection = HeadingVector.AddvanceByVector(target, sacleCoeff * targetHeading.Normalize());
//----------------------------------------------------------------------------------------
//to account for numeric mistakes we take antitolerance coefficient
const int antiToleranceCoeff = 2;
//compare distances
//check who is closer
if (Bot.Game.Distance(group, maxIntersection) <
Bot.Game.Distance(target, maxIntersection) - antiToleranceCoeff)
return true;
return false;
}
|
1.7.6.1