Brief: //dnl ch62

- Ignore firing into dying and breathless targets.
Details:
- AI will ignore attack breathless targets if there are other in better condition.
- AI will not fire into dying targets.
- AI should avoid go into creature gas.


git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@6314 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Kriplo
2013-08-25 08:40:36 +00:00
parent f06df7741f
commit 638de03d8d
2 changed files with 10 additions and 2 deletions
+3 -2
View File
@@ -1940,9 +1940,10 @@ BOOLEAN InGas( SOLDIERTYPE *pSoldier, INT32 sGridNo )
{ {
return(TRUE); return(TRUE);
} }
if ( gpWorldLevelData[iNeighbourGridNo].ubExtFlags[pSoldier->pathing.bLevel] & MAPELEMENT_EXT_BURNABLEGAS ) // fire/creature gas
if(gpWorldLevelData[iNeighbourGridNo].ubExtFlags[pSoldier->pathing.bLevel] & (MAPELEMENT_EXT_BURNABLEGAS|MAPELEMENT_EXT_CREATUREGAS))//dnl ch62 240813
{ {
return( TRUE ); return(TRUE);
} }
} }
} }
+7
View File
@@ -470,6 +470,10 @@ void CalcBestShot(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestShot, BOOLEAN shootUns
// OK, how does our chance to hit him compare to the previous best one? // OK, how does our chance to hit him compare to the previous best one?
iPercentBetter = ((ubChanceToReallyHit * 100) / pBestShot->ubChanceToReallyHit) - 100; iPercentBetter = ((ubChanceToReallyHit * 100) / pBestShot->ubChanceToReallyHit) - 100;
//dnl ch62 180813 ignore firing into breathless targets if there are targets in better condition
if((Menptr[pBestShot->ubOpponent].bCollapsed || Menptr[pBestShot->ubOpponent].bBreathCollapsed) && Menptr[pBestShot->ubOpponent].bBreath < OKBREATH && Menptr[pBestShot->ubOpponent].bBreath < pOpponent->bBreath)
iPercentBetter = PERCENT_TO_IGNORE_THREAT;
// if this chance to really hit is more than 50% worse, and the other // if this chance to really hit is more than 50% worse, and the other
// guy is conscious at all // guy is conscious at all
if ((iPercentBetter < -PERCENT_TO_IGNORE_THREAT) && (Menptr[pBestShot->ubOpponent].stats.bLife >= OKLIFE)) if ((iPercentBetter < -PERCENT_TO_IGNORE_THREAT) && (Menptr[pBestShot->ubOpponent].stats.bLife >= OKLIFE))
@@ -485,6 +489,9 @@ void CalcBestShot(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestShot, BOOLEAN shootUns
continue; // next opponent continue; // next opponent
} }
} }
//dnl ch62 180813 ignore firing into dying targets
if((pOpponent->bCollapsed || pOpponent->bBreathCollapsed) && pOpponent->stats.bLife < OKLIFE/* && !(pSoldier->aiData.bAttitude == AGGRESSIVE && Random(100) < 20)*/)
continue;
// OOOF! That was a lot of work! But we've got a new best target! // OOOF! That was a lot of work! But we've got a new best target!
pBestShot->ubPossible = TRUE; pBestShot->ubPossible = TRUE;