mirror of
https://github.com/1dot13/source.git
synced 2026-08-05 14:00:23 +02:00
-fixed guns being chosen from too high a level in "Normal Guns" mode
-fixed AI not firing guns when able - this should reduce the amount of running back and forth and also the running up to your guys and crouching git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@332 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
@@ -4026,19 +4026,23 @@ bCanAttack = FALSE;
|
||||
{
|
||||
case AI_ACTION_FIRE_GUN:
|
||||
memcpy(&BestAttack,&BestShot,sizeof(BestAttack));
|
||||
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"DecideActionBlack: best attack = firing a gun");
|
||||
break;
|
||||
|
||||
case AI_ACTION_TOSS_PROJECTILE:
|
||||
memcpy(&BestAttack,&BestThrow,sizeof(BestAttack));
|
||||
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"DecideActionBlack: best attack = tossing a grenade");
|
||||
break;
|
||||
|
||||
case AI_ACTION_THROW_KNIFE:
|
||||
case AI_ACTION_KNIFE_MOVE:
|
||||
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"DecideActionBlack: best attack = stab with a knife");
|
||||
memcpy(&BestAttack,&BestStab,sizeof(BestAttack));
|
||||
break;
|
||||
|
||||
default:
|
||||
// set to empty
|
||||
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"DecideActionBlack: best attack = no good attack");
|
||||
memset( &BestAttack, 0, sizeof( BestAttack ) );
|
||||
break;
|
||||
}
|
||||
@@ -4060,6 +4064,7 @@ bCanAttack = FALSE;
|
||||
fAllowCoverCheck = TRUE;
|
||||
if ( PreRandom( 10 ) > BestAttack.ubChanceToReallyHit )
|
||||
{
|
||||
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"DecideActionBlack: can't hit so screw the attack");
|
||||
// screw the attack!
|
||||
ubBestAttackAction = AI_ACTION_NONE;
|
||||
}
|
||||
@@ -4090,6 +4095,7 @@ bCanAttack = FALSE;
|
||||
sBestCover = NOWHERE;
|
||||
#endif
|
||||
|
||||
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"DecideActionBlack: DECIDE BETWEEN ATTACKING AND DEFENDING (TAKING COVER)");
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// IF NECESSARY, DECIDE BETWEEN ATTACKING AND DEFENDING (TAKING COVER)
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
@@ -4155,15 +4161,19 @@ bCanAttack = FALSE;
|
||||
DebugAI( tempstr );
|
||||
#endif
|
||||
|
||||
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"DecideActionBlack: if his defensive instincts win out, forget all about the attack");
|
||||
// if his defensive instincts win out, forget all about the attack
|
||||
if (iDefense > iOffense)
|
||||
ubBestAttackAction = AI_ACTION_NONE;
|
||||
}
|
||||
|
||||
|
||||
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("DecideActionBlack: is attack still desirable? ubBestAttackAction = %d",ubBestAttackAction));
|
||||
|
||||
// if attack is still desirable (meaning it's also preferred to taking cover)
|
||||
if (ubBestAttackAction != AI_ACTION_NONE)
|
||||
{
|
||||
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"DecideActionBlack: attack is still desirable (meaning it's also preferred to taking cover)");
|
||||
// if we wanted to be REALLY mean, we could look at chance to hit and decide whether
|
||||
// to shoot at the head...
|
||||
|
||||
@@ -4254,6 +4264,7 @@ bCanAttack = FALSE;
|
||||
pSoldier->inv[BestAttack.bWeaponIn].ubGunShotsLeft > 1 &&
|
||||
(pSoldier->bTeam != gbPlayerNum || pSoldier->bRTPCombat == RTP_COMBAT_AGGRESSIVE) )
|
||||
{
|
||||
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"DecideActionBlack: ENOUGH APs TO BURST, RANDOM CHANCE OF DOING SO");
|
||||
|
||||
ubBurstAPs = CalcAPsToBurst( CalcActionPoints( pSoldier ), &(pSoldier->inv[BestAttack.bWeaponIn]) );
|
||||
|
||||
@@ -4316,6 +4327,7 @@ bCanAttack = FALSE;
|
||||
(( pSoldier->inv[BestAttack.bWeaponIn].ubGunShotsLeft > 1 &&
|
||||
BestAttack.ubAimTime != BURSTING ) || Weapon[pSoldier->inv[BestAttack.bWeaponIn].usItem].NoSemiAuto) )
|
||||
{
|
||||
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"DecideActionBlack: ENOUGH APs TO AUTOFIRE, RANDOM CHANCE OF DOING SO");
|
||||
pSoldier->bDoAutofire = 0;
|
||||
do
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user