Compare commits

...

3 commits

4 changed files with 17 additions and 9 deletions

Binary file not shown.

View file

@ -307,6 +307,7 @@ namespace RJW_Menstruation
} }
else part.TransformValue(StatRequest.For(Pawn), ref ovulationChance); else part.TransformValue(StatRequest.For(Pawn), ref ovulationChance);
} }
if (Pawn.Has(Quirk.Breeder)) ovulationChance *= 10.0f;
try try
{ {
calculatingOvulationChance = true; calculatingOvulationChance = true;
@ -322,18 +323,19 @@ namespace RJW_Menstruation
get get
{ {
float factor = 1.0f; float factor = 1.0f;
if (Pawn.Has(Quirk.Breeder)) factor = 10.0f;
if (ModsConfig.BiotechActive && xxx.is_human(Pawn)) if (ModsConfig.BiotechActive && xxx.is_human(Pawn))
{ {
// Implant factor will be based solely on pawn age, plus any rollover from ovulation chance // Implant factor will be based solely on pawn age, plus any rollover from ovulation chance
StatPart_FertilityByGenderAge fertilityStatPart = StatDefOf.Fertility.GetStatPart<StatPart_FertilityByGenderAge>(); StatPart_FertilityByGenderAge fertilityStatPart = StatDefOf.Fertility.GetStatPart<StatPart_FertilityByGenderAge>();
fertilityStatPart?.TransformValue(StatRequest.For(Pawn), ref factor); fertilityStatPart?.TransformValue(StatRequest.For(Pawn), ref factor);
float ovulationOverflow = OvulationChance; float ovulationOverflow = OvulationChance;
if (ovulationOverflow > 1.0f) factor *= ovulationOverflow; if (ovulationOverflow > 1.0f) factor *= ovulationOverflow;
return Props.baseImplantationChanceFactor * FertilityModifier * factor; return Props.baseImplantationChanceFactor * FertilityModifier * factor;
} }
else return Pawn.health.capacities.GetLevel(xxx.reproduction) * Props.baseImplantationChanceFactor * FertilityModifier * factor; else
{
return Pawn.health.capacities.GetLevel(xxx.reproduction) * Props.baseImplantationChanceFactor * FertilityModifier * factor;
}
} }
} }
@ -1593,7 +1595,6 @@ namespace RJW_Menstruation
{ {
estrusflag = false; estrusflag = false;
float eggnum; float eggnum;
int ovulated;
try try
{ {
eggnum = Math.Max(Rand.ByCurve(Pawn.def.race.litterSizeCurve), 1f); eggnum = Math.Max(Rand.ByCurve(Pawn.def.race.litterSizeCurve), 1f);
@ -1608,13 +1609,19 @@ namespace RJW_Menstruation
eggnum = 1f; eggnum = 1f;
} }
eggnum *= ovulationFactor; eggnum *= ovulationFactor;
ovulated = (int)eggnum + eggstack; int toOvulate = (int)eggnum + eggstack;
float ovulationChance = OvulationChance; 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 if (i < eggstack || Rand.Chance(ovulationChance)) // eggstack comes from drugs and are guaranteed ovulated
{
eggs.Add(new Egg((int)(EggLifespanHours / CycleFactor))); eggs.Add(new Egg((int)(EggLifespanHours / CycleFactor)));
++ovulated;
}
ovarypower -= ovulated; ovarypower -= ovulated;
if (Configurations.Debug && ovulated != toOvulate)
Log.Message($"{Pawn} ovulated {ovulated}/{toOvulate} eggs ({ovulationChance.ToStringPercent()} chance)");
eggstack = 0; eggstack = 0;
if (EggHealth <= 0) if (EggHealth <= 0)

View file

@ -228,7 +228,7 @@ namespace RJW_Menstruation
string fainfo = PregnancyCommon.GetFatherInfo(babiescomp?.babies, babiescomp.Pawn, true) + " "; // Keep all parents known, for now string fainfo = PregnancyCommon.GetFatherInfo(babiescomp?.babies, babiescomp.Pawn, true) + " "; // Keep all parents known, for now
if (feinfo == "Null") feinfo = "1 " + p.Mother.def.label + " " + Translations.Dialog_WombInfo02; if (feinfo == "Null") feinfo = "1 " + p.Mother.def.label + " " + Translations.Dialog_WombInfo02;
if (fainfo == "Null") if (fainfo == "Null ")
{ {
string father = p.Father?.LabelShort ?? Translations.Dialog_FatherUnknown; string father = p.Father?.LabelShort ?? Translations.Dialog_FatherUnknown;
fainfo = Translations.Dialog_WombInfo03 + ": " + father + " "; fainfo = Translations.Dialog_WombInfo03 + ": " + father + " ";

View file

@ -1,6 +1,7 @@
Version 1.0.8.8 Version 1.0.8.8
- Fix pawns skipping straight to menopause instead of going through climacteric stages. - Fix pawns skipping straight to menopause instead of going through climacteric stages.
- Rework ovulation mechanics. A pawn's implantation chance is now dependent on their age. - Fix father appearing as "Null" in womb dialog for some Biotech pregnancies.
- Rework ovulation mechanics. A pawn's implantation chance is now dependent only on their age.
- All other fertility-altering effects instead change the odds of ovulation occuring, rolled per-egg. This chance appears in the womb dialog. - All other fertility-altering effects instead change the odds of ovulation occuring, rolled per-egg. This chance appears in the womb dialog.
- If the chance of ovulation goes above 100%, the implantation chance is increased. - If the chance of ovulation goes above 100%, the implantation chance is increased.
- Drugs that increase the number of eggs ovulated are still guaranteed to work. - Drugs that increase the number of eggs ovulated are still guaranteed to work.