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:
Sevenfm
2020-07-31 10:26:07 +00:00
parent 8e4961f021
commit 6b706f2747
7 changed files with 149 additions and 66 deletions
-1
View File
@@ -285,7 +285,6 @@ static UINT32 guiStructureHitChance[ MAX_DIST_FOR_LESS_THAN_MAX_CHANCE_TO_HIT_ST
#define MIN_DIST_FOR_HIT_FRIENDS 30
#define MIN_DIST_FOR_HIT_FRIENDS_UNAIMED 15
#define MIN_CHANCE_TO_ACCIDENTALLY_HIT_SOMEONE 3
#define RADIANS_IN_CIRCLE 6.283
#define DEGREES_22_5 (RADIANS_IN_CIRCLE * 22.5 / 360)
+1
View File
@@ -26,6 +26,7 @@ typedef INT64 FIXEDPT;
// fixed-point arithmetic definitions end here
#define OK_CHANCE_TO_GET_THROUGH 10
#define MIN_CHANCE_TO_ACCIDENTALLY_HIT_SOMEONE 3
enum CollisionEnums
{
+20 -1
View File
@@ -122,12 +122,12 @@
#include "InterfaceItemImages.h" // added by Sevenfm
#include "DynamicDialogueWidget.h" // added by Flugente for DelayBoxDestructionBy(...)
#include "Utilities.h" // added by Flugente
#include "AIInternals.h" // sevenfm
//forward declarations of common classes to eliminate includes
class OBJECTTYPE;
class SOLDIERTYPE;
extern UIKEYBOARD_HOOK gUIKeyboardHook;
extern BOOLEAN fRightButtonDown;
extern BOOLEAN fLeftButtonDown;
@@ -3373,6 +3373,25 @@ void GetKeyboardInput( UINT32 *puiNewEvent )
//Get the gridno the cursor is at
GetMouseMapPos( &usGridNo );
// code to test friendly fire detection
//if there is a selected soldier, and the cursor location is valid
/*if (gusSelectedSoldier != NOBODY && !TileIsOutOfBounds(usGridNo) && gfUIFullTargetFound)
{
SOLDIERTYPE *pSoldier = MercPtrs[gusSelectedSoldier];
SOLDIERTYPE *pOpponent = MercPtrs[gusUIFullTargetID];
UINT8 ubChanceToGetThrough;
if (pSoldier && pOpponent)
{
gUnderFire.Clear();
gUnderFire.Enable();
ubChanceToGetThrough = AISoldierToSoldierChanceToGetThrough(pSoldier, pOpponent);
gUnderFire.Disable();
ScreenMsg(FONT_ORANGE, MSG_INTERFACE, L"friendly fire chance %d count %d", gUnderFire.Chance(pSoldier->bTeam, pSoldier->bSide, TRUE), gUnderFire.Count(pSoldier->bTeam));
}
}*/
// if the cursor location is valid
if ( !TileIsOutOfBounds(usGridNo) )
{