Make induced ovulator egg count based on potential pregnancies.

This commit is contained in:
lutepickle 2022-08-30 20:07:21 -07:00
parent 6da6e9388c
commit bdfbcf1edf
5 changed files with 9 additions and 13 deletions

Binary file not shown.

View File

@ -1,4 +1,5 @@
using RimWorld;
using UnityEngine;
using Verse;
namespace RJW_Menstruation
@ -30,21 +31,15 @@ namespace RJW_Menstruation
}
}
// The maximum theoretical rate of ovulation is inducing the moment it goes follicular and no pregnancies
// There will be far more eggs than will ever actually be produced, but it fits the induced ovulator philosophy
// In an induced ovulator, about 65% of eggs ovulated will become pregnancies, so the expected lifetime supply
// is the number of pregnancies they could have, with some extra to be sure.
// An IUD or a poor fertility mate could run this down quicker. Oh well.
protected override float RaceCyclesPerYear()
{
int breedingSeasons = 0;
if (Props.breedingSeason == SeasonalBreed.Always) breedingSeasons = 4;
else
{
if ((Props.breedingSeason & SeasonalBreed.Spring) != 0) breedingSeasons++;
if ((Props.breedingSeason & SeasonalBreed.Summer) != 0) breedingSeasons++;
if ((Props.breedingSeason & SeasonalBreed.Fall) != 0) breedingSeasons++;
if ((Props.breedingSeason & SeasonalBreed.Winter) != 0) breedingSeasons++;
}
float breedingRatio = breedingSeasons / 4.0f;
return breedingRatio * GenDate.DaysPerYear / ((float)(Props.lutealIntervalDays + Props.bleedingIntervalDays) / Configurations.CycleAccelerationDefault);
// Don't bother with breeding season, since so much time is planned to be spent pregnant.
float pregnanciesPerYear = GenDate.DaysPerYear / Mathf.Max(1, Pawn.def.race.gestationPeriodDays);
return 2 * pregnanciesPerYear / Configurations.ImplantationChanceDefault;
}
// There's really no good way to estimate the number of times it's been induced, so this is all we can do

View File

@ -1,5 +1,6 @@
Version 1.0.7.4
- Fix errors when using mods with bad HediffCompProperties.
- Induced ovulators will start with a lower number of eggs, but reasonably enough for a long breeding life. IUDs or sex with poor fertility partners may result in early menopause.
- Updated max size areola images by wruf.
- Title addition on pregnancy removed to match RJW 5.1.0.
- Improve compatibility with RJW 5.1.0 for multiple wombs.