Mercs can now have multiple disabilities at the same time.

The new fSpecialFlagContractDisability tag for diseases adds a disability every time we are infected with the disease, it is used for PTSD.

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8826 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Flugente
2020-06-20 15:47:43 +00:00
parent 7899cc1f1e
commit d33bc9123c
18 changed files with 147 additions and 36 deletions
+35 -3
View File
@@ -1130,6 +1130,7 @@ void SOLDIERTYPE::initialize( )
this->iLastArmourProtection = 0;
this->usQuickItemId = 0;
this->ubQuickItemSlot = 0;
this->usDisabilityFlagMask = 0;
}
bool SOLDIERTYPE::exists( )
@@ -19227,10 +19228,28 @@ void SOLDIERTYPE::Infect( UINT8 aDisease )
return;
// we are getting infected. Raise our disease points, but not over the level of an infection
if ( aDisease < NUM_DISEASES && this->sDiseasePoints[aDisease] < Disease[aDisease].sInfectionPtsInitial )
if ( aDisease < NUM_DISEASES && this->sDiseasePoints[aDisease] <= Disease[aDisease].sInfectionPtsInitial )
{
this->sDiseasePoints[aDisease] = min( this->sDiseasePoints[aDisease] + Disease[aDisease].sInfectionPtsInitial, Disease[aDisease].sInfectionPtsInitial );
// possibly add a new disability
if ( Disease[aDisease].usDiseaseProperties & DISEASE_PROPERTY_ADD_DISABILITY )
{
// take a random disability we don't yet have and give it to us
std::vector<UINT8> disabilitieswedonthaveset;
for ( UINT8 i = NO_DISABILITY + 1; i < min( 31, NUM_DISABILITIES ); ++i )
{
if ( !DoesMercHaveDisability( this, i ) )
disabilitieswedonthaveset.push_back(i);
}
if ( !disabilitieswedonthaveset.empty() )
{
UINT8 newdisability = disabilitieswedonthaveset[Random( disabilitieswedonthaveset.size() )];
this->AddDisability( newdisability );
}
}
if ( this->sDiseasePoints[aDisease] > Disease[aDisease].sInfectionPtsOutbreak )
{
this->sDiseaseFlag[aDisease] |= SOLDIERDISEASE_OUTBREAK;
@@ -19295,6 +19314,11 @@ void SOLDIERTYPE::AnnounceDisease( UINT8 aDisease )
gMercProfiles[this->ubProfile].records.usTimesInfected += 1;
}
void SOLDIERTYPE::AddDisability( UINT8 aDisability )
{
this->usDisabilityFlagMask |= ( 1 << aDisability );
}
// do we have any disease? fDiagnosedOnly: check for wether we know of this infection fHealableOnly: check wether it can be healed
BOOLEAN SOLDIERTYPE::HasDisease( BOOLEAN fDiagnosedOnly, BOOLEAN fHealableOnly, BOOLEAN fSymbolOnly )
{
@@ -19368,7 +19392,8 @@ void SOLDIERTYPE::PrintDiseaseDesc( CHAR16* apStr, BOOLEAN fFullDesc )
fShowExactPoints = TRUE;
CHAR16 atStr[500];
swprintf( atStr, L"" );
swprintf( atStr, L"\n \n" );
wcscat( apStr, atStr );
for ( int i = 0; i < NUM_DISEASES; ++i )
{
@@ -19479,6 +19504,12 @@ void SOLDIERTYPE::PrintDiseaseDesc( CHAR16* apStr, BOOLEAN fFullDesc )
swprintf( atStr, szDiseaseText[TEXT_DISEASE_PTSD_BUNS_SPECIAL] );
wcscat( apStr, atStr );
}
if ( Disease[i].usDiseaseProperties & DISEASE_PROPERTY_ADD_DISABILITY )
{
swprintf( atStr, szDiseaseText[TEXT_DISEASE_ADD_DISABILITY] );
wcscat( apStr, atStr );
}
}
}
else if ( fShowExactPoints && this->sDiseasePoints[i] > 0 )
@@ -19600,7 +19631,8 @@ void SOLDIERTYPE::PrintSleepDesc( CHAR16* apStr )
return;
CHAR16 atStr[100];
swprintf( atStr, L"" );
swprintf( atStr, L"\n \n" );
wcscat( apStr, atStr );
swprintf( atStr, gpStrategicString[STR_BREATH_REGEN_SLEEP], this->GetSleepBreathRegeneration( ) );
wcscat( apStr, atStr );