Skip to content

Commit

Permalink
Removing downgrading since 1.0 gives each medicine a separate max ten…
Browse files Browse the repository at this point in the history
…d quality
  • Loading branch information
alextd committed Jun 19, 2018
1 parent efc625d commit 530d221
Show file tree
Hide file tree
Showing 6 changed files with 0 additions and 43 deletions.
2 changes: 0 additions & 2 deletions Languages/ChineseSimplified/Keyed/ChineseSimplified.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
<TD.SettingMinimalDesc>紧急治疗是指任何有出血、有感染机会或永久性影响的疾病,仅为这些疾病节省宝贵的药物。</TD.SettingMinimalDesc>
<TD.SettingNoMed>非紧急治疗中禁止使用药物</TD.SettingNoMed>
<TD.SettingNoMedDesc>同上,但不使用药物,每处理一个伤口都需要一次治疗动作。</TD.SettingNoMedDesc>
<TD.SettingDowngrade>自动使用低级药物(如果治疗质量够好)</TD.SettingDowngrade>
<TD.SettingDowngradeDesc>计算医生的技能,仿生器官,医疗床等的影响,如果不影响医疗质量则使用低级药物。</TD.SettingDowngradeDesc>
<TD.SettingMedicineGoodEnough>设定治疗质量:</TD.SettingMedicineGoodEnough>
<TD.SettingStockUp>储备药物 &amp; 成瘾品</TD.SettingStockUp>
<TD.SettingStockUpDesc>(储备设置在殖民者的装备栏中)</TD.SettingStockUpDesc>
Expand Down
2 changes: 0 additions & 2 deletions Languages/ChineseTraditional/Keyed/AutoEnglish.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
<TD.SettingMinimalDesc>緊急護理是指任何有出血、有感染機會或永久性影響的疾病,僅為這些疾病節省寶貴的藥物。</TD.SettingMinimalDesc>
<TD.SettingNoMed>非緊急治療中禁止使用藥物</TD.SettingNoMed>
<TD.SettingNoMedDesc>同上,但不使用藥物,每處理一個傷口都需要一次治療動作。</TD.SettingNoMedDesc>
<TD.SettingDowngrade>自動使用低級藥物(如果治療質量夠好)</TD.SettingDowngrade>
<TD.SettingDowngradeDesc>計算醫生的技能,仿生器官,醫療床等的影響,如果不影響醫療質量則使用低級藥物。</TD.SettingDowngradeDesc>
<TD.SettingMedicineGoodEnough>設定治療質量:</TD.SettingMedicineGoodEnough>
<TD.SettingStockUp>儲備藥物 &amp; 成癮品</TD.SettingStockUp>
<TD.SettingStockUpDesc>(儲備設置在殖民者的裝備欄中)</TD.SettingStockUpDesc>
Expand Down
2 changes: 0 additions & 2 deletions Languages/English/Keyed/AutoEnglish.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
<TD.SettingMinimalDesc>Urgent care is any disease, or injuries with bleeding, infection chance, or permanent effects - save valuable medicine for these only</TD.SettingMinimalDesc>
<TD.SettingNoMed>No medicine for non-urgent care</TD.SettingNoMed>
<TD.SettingNoMedDesc>Same as above, but without medicine, each injury is treated one at a time</TD.SettingNoMedDesc>
<TD.SettingDowngrade>Downgrade medicine if sufficient</TD.SettingDowngrade>
<TD.SettingDowngradeDesc>Calculate if lesser medicine will do just as well, due to doctor skill, bionics, medical beds, etc</TD.SettingDowngradeDesc>
<TD.SettingMedicineGoodEnough>... include medicine that is good enough:</TD.SettingMedicineGoodEnough>
<TD.SettingStockUp>Stock Up on medicine &amp; drugs</TD.SettingStockUp>
<TD.SettingStockUpDesc>Stock Up settings are in the colonist's Gear Tab</TD.SettingStockUpDesc>
Expand Down
2 changes: 0 additions & 2 deletions Languages/Spanish/Keyed/Spanish.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
<TD.SettingMinimalDesc>Atención de urgencia es cualquier enfermedad o lesiones con hemorragia con posibilidad de infección o efectos permanentes; guarde un medicamento valioso o de calidad solo para estos casos</TD.SettingMinimalDesc>
<TD.SettingNoMed>Sin medicamentos para cuidados no urgentes</TD.SettingNoMed>
<TD.SettingNoMedDesc>Igual que arriba, pero sin medicamentos, cada lesión se trata de a una sola por vez</TD.SettingNoMedDesc>
<TD.SettingDowngrade>Baja la medicina si es suficiente</TD.SettingDowngrade>
<TD.SettingDowngradeDesc>Calcula si la medicina menor funcionará igual de bien, debido a la habilidad del médico, la biónica, camas médicas, etc.</TD.SettingDowngradeDesc>
<TD.SettingMedicineGoodEnough>... incluir medicina que sea lo suficientemente buena:</TD.SettingMedicineGoodEnough>
<TD.SettingStockUp>Abastecerse de medicina &amp; drogas</TD.SettingStockUp>
<TD.SettingStockUpDesc>La configuración de stock está en la pestaña Gear del colono</TD.SettingStockUpDesc>
Expand Down
23 changes: 0 additions & 23 deletions Source/MedicineGrabbing.cs
Original file line number Diff line number Diff line change
Expand Up @@ -286,11 +286,6 @@ private static bool Prefix(Pawn healer, Pawn patient, ref Thing __result)
Log.Message(healer + " is tending to " + patient);

float sufficientQuality = maxMedicineQuality + 1; // nothing is sufficient!
if (Settings.Get().downgradeExcessiveMedicine)
{
sufficientQuality = CalculateSufficientQuality(healer, patient);
Log.Message("Sufficient medicine for best treatment is " + sufficientQuality + "(" + Settings.Get().goodEnoughDowngradeFactor + ")");
}
if (Settings.Get().minimalMedicineForNonUrgent)
{
if (patient.health.hediffSet.hediffs.All(h => !h.TendableNow() || !h.IsUrgent()))
Expand Down Expand Up @@ -473,24 +468,6 @@ private static bool Prefix(Pawn healer, Pawn patient, ref Thing __result)
return __result == null;
}

private static float CalculateSufficientQuality(Pawn doctor, Pawn patient)
{
// (doctorQuality * medQuality + bedOffset) * seldTend is clamped to 1,
// solve for medQuality,
// medQuality = (1 / selfTend - bedOffset) / doctorQuality
// this quality is sufficient.
StatDef statDef = StatDefOf.MedicalTendQuality;
float doctorQuality = statDef.defaultBaseValue;

StatWorker statWorker = statDef.Worker;
if (!statWorker.IsDisabledFor(doctor))
doctorQuality = statWorker.GetValue(doctor);

float bedOffset = patient.CurrentBed()?.GetStatValue(StatDefOf.MedicalTendQualityOffset) ?? 0f;
float selfTend = doctor != patient ? 1.0f : 0.7f;
return (1 / selfTend - bedOffset) / doctorQuality * Settings.Get().goodEnoughDowngradeFactor;
}

private static Thing FindBestMedicineInInventory(Pawn pawn, Pawn patient, Predicate<Thing> validatorMed, float sufficientQuality, bool isHealer)
{
if (pawn == null || pawn.inventory == null || patient == null || patient.playerSettings == null)
Expand Down
12 changes: 0 additions & 12 deletions Source/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ class Settings : ModSettings

public bool minimalMedicineForNonUrgent = false;
public bool noMedicineForNonUrgent = false;
public bool downgradeExcessiveMedicine = true;
public float goodEnoughDowngradeFactor = 1.0f;

public bool stockUp = true;
public float stockUpEnough = 1.5f;
Expand Down Expand Up @@ -79,14 +77,6 @@ public void DoWindowContents(Rect wrect)
options.CheckboxLabeled("TD.SettingNoMed".Translate(), ref noMedicineForNonUrgent,
"TD.SettingNoMedDesc".Translate());
if (noMedicineForNonUrgent) minimalMedicineForNonUrgent = false;

options.CheckboxLabeled("TD.SettingDowngrade".Translate(), ref downgradeExcessiveMedicine, "TD.SettingDowngradeDesc".Translate());
if (downgradeExcessiveMedicine)
{
goodEnoughDowngradeFactor *= 100;
options.SliderLabeled("TD.SettingMedicineGoodEnough".Translate(), ref goodEnoughDowngradeFactor, "{0:0}%", 0, 100, "TD.SettingsMedicineGoodEnoughDesc".Translate());
goodEnoughDowngradeFactor /= 100;
}
options.Gap();

options.CheckboxLabeled("TD.SettingStockUp".Translate(), ref stockUp);
Expand Down Expand Up @@ -121,8 +111,6 @@ public override void ExposeData()

Scribe_Values.Look(ref minimalMedicineForNonUrgent, "minimalMedicineForNonUrgent", false);
Scribe_Values.Look(ref noMedicineForNonUrgent, "noMedicineForNonUrgent", false);
Scribe_Values.Look(ref downgradeExcessiveMedicine, "downgradeExcessiveMedicine", true);
Scribe_Values.Look(ref goodEnoughDowngradeFactor, "goodEnoughDowngradeFactor", 1.0f);

Scribe_Values.Look(ref stockUp, "stockUp", true);
Scribe_Values.Look(ref stockUpEnough, "stockUpEnough", 1.5f);
Expand Down

0 comments on commit 530d221

Please sign in to comment.