Encapsulate calculatingOvulationChance

This commit is contained in:
lutepickle 2023-05-18 22:37:31 -07:00
parent 924dc73024
commit ff22e534d1
2 changed files with 3 additions and 2 deletions

View File

@ -296,7 +296,8 @@ namespace RJW_Menstruation
} }
// I hate doing this, but it's the least bad option // 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() protected float CalcuatedOvulationChance()
{ {

View File

@ -378,7 +378,7 @@ namespace RJW_Menstruation
private static float GetFertilityStatOrOne(Thing thing, StatDef stat, bool applyPostProcess, int cacheStaleAfterTicks) private static float GetFertilityStatOrOne(Thing thing, StatDef stat, bool applyPostProcess, int cacheStaleAfterTicks)
{ {
Pawn pawn = (Pawn)thing; Pawn pawn = (Pawn)thing;
if (pawn.GetMenstruationComps().Any(comp => comp.calculatingOvulationChance)) if (pawn.GetMenstruationComps().Any(comp => comp.CalculatingOvulationChance))
return 1.0f; return 1.0f;
else return thing.GetStatValue(stat, applyPostProcess, cacheStaleAfterTicks); else return thing.GetStatValue(stat, applyPostProcess, cacheStaleAfterTicks);
} }