mirror of
https://github.com/1dot13/source.git
synced 2026-07-22 13:40:22 +02:00
Improved AI path tweaks.
FindBestNearbyCover: avoid moving into light if not in light already and not under attack. git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8729 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
+15
-6
@@ -3846,13 +3846,22 @@ if(!GridNoOnVisibleWorldTile(iDestination))
|
||||
if (s->bTeam != gbPlayerNum &&
|
||||
!(s->flags.uiStatusFlags & SOLDIER_BOXER) &&
|
||||
!AreInMeanwhile() &&
|
||||
IS_MERC_BODY_TYPE(s) &&
|
||||
(InGasSpot(s, newLoc, bLevel) ||
|
||||
DeepWater(newLoc, bLevel) && (s->numFlanks == 0 || s->numFlanks >= MAX_FLANKS_RED) ||
|
||||
s->bTeam == ENEMY_TEAM && s->aiData.bAlertStatus >= STATUS_RED && (s->aiData.bAttitude == CUNNINGSOLO || s->aiData.bAttitude == CUNNINGAID || s->aiData.bAIMorale < MORALE_FEARLESS) &&
|
||||
(InLightAtNight(newLoc, bLevel) || GetNearestRottingCorpseAIWarning(newLoc) > 0)))
|
||||
IS_MERC_BODY_TYPE(s))
|
||||
{
|
||||
nextCost += 20;
|
||||
if (InGasSpot(s, newLoc, bLevel) ||
|
||||
DeepWater(newLoc, bLevel) && (s->numFlanks == 0 || s->numFlanks >= MAX_FLANKS_RED))
|
||||
{
|
||||
nextCost += 20;
|
||||
}
|
||||
else if (s->bTeam == ENEMY_TEAM &&
|
||||
s->aiData.bAlertStatus >= STATUS_RED &&
|
||||
(InLightAtNight(newLoc, bLevel) || GetNearestRottingCorpseAIWarning(newLoc) > 0))
|
||||
{
|
||||
if (s->aiData.bAttitude == CUNNINGSOLO || s->aiData.bAttitude == CUNNINGAID || s->aiData.bAIMorale < MORALE_FEARLESS)
|
||||
nextCost += 20;
|
||||
else
|
||||
nextCost += 10;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -1038,6 +1038,14 @@ INT32 FindBestNearbyCover(SOLDIERTYPE *pSoldier, INT32 morale, INT32 *piPercentB
|
||||
continue;
|
||||
}
|
||||
|
||||
// sevenfm: avoid moving into light
|
||||
if (InLightAtNight(sGridNo, pSoldier->pathing.bLevel) &&
|
||||
!InLightAtNight(pSoldier->sGridNo, pSoldier->pathing.bLevel) &&
|
||||
!pSoldier->aiData.bUnderFire)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
iPathCost = gubAIPathCosts[AI_PATHCOST_RADIUS + sXOffset][AI_PATHCOST_RADIUS + sYOffset];
|
||||
/*
|
||||
// water is OK, if the only good hiding place requires us to get wet, OK
|
||||
@@ -2443,7 +2451,6 @@ INT32 FindClosestBoxingRingSpot( SOLDIERTYPE * pSoldier, BOOLEAN fInRing )
|
||||
INT32 iDistance, iClosestDistance = 9999;
|
||||
UINT16 usRoom;
|
||||
SOLDIERTYPE *pDarren;
|
||||
UINT8 ubLoop;
|
||||
pDarren = FindSoldierByProfileID(DARREN, FALSE);
|
||||
|
||||
// set the distance limit of the square region
|
||||
@@ -2455,12 +2462,6 @@ INT32 FindClosestBoxingRingSpot( SOLDIERTYPE * pSoldier, BOOLEAN fInRing )
|
||||
sMaxRight = min( iSearchRange, MAXCOL - ((pSoldier->sGridNo % MAXCOL) + 1));
|
||||
//NumMessage("sMaxRight = ",sMaxRight);
|
||||
|
||||
/*if ( (pSoldier->bTeam == gbPlayerNum) && (fInRing == FALSE) )
|
||||
{
|
||||
// have player not go to the left of the ring
|
||||
sMaxLeft = 0;
|
||||
}*/
|
||||
|
||||
// determine maximum vertical limits
|
||||
sMaxUp = min( iSearchRange, (pSoldier->sGridNo / MAXROW));
|
||||
//NumMessage("sMaxUp = ",sMaxUp);
|
||||
|
||||
Reference in New Issue
Block a user