From 37f9bfee1946d4630e4e9fda572986e13b66a301 Mon Sep 17 00:00:00 2001 From: Sun Jialong Date: Wed, 22 Sep 2021 00:30:12 +0800 Subject: [PATCH] fix BloodRot in Royalty DLC --- Source/PharmacistUtility.cs | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/Source/PharmacistUtility.cs b/Source/PharmacistUtility.cs index 62215d4..e4697eb 100644 --- a/Source/PharmacistUtility.cs +++ b/Source/PharmacistUtility.cs @@ -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; } @@ -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) > @@ -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