- small change to ch58 for change facing, so now will first try to turn to last target if exist then to closest enemy.

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@6404 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Kriplo
2013-09-15 18:45:45 +00:00
parent d24b54cb5a
commit 569eba300a
+6 -2
View File
@@ -5182,7 +5182,7 @@ INT16 ubMinAPCost;
if ( (INT32) PreRandom( 100 ) < iChance)
{
BestAttack.ubAPCost += ubBurstAPs + sActualAimTime;//dnl??? ch58 130913
BestAttack.ubAPCost += ubBurstAPs + sActualAimTime;//dnl ch58 130913
// check for spread burst possibilities
if (pSoldier->aiData.bAttitude != ATTACKSLAYONLY)
{
@@ -5690,8 +5690,10 @@ L_NEWAIM:
#endif
//ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_TESTVERSION, L"AI %d taking cover, morale %d, from %d to %d", pSoldier->ubID, pSoldier->aiData.bAIMorale, pSoldier->sGridNo, sBestCover );
pSoldier->aiData.usActionData = sBestCover;
if(!TileIsOutOfBounds(sClosestOpponent))//dnl ch58 160813 After taking cover change facing toward closest enemy, currently such turn not charge APs and seems because AI is still in moving animation from take cover action
if(!TileIsOutOfBounds(sClosestOpponent))//dnl ch58 150913 After taking cover change facing toward recent target or closest enemy, currently such turn not charge APs and seems because AI is still in moving animation from take cover action
{
if(!TileIsOutOfBounds(pSoldier->sLastTarget))
sClosestOpponent = pSoldier->sLastTarget;
pSoldier->aiData.bNextAction = AI_ACTION_CHANGE_FACING;
pSoldier->aiData.usNextActionData = atan8(CenterX(sBestCover),CenterY(sBestCover),CenterX(sClosestOpponent),CenterY(sClosestOpponent));
}
@@ -5845,6 +5847,8 @@ L_NEWAIM:
// if we have a closest reachable opponent
if (!TileIsOutOfBounds(sClosestOpponent))
{
if(!TileIsOutOfBounds(pSoldier->sLastTarget))//dnl ch58 150913
sClosestOpponent = pSoldier->sLastTarget;
bDirection = atan8(CenterX(pSoldier->sGridNo),CenterY(pSoldier->sGridNo),CenterX(sClosestOpponent),CenterY(sClosestOpponent));
// if we're not facing towards him