- changed MAX_PERCENT_NOISE_VOLUME_FOR_SILENCED_SOUND from 35 to 50 so that all shots with silencers use the silenced sound instead of the normal weapons sound

- New item tag <SleepModifier>:
This is a percentage bonus to breath regain while resting.
It could be applied to sleeping bags for example.
Reasonable values are from 0 (no bonus) to 100 (twice the regeneration).

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@6483 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
silversurfer
2013-10-12 15:02:10 +00:00
parent f72e4424eb
commit c5873e956d
6 changed files with 62 additions and 24 deletions
+31 -22
View File
@@ -4386,7 +4386,7 @@ void RestCharacter( SOLDIERTYPE *pSoldier )
// handle the sleep of this character, update bBreathMax based on sleep they have
INT8 bMaxBreathRegain = 0;
INT16 sSectorModifier = 100;
INT8 bDivisor = 0;
FLOAT bDivisor = 0;
// Determine how many hours a day this merc must sleep. Normally this would range between 6 and 12 hours.
// Injuries and/or martial arts trait can change the limits to between 3 and 18 hours a day.
@@ -4394,7 +4394,8 @@ void RestCharacter( SOLDIERTYPE *pSoldier )
// HEADROCK HAM 3.6:
// Night ops specialists sleep better during the day. Others sleep better during the night.
if (NightTime())
// silversurfer: The code below did the complete opposite. A higher bDivisor means LESS regeneration. Fixed.
if (DayTime()) //if (NightTime())
{
if ( gGameOptions.fNewTraitSystem ) // SANDRO - Old/New traits
{
@@ -4415,25 +4416,6 @@ void RestCharacter( SOLDIERTYPE *pSoldier )
bDivisor += (2*NUM_SKILL_TRAITS( pSoldier, NIGHTOPS_OT ));
}
// Re-enforce limits
bDivisor = __min(18, __max(3, bDivisor));
bMaxBreathRegain = 50 / bDivisor;
// Limit so that characters can't regain faster than 3 hours, ever
if (bMaxBreathRegain > 17)
{
bMaxBreathRegain = 17;
}
// if breath max is below the "really tired" threshold
if( pSoldier->bBreathMax < BREATHMAX_PRETTY_TIRED )
{
// real tired, rest rate is 50% higher (this is to prevent absurdly long sleep times for totally exhausted mercs)
bMaxBreathRegain = ( bMaxBreathRegain * 3 / 2 );
}
// HEADROCK HAM 3.5: Read adjustment from local sector facilities
if (pSoldier->bSectorZ == 0)
{
@@ -4448,7 +4430,34 @@ void RestCharacter( SOLDIERTYPE *pSoldier )
// then only Ambient effects take place.
sSectorModifier = GetSectorModifier( pSoldier, FACILITY_PERFORMANCE_MOD );
}
bMaxBreathRegain = (bMaxBreathRegain * sSectorModifier) / 100;
bDivisor = (bDivisor * 100) / sSectorModifier;
}
// silversurfer: Items can provide a bonus to regeneration, sleeping bags for example.
// They will not provide such bonus if the merc is already using a bed in a facility.
if ( GetSoldierFacilityAssignmentIndex( pSoldier ) != FAC_PATIENT && GetSoldierFacilityAssignmentIndex( pSoldier ) != FAC_REST )
{
bDivisor = ( bDivisor * 100 ) / ( 100 + GetInventorySleepModifier( pSoldier ) );
}
// silversurfer: I moved all modifiers above this point because we don't want anybody to rest faster or slower than the already extreme thresholds.
// Re-enforce limits
bDivisor = __min(18, __max(3, bDivisor));
// round up so the bonuses above make more sense
bMaxBreathRegain = ( 50 / bDivisor + 0.5 );
// Limit so that characters can't regain faster than 3 hours, ever
if (bMaxBreathRegain > 17)
{
bMaxBreathRegain = 17;
}
// if breath max is below the "really tired" threshold
if( pSoldier->bBreathMax < BREATHMAX_PRETTY_TIRED )
{
// real tired, rest rate is 50% higher (this is to prevent absurdly long sleep times for totally exhausted mercs)
bMaxBreathRegain = (UINT8)( bMaxBreathRegain * 3 / 2 );
}
pSoldier->bBreathMax += bMaxBreathRegain;
+3
View File
@@ -1160,6 +1160,9 @@ typedef struct
// Flugente: item is connected to another item. Type of connection depends on item specifics
UINT16 usBuddyItem;
// silversurfer: item provides breath regeneration bonus while resting
UINT8 ubSleepModifier;
} INVTYPE;
+15
View File
@@ -15257,3 +15257,18 @@ INT32 GetPercentRangeBonus( OBJECTTYPE * pObj )
return( bonus );
}
// silversurfer: Finds items with SleepModifier bonus in inventory and returns the highest value
UINT8 GetInventorySleepModifier( SOLDIERTYPE *pSoldier )
{
UINT8 modifier = 0;
for ( UINT8 i = 0; i < pSoldier->inv.size(); i++ )
{
if( pSoldier->inv[ i ].exists() == true && Item[ pSoldier->inv[i].usItem ].ubSleepModifier > 0 )
{
modifier = __max(modifier, BonusReduce( Item[ pSoldier->inv[i].usItem ].ubSleepModifier, pSoldier->inv[i][0]->data.objectStatus ));
}
}
return( modifier );
}
+3
View File
@@ -520,6 +520,9 @@ BOOLEAN ItemCanBeAppliedToOthers( UINT16 usItem );
//zwwooooo - IoV: change RangeBonus to ratable (Orange by kenkenkenken in IoV921)
INT32 GetPercentRangeBonus( OBJECTTYPE * pObj );
// silversurfer: returns the SleepModifier from the characters inventory
UINT8 GetInventorySleepModifier( SOLDIERTYPE *pSoldier );
#endif
+1 -1
View File
@@ -47,7 +47,7 @@ void HandleTacticalEffectsOfEquipmentChange( SOLDIERTYPE *pSoldier, UINT32 uiInv
#define SOLID_SLUG_RANGE_BONUS 65
#define DUCKBILL_RANGE_BONUS 40
#define MAX_PERCENT_NOISE_VOLUME_FOR_SILENCED_SOUND 35
#define MAX_PERCENT_NOISE_VOLUME_FOR_SILENCED_SOUND 50 //35 silversurfer changed that to make sound suppressors always play the silenced sound
// JA2 GOLD: for weapons and attachments, give penalties only for status values below 85
#define WEAPON_STATUS_MOD( x ) ( (x) >= 85 ? 100 : (((x) * 100) / 85) )
+9 -1
View File
@@ -270,13 +270,15 @@ itemStartElementHandle(void *userData, const XML_Char *name, const XML_Char **at
strcmp(name, "CrowbarModifier") == 0 ||
strcmp(name, "DisarmModifier") == 0 ||
strcmp(name, "RepairModifier") == 0 ||
strcmp(name, "usActionItemFlag") == 0 ||
strcmp(name, "clothestype") == 0 ||
strcmp(name, "randomitem") == 0 ||
strcmp(name, "randomitemcoolnessmodificator") == 0 ||
strcmp(name, "FlashLightRange") == 0 ||
strcmp(name, "ItemChoiceTimeSetting") == 0 ||
strcmp(name, "buddyitem") == 0 ))
strcmp(name, "buddyitem") == 0 ||
strcmp(name, "SleepModifier") == 0))
{
pData->curElement = ELEMENT_PROPERTY;
//DebugMsg(TOPIC_JA2, DBG_LEVEL_3, String("itemStartElementHandle: going into element, name = %s",name) );
@@ -1431,6 +1433,11 @@ itemEndElementHandle(void *userData, const XML_Char *name)
pData->curElement = ELEMENT;
pData->curItem.usBuddyItem = (UINT16) atol(pData->szCharData);
}
else if(strcmp(name, "SleepModifier") == 0)
{
pData->curElement = ELEMENT;
pData->curItem.ubSleepModifier = (UINT16) atol(pData->szCharData);
}
pData->maxReadDepth--;
}
@@ -2072,6 +2079,7 @@ BOOLEAN WriteItemStats()
FilePrintf(hFile,"\t\t<FlashLightRange>%d</FlashLightRange>\r\n", Item[cnt].usFlashLightRange );
FilePrintf(hFile,"\t\t<ItemChoiceTimeSetting>%d</ItemChoiceTimeSetting>\r\n", Item[cnt].usItemChoiceTimeSetting );
FilePrintf(hFile,"\t\t<buddyitem>%d</buddyitem>\r\n", Item[cnt].usBuddyItem );
FilePrintf(hFile,"\t\t<SleepModifier>%d</SleepModifier>\r\n", Item[cnt].ubSleepModifier );
FilePrintf(hFile,"\t</ITEM>\r\n");
}