mirror of
https://github.com/1dot13/source.git
synced 2026-08-19 14:20:30 +02:00
Improved Feature: Improved ambushes:
- Enemy deployment radius depends on your mercs' experience. - With high enough leadership, your team will be able to deploy before battle. - Added new background tag <ambush_radius> that increases enemy deployment radius (thereby moving them farther away). git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@7854 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
@@ -191,6 +191,7 @@ enum {
|
||||
BG_PERC_DISEASE_DIAGNOSE,
|
||||
BG_PERC_DISEASE_TREAT,
|
||||
BG_TRACKER_ABILITY,
|
||||
BG_AMBUSH_RADIUS,
|
||||
|
||||
BG_DISLIKEBG, // dislike any other background that has the negative of this value set
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#include "renderworld.h" // added by Flugente
|
||||
#include "Vehicles.h" // added by Flugente
|
||||
#include "CampaignStats.h" // added by Flugente
|
||||
#include "worldman.h" // added by Flugente for Water(...)
|
||||
#endif
|
||||
|
||||
#ifdef JA2UB
|
||||
@@ -1117,7 +1118,7 @@ INT32 FindRandomGridNoBetweenCircles( INT32 sCenterGridNo, UINT8 uInnerRadius, U
|
||||
|
||||
sGridNo = sCenterGridNo + (WORLD_COLS * sY) + sX;
|
||||
|
||||
if ( TileIsOutOfBounds( sGridNo ) || !IsLocationSittable( sGridNo, 0 ) || PythSpacesAway( sGridNo, sCenterGridNo ) <= uInnerRadius || PythSpacesAway( sGridNo, sCenterGridNo ) > uOuterRadius )
|
||||
if ( TileIsOutOfBounds( sGridNo ) || Water( sGridNo ) || !IsLocationSittable( sGridNo, 0 ) || PythSpacesAway( sGridNo, sCenterGridNo ) <= uInnerRadius || PythSpacesAway( sGridNo, sCenterGridNo ) > uOuterRadius )
|
||||
sGridNo = NOWHERE;
|
||||
else
|
||||
fFound = TRUE;
|
||||
|
||||
@@ -576,6 +576,8 @@ void SortSoldierInitList()
|
||||
|
||||
}
|
||||
|
||||
extern FLOAT gAmbushRadiusModifier;
|
||||
|
||||
BOOLEAN AddPlacementToWorld( SOLDIERINITNODE *curr, GROUP *pGroup = NULL )
|
||||
{
|
||||
UINT8 ubProfile;
|
||||
@@ -772,10 +774,10 @@ BOOLEAN AddPlacementToWorld( SOLDIERINITNODE *curr, GROUP *pGroup = NULL )
|
||||
}
|
||||
|
||||
// Flugente: if this is an enemy, and we are using ambush code, place us somewhat away from the map center, where the player will be
|
||||
if ( (tempDetailedPlacement.bTeam == ENEMY_TEAM && gubEnemyEncounterCode == ENEMY_AMBUSH_CODE) ||
|
||||
if ( (tempDetailedPlacement.bTeam == ENEMY_TEAM && (gubEnemyEncounterCode == ENEMY_AMBUSH_CODE || gubEnemyEncounterCode == ENEMY_AMBUSH_DEPLOYMENT_CODE) ) ||
|
||||
(tempDetailedPlacement.bTeam == CREATURE_TEAM && gubEnemyEncounterCode == BLOODCAT_AMBUSH_CODE) )
|
||||
{
|
||||
if ( ( gGameExternalOptions.uAmbushEnemyEncircle == 1 && PythSpacesAway( tempDetailedPlacement.sInsertionGridNo, gMapInformation.sCenterGridNo ) <= gGameExternalOptions.usAmbushEnemyEncircleRadius1 ) ||
|
||||
if ( (gGameExternalOptions.uAmbushEnemyEncircle == 1 && PythSpacesAway( tempDetailedPlacement.sInsertionGridNo, gMapInformation.sCenterGridNo ) <= gAmbushRadiusModifier * gGameExternalOptions.usAmbushEnemyEncircleRadius1) ||
|
||||
( gGameExternalOptions.uAmbushEnemyEncircle == 2) )
|
||||
{
|
||||
// we simply look for a entry point inside a bigger circle, but not inside the merc deployment zone.
|
||||
@@ -783,9 +785,9 @@ BOOLEAN AddPlacementToWorld( SOLDIERINITNODE *curr, GROUP *pGroup = NULL )
|
||||
UINT16 counter = 0;
|
||||
UINT8 ubDirection = DIRECTION_IRRELEVANT;
|
||||
|
||||
while ( counter < 100 && (bettergridno == NOWHERE || PythSpacesAway( bettergridno, gMapInformation.sCenterGridNo ) <= gGameExternalOptions.usAmbushEnemyEncircleRadius1) )
|
||||
while ( counter < 100 && (bettergridno == NOWHERE || PythSpacesAway( bettergridno, gMapInformation.sCenterGridNo ) <= gAmbushRadiusModifier * gGameExternalOptions.usAmbushEnemyEncircleRadius1) )
|
||||
{
|
||||
bettergridno = FindRandomGridNoBetweenCircles( gMapInformation.sCenterGridNo, gGameExternalOptions.usAmbushEnemyEncircleRadius1, gGameExternalOptions.usAmbushEnemyEncircleRadius2, ubDirection );
|
||||
bettergridno = FindRandomGridNoBetweenCircles( gMapInformation.sCenterGridNo, gAmbushRadiusModifier * gGameExternalOptions.usAmbushEnemyEncircleRadius1, gAmbushRadiusModifier * gGameExternalOptions.usAmbushEnemyEncircleRadius2, ubDirection );
|
||||
}
|
||||
|
||||
if ( bettergridno != NOWHERE )
|
||||
|
||||
@@ -129,6 +129,7 @@ backgroundStartElementHandle(void *userData, const XML_Char *name, const XML_Cha
|
||||
strcmp(name, "disease_diagnose" ) == 0 ||
|
||||
strcmp(name, "disease_treatment" ) == 0 ||
|
||||
strcmp(name, "tracker_ability" ) == 0 ||
|
||||
strcmp(name, "ambush_radius" ) == 0 ||
|
||||
strcmp(name, "dislikebackground" ) == 0 ||
|
||||
strcmp(name, "druguse") == 0 ||
|
||||
strcmp(name, "xenophobic") == 0 ||
|
||||
@@ -544,6 +545,11 @@ backgroundEndElementHandle(void *userData, const XML_Char *name)
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curBackground.value[BG_TRACKER_ABILITY] = min( 40, max( 0, (INT16)atol( pData->szCharData ) ) );
|
||||
}
|
||||
else if ( strcmp( name, "ambush_radius" ) == 0 )
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curBackground.value[BG_AMBUSH_RADIUS] = min( 50, max( 0, (INT16)atol( pData->szCharData ) ) );
|
||||
}
|
||||
else if ( strcmp( name, "dislikebackground" ) == 0 )
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
|
||||
Reference in New Issue
Block a user