mirror of
https://github.com/1dot13/source.git
synced 2026-08-12 14:10:23 +02:00
Increased max possible soldiers stored for friendly fire check to 256.
Friendly fire chance code also checks for soldiers of the same side and optionally neutral civilians. CalcCoverValue: check friendly fire chance for each position, penalize position if friendly fire chance is high (needs AI_BETTER_COVER = TRUE) UnderFire::Add: - store friendly fire CTH for new added person - use max value when replacing friendly fire CTH for existing person CalcBestShot: - check CTGT and friendly fire chance for every stance - ignore possible shot if can hit friends in this stance CalcMoraleNew: improved code to make enemy slightly more aggressive. git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8873 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
@@ -306,6 +306,7 @@ INT32 CalcCoverValue(SOLDIERTYPE *pMe, INT32 sMyGridNo, INT32 iMyThreat, INT32 i
|
||||
// sevenfm
|
||||
bHisLevel = pHim->pathing.bLevel;
|
||||
bMyLevel = pMe->pathing.bLevel;
|
||||
UINT8 ubFriendlyFireChance = 0;
|
||||
|
||||
// THE FOLLOWING STUFF IS *VEERRRY SCAARRRY*, BUT SHOULD WORK. IF YOU REALLY
|
||||
// HATE IT, THEN CHANGE ChanceToGetThrough() TO WORK FROM A GRIDNO TO GRIDNO
|
||||
@@ -394,9 +395,20 @@ INT32 CalcCoverValue(SOLDIERTYPE *pMe, INT32 sMyGridNo, INT32 iMyThreat, INT32 i
|
||||
pHim->dYPos = (FLOAT) sTempY;
|
||||
}
|
||||
|
||||
// sevenfm: also check friendly fire chance for each position
|
||||
gUnderFire.Clear();
|
||||
gUnderFire.Enable();
|
||||
// let's not assume anything about the stance the enemy might take, so take an average
|
||||
// value... no cover give a higher value than partial cover
|
||||
bMyCTGT = CalcAverageCTGTForPosition( pMe, pHim->ubID, sHisGridNo, pHim->pathing.bLevel, iMyAPsLeft );
|
||||
gUnderFire.Disable();
|
||||
|
||||
// sevenfm: penalize position if friendly fire chance is high
|
||||
if (gGameExternalOptions.fAIBetterCover && ubFriendlyFireChance > MIN_CHANCE_TO_ACCIDENTALLY_HIT_SOMEONE)
|
||||
{
|
||||
ubFriendlyFireChance = gUnderFire.Chance(pMe->bTeam, pMe->bSide, TRUE);
|
||||
bMyCTGT = 1;
|
||||
}
|
||||
|
||||
// since NPCs are too dumb to shoot "blind", ie. at opponents that they
|
||||
// themselves can't see (mercs can, using another as a spotter!), if the
|
||||
|
||||
Reference in New Issue
Block a user