mirror of
https://gitgud.io/lutepickle/rjw_menstruation.git
synced 2024-08-14 22:46:52 +00:00
Have CalculatedImplantChance use the cached ovulation chance
This commit is contained in:
parent
e43a50522b
commit
a38d81424a
1 changed files with 3 additions and 5 deletions
|
@ -336,8 +336,7 @@ namespace RJW_Menstruation
|
||||||
// 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;
|
if (OvulationChance > 1.0f) factor *= OvulationChance;
|
||||||
if (ovulationOverflow > 1.0f) factor *= ovulationOverflow;
|
|
||||||
return Props.baseImplantationChanceFactor * FertilityModifier * factor;
|
return Props.baseImplantationChanceFactor * FertilityModifier * factor;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1642,10 +1641,9 @@ namespace RJW_Menstruation
|
||||||
eggnum *= ovulationFactor;
|
eggnum *= ovulationFactor;
|
||||||
int toOvulate = (int)eggnum + eggstack;
|
int toOvulate = (int)eggnum + eggstack;
|
||||||
|
|
||||||
float ovulationChance = OvulationChance;
|
|
||||||
int ovulated = 0;
|
int ovulated = 0;
|
||||||
for (int i = 0; i < toOvulate; i++)
|
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)(EggLifespanTicks / CycleFactor)));
|
eggs.Add(new Egg((int)(EggLifespanTicks / CycleFactor)));
|
||||||
++ovulated;
|
++ovulated;
|
||||||
|
@ -1653,7 +1651,7 @@ namespace RJW_Menstruation
|
||||||
ovarypower -= ovulated;
|
ovarypower -= ovulated;
|
||||||
eggstack = 0;
|
eggstack = 0;
|
||||||
if (Configurations.Debug && ovulated != toOvulate)
|
if (Configurations.Debug && ovulated != toOvulate)
|
||||||
Log.Message($"{Pawn} ovulated {ovulated}/{toOvulate} eggs ({ovulationChance.ToStringPercent()} chance)");
|
Log.Message($"{Pawn} ovulated {ovulated}/{toOvulate} eggs ({OvulationChance.ToStringPercent()} chance)");
|
||||||
|
|
||||||
GoNextStage(Stage.Luteal);
|
GoNextStage(Stage.Luteal);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue