mirror of
https://github.com/1dot13/source.git
synced 2026-07-29 13:52:17 +02:00
- New background property: <snake_defense> alters snake defense chance
- New sector property: <numsnakes> sets maximum number of snakes per snake attack git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8277 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
@@ -98,6 +98,7 @@ SectorNameStartElementHandle(void *userData, const XML_Char *name, const char **
|
||||
strcmp(name, "sandstormchance") == 0 ||
|
||||
strcmp(name, "snowchance" ) == 0 ||
|
||||
strcmp(name, "snakechance" ) == 0 ||
|
||||
strcmp(name, "numsnakes" ) == 0 ||
|
||||
strcmp(name, "maxworkers" ) == 0 ))
|
||||
{
|
||||
pData->curElement = ELEMENT_PROPERTY;
|
||||
@@ -220,6 +221,11 @@ SectorNameEndElementHandle(void *userData, const XML_Char *name)
|
||||
SectorExternalData[ubSectorId][2].snakechance = 0;
|
||||
SectorExternalData[ubSectorId][3].snakechance = 0;
|
||||
|
||||
SectorExternalData[ubSectorId][0].numsnakes = pData->sectordata.numsnakes;
|
||||
SectorExternalData[ubSectorId][1].numsnakes = 0;
|
||||
SectorExternalData[ubSectorId][2].numsnakes = 0;
|
||||
SectorExternalData[ubSectorId][3].numsnakes = 0;
|
||||
|
||||
SectorExternalData[ubSectorId][0].maxworkers = pData->sectordata.maxworkers;
|
||||
SectorExternalData[ubSectorId][1].maxworkers = 0;
|
||||
SectorExternalData[ubSectorId][2].maxworkers = 0;
|
||||
@@ -247,6 +253,7 @@ SectorNameEndElementHandle(void *userData, const XML_Char *name)
|
||||
pData->sectordata.sandstormchance = 0;
|
||||
pData->sectordata.snowchance = 0;
|
||||
pData->sectordata.snakechance = 0;
|
||||
pData->sectordata.numsnakes = 0;
|
||||
pData->sectordata.maxworkers = 0;
|
||||
}
|
||||
else
|
||||
@@ -361,6 +368,11 @@ SectorNameEndElementHandle(void *userData, const XML_Char *name)
|
||||
pData->curElement = ELEMENT;
|
||||
pData->sectordata.snakechance = min( 100, (UINT8)atoi( pData->szCharData ) );
|
||||
}
|
||||
else if ( strcmp( name, "numsnakes" ) == 0 )
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->sectordata.numsnakes = min( 20, (UINT8)atoi( pData->szCharData ) );
|
||||
}
|
||||
else if ( strcmp( name, "maxworkers" ) == 0 )
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
|
||||
@@ -192,6 +192,7 @@ enum {
|
||||
BG_PERC_DISEASE_TREAT,
|
||||
BG_TRACKER_ABILITY,
|
||||
BG_AMBUSH_RADIUS,
|
||||
BG_SNAKEDEFENSE,
|
||||
|
||||
BG_DISLIKEBG, // dislike any other background that has the negative of this value set
|
||||
BG_SMOKERTYPE, // 0: doesnt care about smoking 1: will consume cigarettes, dislikes non-smokers 2: will refuse to smoke, dislikes smokers
|
||||
|
||||
@@ -510,6 +510,7 @@ typedef struct
|
||||
UINT8 snowchance; // chance that it snows in this sector
|
||||
|
||||
UINT8 snakechance; // if positive, snakes can attack in water, the higher the number, the more often it happens
|
||||
UINT8 numsnakes; // how many snakes can be active at maximum
|
||||
|
||||
UINT8 maxworkers; // maximum number of workers in this sector;
|
||||
|
||||
|
||||
@@ -19145,6 +19145,8 @@ UINT8 SOLDIERTYPE::GetWaterSnakeDefenseChance()
|
||||
if ( gGameOptions.fNewTraitSystem )
|
||||
val += gSkillTraitValues.usSVSnakeDefense * NUM_SKILL_TRAITS( this, SURVIVAL_NT );
|
||||
|
||||
val += this->GetBackgroundValue( BG_SNAKEDEFENSE );
|
||||
|
||||
// bonus if we have a knife, extra if it is in our hands
|
||||
INT8 invsize = (INT8)inv.size( ); // remember inventorysize, so we don't call size() repeatedly
|
||||
for ( INT8 bLoop = 0; bLoop < invsize; ++bLoop )
|
||||
|
||||
@@ -130,6 +130,7 @@ backgroundStartElementHandle(void *userData, const XML_Char *name, const XML_Cha
|
||||
strcmp(name, "disease_treatment" ) == 0 ||
|
||||
strcmp(name, "tracker_ability" ) == 0 ||
|
||||
strcmp(name, "ambush_radius" ) == 0 ||
|
||||
strcmp(name, "snake_defense" ) == 0 ||
|
||||
strcmp(name, "dislikebackground" ) == 0 ||
|
||||
strcmp(name, "smoker" ) == 0 ||
|
||||
strcmp(name, "croucheddefense" ) == 0 ||
|
||||
@@ -553,6 +554,11 @@ backgroundEndElementHandle(void *userData, const XML_Char *name)
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curBackground.value[BG_AMBUSH_RADIUS] = min( 50, max( 0, (INT16)atol( pData->szCharData ) ) );
|
||||
}
|
||||
else if ( strcmp( name, "snake_defense" ) == 0 )
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
pData->curBackground.value[BG_SNAKEDEFENSE] = min( 100, max( -100, (INT16)atol( pData->szCharData ) ) );
|
||||
}
|
||||
else if ( strcmp( name, "dislikebackground" ) == 0 )
|
||||
{
|
||||
pData->curElement = ELEMENT;
|
||||
|
||||
@@ -1106,7 +1106,7 @@ void AddSnakeAmim( INT32 sGridno, UINT8 usDirection )
|
||||
ANITILE_PARAMS AniParams;
|
||||
|
||||
memset( &AniParams, 0, sizeof(ANITILE_PARAMS) );
|
||||
|
||||
|
||||
AniParams.sGridNo = sGridno;
|
||||
AniParams.ubLevelID = ANI_OBJECT_LEVEL;
|
||||
AniParams.sDelay = 100;
|
||||
@@ -1131,8 +1131,9 @@ void HandleEnvironmentHazard( )
|
||||
|
||||
if ( gGameExternalOptions.gfAllowSnakes && !gbWorldSectorZ && Chance( SectorExternalData[sector][0].snakechance ) )
|
||||
{
|
||||
// there can be up to 3 attacks at the same time
|
||||
int actionstodo = 3;
|
||||
// the number of snake attacks is randomized
|
||||
int actionstodo = max(1, Random( SectorExternalData[sector][0].numsnakes ) );
|
||||
|
||||
BOOLEAN soundplayed = FALSE;
|
||||
|
||||
SOLDIERTYPE *pSoldier = NULL;
|
||||
|
||||
@@ -8946,6 +8946,7 @@ STR16 szBackgroundText_Value[]=
|
||||
L" %s%d%% 对人员治疗疾病的效率\n", //L" %s%d%% effectiveness at treating population against diseases\n",
|
||||
L"可以发现被跟踪的 %d 距离格数\n", //L"Can spot tracks up to %d tiles away\n",
|
||||
L" %s%d%% 被伏击时的初始距离\n", //L" %s%d%% initial distance to enemy in ambush\n",
|
||||
L" %s%d%% chance to evade snake attacks\n", // TODO.Translate
|
||||
|
||||
L" 对某些其他背景的厌恶\n", //L" dislikes some other backgrounds\n",
|
||||
L"吸烟者", //L"Smoker",
|
||||
|
||||
@@ -8963,6 +8963,7 @@ STR16 szBackgroundText_Value[]=
|
||||
L" %s%d%% effectiveness at treating population against diseases\n",
|
||||
L"Can spot tracks up to %d tiles away\n",
|
||||
L" %s%d%% initial distance to enemy in ambush\n",
|
||||
L" %s%d%% chance to evade snake attacks\n", // TODO.Translate
|
||||
|
||||
L" dislikes some other backgrounds\n", // TODO.Translate
|
||||
L"Smoker",
|
||||
|
||||
@@ -8944,6 +8944,7 @@ STR16 szBackgroundText_Value[]=
|
||||
L" %s%d%% effectiveness at treating population against diseases\n",
|
||||
L"Can spot tracks up to %d tiles away\n",
|
||||
L" %s%d%% initial distance to enemy in ambush\n",
|
||||
L" %s%d%% chance to evade snake attacks\n",
|
||||
|
||||
L" dislikes some other backgrounds\n",
|
||||
L"Smoker",
|
||||
|
||||
@@ -8945,6 +8945,7 @@ STR16 szBackgroundText_Value[]=
|
||||
L" %s%d%% effectiveness at treating population against diseases\n",
|
||||
L"Can spot tracks up to %d tiles away\n",
|
||||
L" %s%d%% initial distance to enemy in ambush\n",
|
||||
L" %s%d%% chance to evade snake attacks\n", // TODO.Translate
|
||||
|
||||
L" dislikes some other backgrounds\n", // TODO.Translate
|
||||
L"Smoker",
|
||||
|
||||
@@ -8775,6 +8775,7 @@ STR16 szBackgroundText_Value[]=
|
||||
L" %s%d%% effectiveness at treating population against diseases\n",
|
||||
L"Can spot tracks up to %d tiles away\n",
|
||||
L" %s%d%% initial distance to enemy in ambush\n",
|
||||
L" %s%d%% chance to evade snake attacks\n", // TODO.Translate
|
||||
|
||||
L" dislikes some other backgrounds\n", // TODO.Translate
|
||||
L"Smoker",
|
||||
|
||||
@@ -8954,6 +8954,7 @@ STR16 szBackgroundText_Value[]=
|
||||
L" %s%d%% effectiveness at treating population against diseases\n",
|
||||
L"Can spot tracks up to %d tiles away\n",
|
||||
L" %s%d%% initial distance to enemy in ambush\n",
|
||||
L" %s%d%% chance to evade snake attacks\n", // TODO.Translate
|
||||
|
||||
L" dislikes some other backgrounds\n", // TODO.Translate
|
||||
L"Smoker",
|
||||
|
||||
@@ -8967,6 +8967,7 @@ STR16 szBackgroundText_Value[]=
|
||||
L" %s%d%% effectiveness at treating population against diseases\n",
|
||||
L"Can spot tracks up to %d tiles away\n",
|
||||
L" %s%d%% initial distance to enemy in ambush\n",
|
||||
L" %s%d%% chance to evade snake attacks\n", // TODO.Translate
|
||||
|
||||
L" dislikes some other backgrounds\n", // TODO.Translate
|
||||
L"Smoker",
|
||||
|
||||
@@ -8944,6 +8944,7 @@ STR16 szBackgroundText_Value[]=
|
||||
L" %s%d%% эффективность в лечении населения от болезней\n",
|
||||
L"Замечает следы на расстоянии до %d метров\n",
|
||||
L" %s%d%% начальное расстояние до противника в засаде\n",
|
||||
L" %s%d%% chance to evade snake attacks\n", // TODO.Translate
|
||||
|
||||
L" dislikes some other backgrounds\n", // TODO.Translate
|
||||
L"Курит",
|
||||
|
||||
Reference in New Issue
Block a user