// 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));
}
bool CharacterHasOfficerType(ref _refCharacter, string OfficerType)
{
int i, cn;
if(IsMainCharacter(_refCharacter))
{
int num = GetPassengersQuantity(_refCharacter);
for(i = 0; i < num; i++)
{
cn = GetPassenger(_refCharacter, i);
if(cn < 0) continue;
if(GetAttribute(GetCharacter(cn),"quest.officertype") == OfficerType &&
!IsPrisoner(GetCharacter(cn)) && !IsCompanion(GetCharacter(cn))) return true;
}
}
else
{
for(i = 1; i < OFFICER_MAX; i++)
{
cn = GetOfficersIndex(&_refCharacter,i);
if(cn < 0) continue;
if(GetAttribute(GetCharacter(cn),"quest.officertype") == OfficerType) return true;
}
}
return false;
}
int CharacterGetOfficerSkill(ref _refCharacter, string OfficerType, string skillName)
{
int i, cn;
int skillvalue = 0;
if(IsMainCharacter(_refCharacter))
{
int num = GetPassengersQuantity(_refCharacter);
for(i = 0; i < num; i++)
{
cn = GetPassenger(_refCharacter, i);
if(cn < 0) continue;
if(GetAttribute(GetCharacter(cn),"quest.officertype") == OfficerType &&
!IsPrisoner(GetCharacter(cn)) && !IsCompanion(GetCharacter(cn)))
{
if(CalcCharacterSkill(GetCharacter(cn), skillName) > skillvalue)
skillvalue = CalcCharacterSkill(GetCharacter(cn), skillName);
}
}
}
else
{
for(i = 1; i < OFFICER_MAX; i++)
{
cn = GetOfficersIndex(&_refCharacter,i);
if(cn < 0) continue;
if(GetAttribute(GetCharacter(cn),"quest.officertype") == OfficerType &&
!IsPrisoner(GetCharacter(cn)) && !IsCompanion(GetCharacter(cn)))
{
if(CalcCharacterSkill(GetCharacter(cn), skillName) > skillvalue)
skillvalue = CalcCharacterSkill(GetCharacter(cn), skillName);
}
}
}
return skillvalue;
}
// PB <--