mirror of
https://gitgud.io/lutepickle/rjw_menstruation.git
synced 2024-08-14 22:46:52 +00:00
Implement exponential fertilization chance
This commit is contained in:
parent
8a048ea7e5
commit
a90d6bf343
2 changed files with 5 additions and 5 deletions
|
@ -1078,7 +1078,7 @@ namespace RJW_Menstruation
|
|||
foreach (Cum cum in eligibleCum)
|
||||
totalFertPower += cum.FertVolume;
|
||||
|
||||
if (Rand.Range(0.0f, 1.0f) > totalFertPower * Configurations.FertilizeChance * Props.basefertilizationChanceFactor)
|
||||
if (Rand.Range(0.0f, 1.0f) > 1.0f - Mathf.Pow(1.0f - Configurations.FertilizeChance, totalFertPower * Props.basefertilizationChanceFactor))
|
||||
return null;
|
||||
|
||||
parent.pawn.records.AddTo(VariousDefOf.AmountofFertilizedEggs, 1);
|
||||
|
@ -1438,7 +1438,7 @@ namespace RJW_Menstruation
|
|||
{
|
||||
Hediff hediff = parent.pawn.health.hediffSet.GetFirstHediffOfDef(VariousDefOf.Hediff_MenstrualCramp);
|
||||
if (hediff != null) parent.pawn.health.RemoveHediff(hediff);
|
||||
int totalFollicularHours = PeriodRandomizer(climacteric ? Stage.ClimactericFollicular : Stage.Follicular, climacteric ? 6f : 1f); // The total amount of time for both bleeding and follicular
|
||||
int totalFollicularHours = PeriodRandomizer(climacteric ? Stage.ClimactericFollicular : Stage.Follicular, climacteric ? 6.0f : 1.0f); // The total amount of time for both bleeding and follicular
|
||||
if (totalFollicularHours <= currentIntervalHours) // We've bled for so long that we completely missed the follicular phase
|
||||
GoNextStage(Stage.Ovulatory);
|
||||
else
|
||||
|
@ -1687,7 +1687,7 @@ namespace RJW_Menstruation
|
|||
protected void GoNextStage(Stage nextstage, bool calculateHours = true)
|
||||
{
|
||||
curStageHrs = 0;
|
||||
float variabilityFactor = nextstage == Stage.ClimactericFollicular || nextstage == Stage.ClimactericLuteal || nextstage == Stage.ClimactericBleeding ? 6f : 1f;
|
||||
float variabilityFactor = nextstage == Stage.ClimactericFollicular || nextstage == Stage.ClimactericLuteal || nextstage == Stage.ClimactericBleeding ? 6.0f : 1.0f;
|
||||
if (calculateHours) currentIntervalHours = PeriodRandomizer(nextstage, variabilityFactor);
|
||||
curStage = nextstage;
|
||||
HugsLibController.Instance.TickDelayScheduler.ScheduleCallback(PeriodSimulator(nextstage), GetNextUpdate(), parent.pawn, false);
|
||||
|
@ -1733,7 +1733,7 @@ namespace RJW_Menstruation
|
|||
return intervalhours + (int)(intervalhours * Rand.Range(-deviation, deviation));
|
||||
}
|
||||
|
||||
protected int PeriodRandomizer(Stage stage, float variabilityFactor = 1f)
|
||||
protected int PeriodRandomizer(Stage stage, float variabilityFactor = 1.0f)
|
||||
{
|
||||
// Most cycle lengthening or shortening occurs in the follicular phase, so weight towards that
|
||||
switch (stage)
|
||||
|
|
|
@ -66,7 +66,7 @@ namespace RJW_Menstruation
|
|||
|
||||
public static float GetFertilityChance(this HediffComp_Menstruation comp)
|
||||
{
|
||||
return comp.TotalFertCum * Configurations.FertilizeChance * comp.Props.basefertilizationChanceFactor;
|
||||
return 1.0f - Mathf.Pow(1.0f - Configurations.FertilizeChance, comp.TotalFertCum * comp.Props.basefertilizationChanceFactor);
|
||||
}
|
||||
|
||||
public static HediffComp_Menstruation.Stage GetCurStage(this Pawn pawn)
|
||||
|
|
Loading…
Reference in a new issue