Simplify the too young/old check in the ovulation calculation a little

This commit is contained in:
lutepickle 2023-12-05 16:20:17 -08:00
parent 8cc72acf36
commit cb8d824a2c
1 changed files with 5 additions and 10 deletions

View File

@ -308,18 +308,13 @@ namespace RJW_Menstruation
if (ModsConfig.BiotechActive && xxx.is_human(Pawn))
{
if (Pawn.SterileGenes()) return 0.0f;
// Replicate how rjw.PawnCapacityWorker_Fertility.CalculateCapacityLevel does it, but without the age factor
if (!Pawn.RaceHasFertility()) return 0.0f;
if (AndroidsCompatibility.IsAndroid(Pawn) && parent.def != Genital_Helper.archotech_vagina) return 0.0f;
foreach (StatPart part in StatDefOf.Fertility.parts)
{
if(part is StatPart_FertilityByGenderAge fertilityByAge)
{
float factor = 1.0f;
fertilityByAge.TransformValue(StatRequest.For(Pawn), ref factor);
if (factor <= 0.0f) return 0.0f; // Too young or too old
}
}
float ageFactor = 1.0f;
StatDefOf.Fertility.GetStatPart<StatPart_FertilityByGenderAge>()?.TransformValue(StatRequest.For(Pawn), ref ageFactor);
if (ageFactor <= 0.0f) return 0.0f; // Too young or too old
if (Pawn.HasQuirk(QuirkUtility.Quirks.Breeder)) ovulationChance *= 10.0f;
try
{