ASD: don't change reinforcement pool when unlimited reinforcements enabled.

Interrogate prisoner: don't change reinforcement pool when unlimited reinforcements enabled.
EvaluateQueenSituation:
- allow recruiting when pool size drops below iQueenPoolIncrementPerDifficultyLevel, this should result in more stable strategic AI behavior
- with default values, recruiting can result in up to 8 days of doing nothing, I think that skipping once cycle of decisions should be enough

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8787 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Sevenfm
2020-04-20 16:43:14 +00:00
parent 2f576684ac
commit 8051e9b064
3 changed files with 18 additions and 13 deletions
+6 -4
View File
@@ -56,8 +56,8 @@
extern INT32 giReinforcementPool;
extern BOOLEAN gfTacticalDoHeliRun;
extern BOOLEAN gfUnlimitedTroops;
// Arulco special division decision code
@@ -488,11 +488,13 @@ void ASDDecideHeliOperations()
{
// attack this sector!
heli.SetHeliFlightPath( (*it).first );
heli.troopcount = gEnemyHeliMaxTroops;
giReinforcementPool -= gEnemyHeliMaxTroops;
heli.flagmask |= ENEMYHELI_ORDER_DROPTROOPS;
// sevenfm: don't change reinforcement pool when unlimited reinforcements enabled
if (!gfUnlimitedTroops)
giReinforcementPool -= gEnemyHeliMaxTroops;
heli.flagmask |= ENEMYHELI_ORDER_DROPTROOPS;
AddStrategicEvent( EVENT_ENEMY_HELI_UPDATE, GetWorldTotalMin( ) + gEnemyHeliTravelTimePerSector, id );
break;
+5 -1
View File
@@ -105,6 +105,8 @@ class SOLDIERTYPE;
// Flugente: external sector data
extern SECTOR_EXT_DATA SectorExternalData[256][4];
// sevenfm
extern BOOLEAN gfUnlimitedTroops;
// various reason an assignment can be aborted before completion
enum{
@@ -7824,7 +7826,9 @@ void Interrogateprisoner(UINT8 aPrisonerType, FLOAT aChanceModifier, INT8& arMil
// there is a chance that freed prisoners may return to the queen...
if ( arMilitiaType < 0 && aPrisonerType != PRISONER_CIVILIAN && Chance( gGameExternalOptions.ubPrisonerReturntoQueenChance ) )
{
++giReinforcementPool;
// sevenfm: don't change reinforcement pool when unlimited reinforcements enabled
if (!gfUnlimitedTroops)
++giReinforcementPool;
}
}
+7 -8
View File
@@ -3431,7 +3431,7 @@ void EvaluateQueenSituation()
uiOffset = max( 100 - giRequestPoints, 0);
uiOffset = uiOffset + Random( uiOffset * 4 );
// Flugente: enemy generals can speed up the AI decision process (justification: the generals are the ones planning the military operations, so if theay are around, the army is more efficient)
// Flugente: enemy generals can speed up the AI decision process (justification: the generals are the ones planning the military operations, so if they are around, the army is more efficient)
FLOAT dEnemyGeneralsSpeedupFactor = 1.0f;
if ( gGameExternalOptions.fEnemyRoles && gGameExternalOptions.fEnemyGenerals )
{
@@ -3440,14 +3440,13 @@ void EvaluateQueenSituation()
uiOffset += dEnemyGeneralsSpeedupFactor * (zDiffSetting[gGameOptions.ubDifficultyLevel].iBaseDelayInMinutesBetweenEvaluations + Random( zDiffSetting[gGameOptions.ubDifficultyLevel].iEvaluationDelayVariance ));
if( !giReinforcementPool )
// sevenfm: allow recruiting when pool size drops below iQueenPoolIncrementPerDifficultyLevel, this should result in more stable strategic AI behavior
if (giReinforcementPool <= 0 || !gfUnlimitedTroops && giReinforcementPool < zDiffSetting[gGameOptions.ubDifficultyLevel].iQueenPoolIncrementPerDifficultyLevel)
{
//Queen has run out of reinforcements. Simulate recruiting and training new troops
uiOffset *= 10;
//Madd: don't need an unlimited troops check here, since they can never run out like this
giReinforcementPool += ( zDiffSetting[gGameOptions.ubDifficultyLevel].iQueenPoolIncrementPerDifficultyLevel * gGameOptions.ubDifficultyLevel ) * ( 100 + CurrentPlayerProgressPercentage() ) / 100 ;
//Queen has run out of reinforcements. Simulate recruiting and training new troops
// sevenfm: with default values, it can be up to 8 days of doing nothing, I think that skipping once cycle of decisions should be enough
//uiOffset *= 10;
giReinforcementPool += ( zDiffSetting[gGameOptions.ubDifficultyLevel].iQueenPoolIncrementPerDifficultyLevel * gGameOptions.ubDifficultyLevel ) * ( 100 + CurrentPlayerProgressPercentage() ) / 100 ;
AddStrategicEvent( EVENT_EVALUATE_QUEEN_SITUATION, GetWorldTotalMin() + uiOffset, 0 );
return;
}