- 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;