Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix BloodRot in Royalty DLC #43

Open
wants to merge 1 commit into
base: 1.3
Choose a base branch
from
Open
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
24 changes: 17 additions & 7 deletions Source/PharmacistUtility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,18 @@ public static InjurySeverity GetTendSeverity(this Pawn patient) {
// going to die in <6 hours, or any tendable is life threathening
if (ticksToDeathDueToBloodLoss <= GenDate.TicksPerHour * 6 ||
hediffs.Any(h => h.CurStage?.lifeThreatening ?? false) ||
hediffs.Any(NearLethalDisease)) {
hediffs.Any(NearLethalDisease) ||
hediffs.Any(h => IsBloodRot(h) && h.Severity > PharmacistSettings.medicalCare.DiseaseThreshold)
) {
return InjurySeverity.LifeThreathening;
}

// going to die in <12 hours, or any immunity < severity and can be fatal, or death by a thousand cuts imminent
if (ticksToDeathDueToBloodLoss <= GenDate.TicksPerHour * 12 ||
hediffs.Any(PotentiallyLethalDisease) ||
DeathByAThousandCuts(patient)) {
DeathByAThousandCuts(patient) ||
hediffs.Any(IsBloodRot)
) {
return InjurySeverity.Major;
}

Expand Down Expand Up @@ -70,6 +74,11 @@ private static bool NearLethalDisease(Hediff h) {
compImmunizable.Immunity < PharmacistSettings.medicalCare.DiseaseMargin + h.Severity;
}

private static bool IsBloodRot(Hediff h)
{
return h.def.defName == "BloodRot";
}

private static bool DeathByAThousandCuts(Pawn patient) {
// number of bleeding wounds > threshold
return patient.health.hediffSet.hediffs.Count(hediff => hediff.Bleeding) >
Expand Down Expand Up @@ -106,11 +115,12 @@ public static MedicalCareCategory TendAdvice(Pawn patient, InjurySeverity severi
#if DEBUG
Log.Message(
"Pharmacist :: Advice" +
$"\n\tpatient: {patient?.LabelShort}" +
$"\n\tpopulation: {population}" +
$"\n\tseverity: {severity}" +
$"\n\tplayerSettings: {playerSetting}" +
$"\n\tpharmacist: {pharmacist}");
$"\tpatient: {patient?.LabelShort}" +
$"\tpopulation: {population}" +
$"\tbloodRot: {patient.health.hediffSet.hediffs.Exists(IsBloodRot)}" +
$"\tseverity: {severity}" +
$"\tplayerSettings: {playerSetting}" +
$"\tpharmacist: {pharmacist}");
#endif

// return lowest
Expand Down