[*] Some more checks for AI pathfinder

This commit is contained in:
cybermind 2015-02-19 23:00:57 +05:00
parent cfbfca0cd4
commit bbb48a8bb8

View file

@ -543,8 +543,9 @@ static int CostMoveToCallBack_Default(unsigned int index, const CUnit &unit)
} else {
// for non moving unit Always Fail unless goal is unit, or unit can attack the target
if (&unit != goal) {
if (goal->Player->IsEnemy(unit) && unit.IsAgressive() && CanTarget(*unit.Type, *goal->Type)) {
cost += 2 * AStarMovingUnitCrossingCost;
if (goal->Player->IsEnemy(unit) && unit.IsAgressive() && CanTarget(*unit.Type, *goal->Type)
&& goal->Variable[UNHOLYARMOR_INDEX].Value == 0 && goal->IsVisibleAsGoal(*unit.Player)) {
cost += 2 * AStarMovingUnitCrossingCost;
} else {
// FIXME: Need support for moving a fixed unit to add cost
return -1;