[*] Some more checks for AI pathfinder
This commit is contained in:
parent
cfbfca0cd4
commit
bbb48a8bb8
1 changed files with 3 additions and 2 deletions
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue