- Added external parameter CounterAttackGroupSize to DifficultySettings.xml for counter attack strength. This replaces the old hard coded value. Requires GameDir >= 2363!

- Changed counter attack elite soldier distribution to replace regulars just like the rest of the code handles elites.

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8396 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
silversurfer
2017-03-14 17:21:40 +00:00
parent a6b8b559f0
commit dbec9c6ca0
4 changed files with 36 additions and 50 deletions
+2 -1
View File
@@ -16,7 +16,7 @@ enum
DIF_LEVEL_MEDIUM,
DIF_LEVEL_HARD,
DIF_LEVEL_INSANE,
MAX_DIF_LEVEL = 15,
MAX_DIF_LEVEL,
};
typedef struct
@@ -31,6 +31,7 @@ typedef struct
UINT16 iNumKillsPerProgressPoint;
INT32 iInitialGarrisonPercentages;
UINT8 iMinEnemyGroupSize;
UINT8 iCounterAttackGroupSize;
BOOLEAN bUnlimitedPoolOfTroops;
INT32 iQueensInitialPoolOfTroops;
UINT32 iQueenPoolIncrementPerDifficultyLevel;
+9 -9
View File
@@ -15,9 +15,9 @@
#ifdef JA2EDITOR
#ifdef JA2UB
CHAR16 zVersionLabel[256] = { L"Unfinished Business - Map Editor v1.13.8384 (Development Build)" };
CHAR16 zVersionLabel[256] = { L"Unfinished Business - Map Editor v1.13.8396 (Development Build)" };
#else
CHAR16 zVersionLabel[256] = { L"Map Editor v1.13.8384 (Development Build)" };
CHAR16 zVersionLabel[256] = { L"Map Editor v1.13.8396 (Development Build)" };
#endif
// ------------------------------
@@ -27,11 +27,11 @@
//DEBUG BUILD VERSION
#ifdef JA2UB
CHAR16 zVersionLabel[256] = { L"Debug: Unfinished Business - v1.13.8384 (Development Build)" };
CHAR16 zVersionLabel[256] = { L"Debug: Unfinished Business - v1.13.8396 (Development Build)" };
#elif defined (JA113DEMO)
CHAR16 zVersionLabel[256] = { L"Debug: JA2 Demo - v1.13.8384 (Development Build)" };
CHAR16 zVersionLabel[256] = { L"Debug: JA2 Demo - v1.13.8396 (Development Build)" };
#else
CHAR16 zVersionLabel[256] = { L"Debug: v1.13.8384 (Development Build)" };
CHAR16 zVersionLabel[256] = { L"Debug: v1.13.8396 (Development Build)" };
#endif
#elif defined CRIPPLED_VERSION
@@ -46,16 +46,16 @@
//RELEASE BUILD VERSION
#ifdef JA2UB
CHAR16 zVersionLabel[256] = { L"Release Unfinished Business - v1.13.8384 (Development Build)" };
CHAR16 zVersionLabel[256] = { L"Release Unfinished Business - v1.13.8396 (Development Build)" };
#elif defined (JA113DEMO)
CHAR16 zVersionLabel[256] = { L"Release JA2 Demo - v1.13.8384 (Development Build)" };
CHAR16 zVersionLabel[256] = { L"Release JA2 Demo - v1.13.8396 (Development Build)" };
#else
CHAR16 zVersionLabel[256] = { L"Release v1.13.8384 (Development Build)" };
CHAR16 zVersionLabel[256] = { L"Release v1.13.8396 (Development Build)" };
#endif
#endif
CHAR8 czVersionNumber[16] = { "Build 17.01.29" }; //YY.MM.DD
CHAR8 czVersionNumber[16] = { "Build 17.03.14" }; //YY.MM.DD
CHAR16 zTrackingNumber[16] = { L"Z" };
// SAVE_GAME_VERSION is defined in header, change it there
+18 -40
View File
@@ -4556,23 +4556,8 @@ void ExecuteStrategicAIAction( UINT16 usActionCode, INT16 sSectorX, INT16 sSecto
if ( !NumNonPlayerTeamMembersInSector( SECTORX( ubSourceSectorID ), SECTORY( ubSourceSectorID ), ENEMY_TEAM ) )
ubSourceSectorID = SECTOR( gModSettings.ubSAISpawnSectorX, gModSettings.ubSAISpawnSectorY );
UINT8 val;
if( gGameOptions.ubDifficultyLevel == DIF_LEVEL_EASY )
val = 1;
else if( gGameOptions.ubDifficultyLevel == DIF_LEVEL_MEDIUM )
val = 2;
else if( gGameOptions.ubDifficultyLevel == DIF_LEVEL_HARD )
val = 3;
else if( gGameOptions.ubDifficultyLevel == DIF_LEVEL_INSANE )
val = 4;
else
{
val = Random (4);
if (val == 0)
val = 1;
}
ubNumSoldiers = (UINT8)( gubMinEnemyGroupSize + val * 3);
// make sure that we use at least the min group size
ubNumSoldiers = (UINT8)( __max(zDiffSetting[gGameOptions.ubDifficultyLevel].iCounterAttackGroupSize, zDiffSetting[gGameOptions.ubDifficultyLevel].iMinEnemyGroupSize) );
// anv: replace one of soldiers with tank
if ( ubNumSoldiers )
@@ -4584,7 +4569,7 @@ void ExecuteStrategicAIAction( UINT16 usActionCode, INT16 sSectorX, INT16 sSecto
grouptanks[ubCounter] = 0;
groupjeeps[ubCounter] = 0;
if ( Random( 10 ) < val )
if ( Random( 10 ) < gGameOptions.ubDifficultyLevel )
{
if ( gGameExternalOptions.fArmyUsesJeepsInAttacks && ASDSoldierUpgradeToJeep( ) )
{
@@ -4598,8 +4583,12 @@ void ExecuteStrategicAIAction( UINT16 usActionCode, INT16 sSectorX, INT16 sSecto
}
}
if ( val > 0 )
groupelites[ubCounter] = grouptroops[ubCounter] - grouptroops[ubCounter] / val;
// replace some soldiers with elites
if ( gGameOptions.ubDifficultyLevel > 0 )
{
groupelites[ubCounter] = grouptroops[ubCounter] - grouptroops[ubCounter] / gGameOptions.ubDifficultyLevel;
grouptroops[ubCounter] -= groupelites[ubCounter];
}
totalusedsoldiers += grouptroops[ubCounter] + groupelites[ubCounter] + grouptanks[ubCounter] + groupjeeps[ubCounter];
}
@@ -4655,23 +4644,9 @@ void ExecuteStrategicAIAction( UINT16 usActionCode, INT16 sSectorX, INT16 sSecto
break;
}
UINT8 value;
if( gGameOptions.ubDifficultyLevel == DIF_LEVEL_EASY )
value = 1;
else if( gGameOptions.ubDifficultyLevel == DIF_LEVEL_MEDIUM )
value = 2;
else if( gGameOptions.ubDifficultyLevel == DIF_LEVEL_HARD )
value = 3;
else if( gGameOptions.ubDifficultyLevel == DIF_LEVEL_INSANE )
value = 4;
else
{
value = Random (4);
if (value == 0) value = 1;
}
ubNumSoldiers = (UINT8)( gubMinEnemyGroupSize + value * 3);
// make sure that we use at least the min group size
ubNumSoldiers = (UINT8)( __max(zDiffSetting[gGameOptions.ubDifficultyLevel].iCounterAttackGroupSize, zDiffSetting[gGameOptions.ubDifficultyLevel].iMinEnemyGroupSize) );
// anv: replace one of soldiers with tank
for( UINT8 ubCounter = 0; ubCounter < 4; ++ubCounter )
{
@@ -4682,7 +4657,7 @@ void ExecuteStrategicAIAction( UINT16 usActionCode, INT16 sSectorX, INT16 sSecto
if( ubNumSoldiers )
{
if ( Random( 10 ) < value )
if ( Random( 10 ) < gGameOptions.ubDifficultyLevel )
{
if ( gGameExternalOptions.fArmyUsesJeepsInAttacks && ASDSoldierUpgradeToJeep( ) )
{
@@ -4697,8 +4672,11 @@ void ExecuteStrategicAIAction( UINT16 usActionCode, INT16 sSectorX, INT16 sSecto
}
}
if ( value > 0 )
groupelites[ubCounter] = grouptroops[ubCounter] - grouptroops[ubCounter] / value;
if ( gGameOptions.ubDifficultyLevel > 0 )
{
groupelites[ubCounter] = grouptroops[ubCounter] - grouptroops[ubCounter] / gGameOptions.ubDifficultyLevel;
grouptroops[ubCounter] -= groupelites[ubCounter];
}
totalusedsoldiers += grouptroops[ubCounter] + groupelites[ubCounter] + grouptanks[ubCounter] + groupjeeps[ubCounter];
}
+7
View File
@@ -55,6 +55,7 @@ DifficultySettingsParseDataStartElementHandle(void *userData, const XML_Char *na
strcmp(name, "NumKillsPerProgressPoint") == 0 ||
strcmp(name, "InitialGarrisonPercentages") == 0 ||
strcmp(name, "MinEnemyGroupSize") == 0 ||
strcmp(name, "CounterAttackGroupSize") == 0 ||
strcmp(name, "UnlimitedPoolOfTroops") == 0 ||
strcmp(name, "QueensInitialPoolOfTroops") == 0 ||
strcmp(name, "QueenPoolIncrementPerDifficultyLevel") == 0 ||
@@ -161,6 +162,7 @@ difficultySettingsEndElementHandle(void *userData, const XML_Char *name)
zDiffSetting[pData->curDifficultySettings.uiIndex].iNumKillsPerProgressPoint = pData->curDifficultySettings.iNumKillsPerProgressPoint;
zDiffSetting[pData->curDifficultySettings.uiIndex].iInitialGarrisonPercentages = pData->curDifficultySettings.iInitialGarrisonPercentages;
zDiffSetting[pData->curDifficultySettings.uiIndex].iMinEnemyGroupSize = pData->curDifficultySettings.iMinEnemyGroupSize;
zDiffSetting[pData->curDifficultySettings.uiIndex].iCounterAttackGroupSize = pData->curDifficultySettings.iCounterAttackGroupSize;
zDiffSetting[pData->curDifficultySettings.uiIndex].bUnlimitedPoolOfTroops = pData->curDifficultySettings.bUnlimitedPoolOfTroops;
zDiffSetting[pData->curDifficultySettings.uiIndex].iQueensInitialPoolOfTroops = pData->curDifficultySettings.iQueensInitialPoolOfTroops;
zDiffSetting[pData->curDifficultySettings.uiIndex].iQueenPoolIncrementPerDifficultyLevel = pData->curDifficultySettings.iQueenPoolIncrementPerDifficultyLevel;
@@ -286,6 +288,11 @@ difficultySettingsEndElementHandle(void *userData, const XML_Char *name)
pData->curElement = ELEMENT;
pData->curDifficultySettings.iMinEnemyGroupSize = (UINT8) atol(pData->szCharData);
}
else if(strcmp(name, "CounterAttackGroupSize") == 0)
{
pData->curElement = ELEMENT;
pData->curDifficultySettings.iCounterAttackGroupSize = (UINT8) atol(pData->szCharData);
}
else if(strcmp(name, "PercentElitesBonus") == 0)
{
pData->curElement = ELEMENT;