AI flanking:

- avoid moving too far from noise spot, except for CUNNINGSOLO
- avoid moving too close to enemy vision range

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@9167 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Sevenfm
2021-09-23 18:20:49 +00:00
parent 999fc8ac96
commit 95a810e382
+10 -4
View File
@@ -2773,19 +2773,25 @@ INT32 FindFlankingSpot(SOLDIERTYPE *pSoldier, INT32 sPos, INT8 bAction )
} }
// sevenfm: penalize locations too far from noise gridno // sevenfm: penalize locations too far from noise gridno
if (PythSpacesAway(sGridNo, sPos) > MAX_FLANK_DIST_RED) if (PythSpacesAway(sGridNo, sPos) > MAX_FLANK_DIST_RED - 5)
{ {
sTempDist = sTempDist / 2; sTempDist = sTempDist / 2;
} }
// sevenfm: try to flank closer to vision distance limit for faster flanking // avoid moving too far from noise gridno
if (PythSpacesAway(sGridNo, sPos) > sDistanceVisible + 10) if (PythSpacesAway(sGridNo, sPos) > MAX_FLANK_DIST_RED && pSoldier->aiData.bAttitude != CUNNINGSOLO)
{
continue;
}
// sevenfm: avoid moving too close to enemy vision range
if (PythSpacesAway(sGridNo, sPos) < sDistanceVisible + 5)
{ {
sTempDist = sTempDist / 2; sTempDist = sTempDist / 2;
} }
// sevenfm: penalize locations with no sight cover from noise gridno (supposed that we are sneaking) // sevenfm: penalize locations with no sight cover from noise gridno (supposed that we are sneaking)
if( //PythSpacesAway( sGridNo, sPos) <= sDistanceVisible && if( PythSpacesAway( sGridNo, sPos) <= (INT16)MAX_VISION_RANGE &&
LocationToLocationLineOfSightTest( sGridNo, pSoldier->pathing.bLevel, sPos, pSoldier->pathing.bLevel, TRUE, CALC_FROM_ALL_DIRS) ) LocationToLocationLineOfSightTest( sGridNo, pSoldier->pathing.bLevel, sPos, pSoldier->pathing.bLevel, TRUE, CALC_FROM_ALL_DIRS) )
{ {
//continue; //continue;