Use TACTICAL_RANGE instead of DAY_VISION_RANGE for AI calculations.

Implemented Black cover advance code for AI: try to get closer to enemy using cover if soldier has low CTH or enemy too far for shooting or soldier has high morale or no cover at spot.

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8931 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Sevenfm
2021-02-11 19:11:54 +00:00
parent 02cba3e1e5
commit 18dcced82a
5 changed files with 195 additions and 39 deletions
+4 -4
View File
@@ -691,8 +691,8 @@ INT8 ZombieDecideActionRed(SOLDIERTYPE *pSoldier)
// sevenfm: try to advance using sight cover
if( gfTurnBasedAI &&
PythSpacesAway(pSoldier->sGridNo, sClosestDisturbance) < DAY_VISION_RANGE * 2 &&
PythSpacesAway(pSoldier->sGridNo, sClosestDisturbance) > DAY_VISION_RANGE / 4 &&
PythSpacesAway(pSoldier->sGridNo, sClosestDisturbance) < TACTICAL_RANGE * 2 &&
PythSpacesAway(pSoldier->sGridNo, sClosestDisturbance) > TACTICAL_RANGE / 4 &&
!SightCoverAtSpot(pSoldier, pSoldier->aiData.usActionData, TRUE))
{
INT32 sAdvanceSpot = FindAdvanceSpot(pSoldier, sClosestDisturbance, AI_ACTION_SEEK_OPPONENT, ADVANCE_SPOT_SIGHT_COVER, TRUE);
@@ -1169,8 +1169,8 @@ INT8 ZombieDecideActionBlack(SOLDIERTYPE *pSoldier)
{
// sevenfm: try to advance using sight cover
if( gfTurnBasedAI &&
PythSpacesAway(pSoldier->sGridNo, sClosestDisturbance) < DAY_VISION_RANGE * 2 &&
PythSpacesAway(pSoldier->sGridNo, sClosestDisturbance) > DAY_VISION_RANGE / 4 &&
PythSpacesAway(pSoldier->sGridNo, sClosestDisturbance) < TACTICAL_RANGE * 2 &&
PythSpacesAway(pSoldier->sGridNo, sClosestDisturbance) > TACTICAL_RANGE / 4 &&
!SightCoverAtSpot(pSoldier, pSoldier->aiData.usActionData, TRUE))
{
DebugAI( AI_MSG_INFO, pSoldier, String("[advance spot]"));