From ff22e534d12a95e065305887598dfebd8d2e3840 Mon Sep 17 00:00:00 2001 From: lutepickle <28810-lutepickle@users.noreply.gitgud.io> Date: Thu, 18 May 2023 22:37:31 -0700 Subject: [PATCH] Encapsulate calculatingOvulationChance --- .../RJW_Menstruation/HediffComps/HediffComp_Menstruation.cs | 3 ++- .../RJW_Menstruation/RJW_Menstruation/Patch/RJW_Patch.cs | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/1.4/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_Menstruation.cs b/1.4/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_Menstruation.cs index 1d3f2d4..9e32774 100644 --- a/1.4/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_Menstruation.cs +++ b/1.4/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_Menstruation.cs @@ -296,7 +296,8 @@ namespace RJW_Menstruation } // I hate doing this, but it's the least bad option - public bool calculatingOvulationChance = false; + private bool calculatingOvulationChance = false; + public bool CalculatingOvulationChance { get => calculatingOvulationChance; } protected float CalcuatedOvulationChance() { diff --git a/1.4/source/RJW_Menstruation/RJW_Menstruation/Patch/RJW_Patch.cs b/1.4/source/RJW_Menstruation/RJW_Menstruation/Patch/RJW_Patch.cs index 57a6b9d..fdb90d9 100644 --- a/1.4/source/RJW_Menstruation/RJW_Menstruation/Patch/RJW_Patch.cs +++ b/1.4/source/RJW_Menstruation/RJW_Menstruation/Patch/RJW_Patch.cs @@ -378,7 +378,7 @@ namespace RJW_Menstruation private static float GetFertilityStatOrOne(Thing thing, StatDef stat, bool applyPostProcess, int cacheStaleAfterTicks) { Pawn pawn = (Pawn)thing; - if (pawn.GetMenstruationComps().Any(comp => comp.calculatingOvulationChance)) + if (pawn.GetMenstruationComps().Any(comp => comp.CalculatingOvulationChance)) return 1.0f; else return thing.GetStatValue(stat, applyPostProcess, cacheStaleAfterTicks); }