Always attempt to ovulate at least one egg

This commit is contained in:
lutepickle 2024-02-11 07:30:25 -08:00
parent bd39194fd1
commit 82dea0f425

View file

@ -681,10 +681,8 @@ namespace RJW_Menstruation
opcache = -1;
if (Pawn.genes == null || !ModsConfig.BiotechActive) return;
foreach (MenstruationModExtension extension in Pawn.genes.GenesListForReading.Select(gene => gene.def.GetModExtension<MenstruationModExtension>()))
foreach (MenstruationModExtension extension in Pawn.genes.GenesListForReading.Select(gene => gene.def.GetModExtension<MenstruationModExtension>()).Where(ext => ext != null))
{
if (extension == null) continue;
eggLifeSpanTicks = (int)(eggLifeSpanTicks * extension.eggLifeTimeFactor);
if (extension.alwaysEstrus) estrusLevel = EstrusLevel.Visible;
else if (extension.neverEstrus) estrusLevel = EstrusLevel.None;
@ -1656,7 +1654,7 @@ namespace RJW_Menstruation
eggnum = 1f;
}
eggnum *= ovulationFactor;
int toOvulate = (int)eggnum + eggstack;
int toOvulate = Math.Max(1, (int)eggnum + eggstack);
int ovulated = 0;
for (int i = 0; i < toOvulate; i++)
@ -1667,7 +1665,7 @@ namespace RJW_Menstruation
}
ovarypower -= ovulated;
eggstack = 0;
if (Configurations.Debug && ovulated != toOvulate)
if (Configurations.Debug && ovulated < toOvulate)
Log.Message($"{Pawn} ovulated {ovulated}/{toOvulate} eggs ({OvulationChance.ToStringPercent()} chance)");
GoNextStage(Stage.Luteal);