// KK -->
int GetWoundedCrewQuantity(ref _refCharacter)
{
if (!CheckAttribute(_refCharacter, "Ship.Crew.Wounded.Quantity")) return 0;
return sti(_refCharacter.Ship.Crew.Wounded.Quantity);
}
bool SetWoundedCrewQuantity(ref _refCharacter, int num)
{
if (num < 0) return;
int crew = GetTotalCrewQuantity(_refCharacter);
if (num == 0) {
if (CheckAttribute(_refCharacter, "Ship.Crew.Wounded")) {
AddCharacterCrew(_refCharacter, GetWoundedCrewQuantity(_refCharacter));
DeleteAttribute(_refCharacter, "Ship.Crew.Wounded");
}
return true;
}
if (num > crew) num = crew;
SetCrewQuantity(_refCharacter, crew - num);
_refCharacter.Ship.Crew.Wounded.Quantity = num;
return true;
}
void ResetSquadronWoundedCrew()
{
ref pchar = GetMainCharacter();
for (int i = 0; i < 4; i++)
{
int cn = GetCompanionIndex(pchar, i);
if (cn < 0) continue;
ref rCharacter = GetCharacter(cn);
SetWoundedCrewQuantity(rCharacter, 0);
}
}
bool AddCharacterWoundedCrew(ref _refCharacter, int num)
{
if (num == 0) return false;
return SetWoundedCrewQuantity(_refCharacter, GetWoundedCrewQuantity(_refCharacter) + num);
}
bool RemoveCharacterWoundedCrew(ref _refCharacter, int num)
{
int woundedCrew = GetWoundedCrewQuantity(_refCharacter);
if (num > woundedCrew) num = woundedCrew;
return SetWoundedCrewQuantity(_refCharacter, woundedCrew - num);
}
int GetTotalCrewQuantity(ref _refCharacter)
{
return GetCrewQuantity(_refCharacter) + GetWoundedCrewQuantity(_refCharacter);
}
string GetCharacterOfficerType(ref _refCharacter)
{
if (!CheckAttribute(_refCharacter, "quest.officertype")) return "";
return _refCharacter.quest.officertype;
}
// <-- KK
// PB -->
int GetWoundedHealedPerDay(ref _refCharacter)
{
int healing_rate = HEALED_PER_DAY;
if(CharacterHasOfficerType(_refCharacter, OFFIC_TYPE_DOCTOR))
healing_rate = healing_rate + CharacterGetOfficerSkill(_refCharacter, OFFIC_TYPE_DOCTOR, "defence");
if(GetCargoGoods(_refCharacter, GOOD_TREATMENT) > 0)
healing_rate = healing_rate + HEALED_WITH_MEDS;
return makeint(0.5 * healing_rate + rand(healing_rate));
}
int GetWoundedKilledPerDay(ref _refCharacter)
{
int death_rate = KILLED_PER_DAY;
if(CharacterHasOfficerType(_refCharacter, OFFIC_TYPE_DOCTOR))
death_rate = death_rate - CharacterGetOfficerSkill(_refCharacter, OFFIC_TYPE_DOCTOR, "defence");
if(GetCargoGoods(_refCharacter, GOOD_TREATMENT) > 0)
death_rate = death_rate - HEALED_WITH_MEDS;
return makeint(0.5 * death_rate + rand(death_rate));
}