mirror of
https://gitgud.io/lutepickle/rjw_menstruation.git
synced 2024-08-14 22:46:52 +00:00
Merge branch 'main' into bugfixes
This commit is contained in:
commit
6e022789a2
3 changed files with 40 additions and 25 deletions
Binary file not shown.
|
@ -52,6 +52,12 @@ namespace RJW_Menstruation
|
|||
{
|
||||
p.GetMenstruationComp().eggstack++;
|
||||
}
|
||||
|
||||
[DebugAction("RJW Menstruation", "Recalculate pawn's ovary power", false, false, actionType = DebugActionType.ToolMapForPawns, allowedGameStates = AllowedGameStates.Playing)]
|
||||
private static void RecalculateOvaryPower(Pawn p)
|
||||
{
|
||||
p.GetMenstruationComp().ovarypower = p.GetMenstruationComp().GetOvaryPowerByAge(p);
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore IDE0051 // Remove unused private members
|
|
@ -878,7 +878,8 @@ namespace RJW_Menstruation
|
|||
if (follicularIntervalhours < 0)
|
||||
{
|
||||
follicularIntervalhours = PeriodRandomizer(Props.folicularIntervalDays * 24, Props.deviationFactor);
|
||||
curStage = RandomStage();
|
||||
if (parent.pawn.health.capacities.GetLevel(xxx.reproduction) <= 0) curStage = Stage.Young;
|
||||
else curStage = RandomStage();
|
||||
}
|
||||
|
||||
if (lutealIntervalhours < 0) lutealIntervalhours = PeriodRandomizer(Props.lutealIntervalDays * 24, Props.deviationFactor);
|
||||
|
@ -928,6 +929,36 @@ namespace RJW_Menstruation
|
|||
loaded = true;
|
||||
}
|
||||
|
||||
public int GetOvaryPowerByAge(Pawn pawn)
|
||||
{
|
||||
int power;
|
||||
float avglittersize;
|
||||
try
|
||||
{
|
||||
avglittersize = Rand.ByCurveAverage(pawn.def.race.litterSizeCurve);
|
||||
}
|
||||
catch (NullReferenceException)
|
||||
{
|
||||
avglittersize = 1;
|
||||
}
|
||||
|
||||
//Old one. Sex minimum age based.
|
||||
//ovarypower = (int)(((Props.ovaryPower * Utility.RandGaussianLike(0.70f, 1.30f) * parent.pawn.def.race.lifeExpectancy / ThingDefOf.Human.race.lifeExpectancy)
|
||||
// - (Math.Max(0, ageYear - RJWSettings.sex_minimum_age * parent.pawn.def.race.lifeExpectancy / ThingDefOf.Human.race.lifeExpectancy))
|
||||
// * (60 / (Props.folicularIntervalDays + Props.lutealIntervalDays) * Configurations.CycleAcceleration)) * avglittersize);
|
||||
|
||||
//New one.
|
||||
float fertendage, lifenormalized;
|
||||
if (pawn.IsAnimal()) fertendage = RJWPregnancySettings.fertility_endage_female_animal * 100f;
|
||||
else fertendage = RJWPregnancySettings.fertility_endage_female_humanlike * 80f;
|
||||
lifenormalized = pawn.def.race.lifeExpectancy / ThingDefOf.Human.race.lifeExpectancy;
|
||||
fertendage *= lifenormalized;
|
||||
power = (int)((fertendage - pawn.ageTracker.AgeBiologicalYearsFloat) * (60f / (Props.folicularIntervalDays + Props.lutealIntervalDays) * Configurations.CycleAcceleration) * avglittersize);
|
||||
power = (int)Mathf.Max(0, Mathf.Min(Props.ovaryPower * Utility.RandGaussianLike(0.70f, 1.30f, 5) * lifenormalized, power));
|
||||
|
||||
return power;
|
||||
}
|
||||
|
||||
protected void InitOvary()
|
||||
{
|
||||
if (!Configurations.EnableMenopause)
|
||||
|
@ -939,30 +970,7 @@ namespace RJW_Menstruation
|
|||
if (Props.ovaryPower > 10000000) ovarypower = Props.ovaryPower;
|
||||
else
|
||||
{
|
||||
float avglittersize;
|
||||
try
|
||||
{
|
||||
avglittersize = Rand.ByCurveAverage(parent.pawn.def.race.litterSizeCurve);
|
||||
}
|
||||
catch (NullReferenceException)
|
||||
{
|
||||
avglittersize = 1;
|
||||
}
|
||||
|
||||
//Old one. Sex minimum age based.
|
||||
//ovarypower = (int)(((Props.ovaryPower * Utility.RandGaussianLike(0.70f, 1.30f) * parent.pawn.def.race.lifeExpectancy / ThingDefOf.Human.race.lifeExpectancy)
|
||||
// - (Math.Max(0, ageYear - RJWSettings.sex_minimum_age * parent.pawn.def.race.lifeExpectancy / ThingDefOf.Human.race.lifeExpectancy))
|
||||
// * (60 / (Props.folicularIntervalDays + Props.lutealIntervalDays) * Configurations.CycleAcceleration)) * avglittersize);
|
||||
|
||||
//New one.
|
||||
float fertendage, lifenormalized;
|
||||
if (parent.pawn.IsAnimal()) fertendage = RJWPregnancySettings.fertility_endage_female_animal * 100f;
|
||||
else fertendage = RJWPregnancySettings.fertility_endage_female_humanlike * 80f;
|
||||
lifenormalized = parent.pawn.def.race.lifeExpectancy / ThingDefOf.Human.race.lifeExpectancy;
|
||||
fertendage *= lifenormalized;
|
||||
ovarypower = (int)((fertendage - parent.pawn.ageTracker.AgeBiologicalYearsFloat) * (60f / (Props.folicularIntervalDays + Props.lutealIntervalDays) * Configurations.CycleAcceleration) * avglittersize);
|
||||
ovarypower = (int)Mathf.Max(0, Mathf.Min(Props.ovaryPower * Utility.RandGaussianLike(0.70f,1.30f,5) * lifenormalized,ovarypower));
|
||||
|
||||
ovarypower = GetOvaryPowerByAge(parent.pawn);
|
||||
if (ovarypower < 1)
|
||||
{
|
||||
Hediff hediff = HediffMaker.MakeHediff(VariousDefOf.Hediff_Menopause, parent.pawn);
|
||||
|
@ -976,6 +984,7 @@ namespace RJW_Menstruation
|
|||
hediff.Severity = 0.008f * (OvaryPowerThreshold - ovarypower);
|
||||
parent.pawn.health.AddHediff(hediff, Genital_Helper.get_genitalsBPR(parent.pawn));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue