Only decrement ovary power by eggs actually ovulated, debug log under-ovulations

This commit is contained in:
lutepickle 2023-03-11 10:21:25 -08:00
parent 65b69eaf76
commit c05d8bad79
1 changed files with 9 additions and 4 deletions

View File

@ -306,7 +306,7 @@ namespace RJW_Menstruation
if (factor <= 0.0f) return 0.0f; // Too young or too old
}
else part.TransformValue(StatRequest.For(Pawn), ref ovulationChance);
}
}
if (Pawn.Has(Quirk.Breeder)) ovulationChance *= 10.0f;
try
{
@ -1595,7 +1595,6 @@ namespace RJW_Menstruation
{
estrusflag = false;
float eggnum;
int ovulated;
try
{
eggnum = Math.Max(Rand.ByCurve(Pawn.def.race.litterSizeCurve), 1f);
@ -1610,13 +1609,19 @@ namespace RJW_Menstruation
eggnum = 1f;
}
eggnum *= ovulationFactor;
ovulated = (int)eggnum + eggstack;
int toOvulate = (int)eggnum + eggstack;
float ovulationChance = OvulationChance;
for (int i = 0; i < ovulated; i++)
int ovulated = 0;
for (int i = 0; i < toOvulate; i++)
if (i < eggstack || Rand.Chance(ovulationChance)) // eggstack comes from drugs and are guaranteed ovulated
{
eggs.Add(new Egg((int)(EggLifespanHours / CycleFactor)));
++ovulated;
}
ovarypower -= ovulated;
if (Configurations.Debug && ovulated != toOvulate)
Log.Message($"{Pawn} ovulated {ovulated}/{toOvulate} eggs ({ovulationChance.ToStringPercent()} chance)");
eggstack = 0;
if (EggHealth <= 0)