Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 39 additions & 40 deletions Strategic/Assignments.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4608,7 +4608,44 @@ UINT16 HealPatient( SOLDIERTYPE *pPatient, SOLDIERTYPE * pDoctor, UINT16 usHealA
// if we will heal life and stats at the same time, increases the medical cost
if ( fWillHealLife && fWillRepairStats )
bMedFactor += 1;


/////////////////////////// DISEASE CURE ////////////////////////////////////
if (fWillCureDisease && ptsleft > 0)
{
// determine how many points we use on disease cure
if (ptsleft < sHundredsToDiseaseCure)
sHundredsToDiseaseCure_Used = ptsleft;
else
sHundredsToDiseaseCure_Used = sHundredsToDiseaseCure;

// use up points
ptsleft -= sHundredsToDiseaseCure_Used;

INT32 curablepoints = sHundredsToDiseaseCure_Used;

if (curablepoints > 0)
{
// now apply healing: reduce disease points for each disease by the determined factor
UINT16 healingdone = 0;
for (int i = 0; i < NUM_DISEASES; ++i)
{
if ((pPatient->sDiseaseFlag[i] & SOLDIERDISEASE_DIAGNOSED) && (Disease[i].usDiseaseProperties & DISEASE_PROPERTY_CANBECURED))
{
// amount cured is fraction of disease to total disease times fraction of healing done
INT32 cured = (sHundredsToDiseaseCure_Used * pPatient->sDiseasePoints[i]) / (FLOAT)(sHundredsToDiseaseCure);

if (cured > 0)
{
pPatient->AddDiseasePoints(i, -cured);
}
}
}

// patient expresses his gratitude
if (pDoctor)
AddOpinionEvent(pPatient->ubProfile, pDoctor->ubProfile, OPINIONEVENT_DISEASE_TREATMENT, TRUE);
}
}
/////////////////////////// LIFE HEAL ////////////////////////////////////
// heal life points
if ( fWillHealLife && ptsleft > 0 )
Expand Down Expand Up @@ -4670,45 +4707,7 @@ UINT16 HealPatient( SOLDIERTYPE *pPatient, SOLDIERTYPE * pDoctor, UINT16 usHealA

RegainDamagedStats( pPatient, (sHundredsToRepair_Used * ubReturnDamagedStatRate / 100) );
}

/////////////////////////// DISEASE CURE ////////////////////////////////////
if ( fWillCureDisease && ptsleft > 0 )
{
// determine how many points we use on stat repair
if ( ptsleft < sHundredsToDiseaseCure )
sHundredsToDiseaseCure_Used = ptsleft;
else
sHundredsToDiseaseCure_Used = sHundredsToDiseaseCure;

// use up points
ptsleft -= sHundredsToDiseaseCure_Used;

INT32 curablepoints = sHundredsToDiseaseCure_Used;

if ( curablepoints > 0 )
{
// now apply healing: reduce disease points for each disease by the determined factor
UINT16 healingdone = 0;
for ( int i = 0; i < NUM_DISEASES; ++i )
{
if ( (pPatient->sDiseaseFlag[i] & SOLDIERDISEASE_DIAGNOSED) && (Disease[i].usDiseaseProperties & DISEASE_PROPERTY_CANBECURED) )
{
// amount cured is fraction of disease to total disease times fraction of healing done
INT32 cured = (sHundredsToDiseaseCure_Used * pPatient->sDiseasePoints[i]) / (FLOAT)(sHundredsToDiseaseCure);

if ( cured > 0 )
{
pPatient->AddDiseasePoints( i, -cured );
}
}
}

// patient expresses his gratitude
if ( pDoctor )
AddOpinionEvent( pPatient->ubProfile, pDoctor->ubProfile, OPINIONEVENT_DISEASE_TREATMENT, TRUE );
}
}


// Finally use all kit points (we are sure, we have that much)
if ( pDoctor && UseTotalMedicalKitPoints( pDoctor, max( 1, ((sHundredsToHeal_Used + sHundredsToRepair_Used + sHundredsToDiseaseCure_Used) * bMedFactor) / 100 ) ) == FALSE )
{
Expand Down