mirror of
https://gitgud.io/lutepickle/rjw_menstruation.git
synced 2024-08-14 22:46:52 +00:00
Add debug action to recalculate ovary power
This commit is contained in:
parent
38b16c75c3
commit
23b09b0fa9
3 changed files with 38 additions and 24 deletions
Binary file not shown.
|
@ -52,6 +52,12 @@ namespace RJW_Menstruation
|
||||||
{
|
{
|
||||||
p.GetMenstruationComp().eggstack++;
|
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
|
#pragma warning restore IDE0051 // Remove unused private members
|
|
@ -914,21 +914,13 @@ namespace RJW_Menstruation
|
||||||
loaded = true;
|
loaded = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void InitOvary()
|
public int GetOvaryPowerByAge(Pawn pawn)
|
||||||
{
|
|
||||||
if (!Configurations.EnableMenopause)
|
|
||||||
{
|
|
||||||
RemoveClimactericEffect();
|
|
||||||
}
|
|
||||||
else if (ovarypower < -50000)
|
|
||||||
{
|
|
||||||
if (Props.ovaryPower > 10000000) ovarypower = Props.ovaryPower;
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
|
int power;
|
||||||
float avglittersize;
|
float avglittersize;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
avglittersize = Rand.ByCurveAverage(parent.pawn.def.race.litterSizeCurve);
|
avglittersize = Rand.ByCurveAverage(pawn.def.race.litterSizeCurve);
|
||||||
}
|
}
|
||||||
catch (NullReferenceException)
|
catch (NullReferenceException)
|
||||||
{
|
{
|
||||||
|
@ -942,13 +934,28 @@ namespace RJW_Menstruation
|
||||||
|
|
||||||
//New one.
|
//New one.
|
||||||
float fertendage, lifenormalized;
|
float fertendage, lifenormalized;
|
||||||
if (parent.pawn.IsAnimal()) fertendage = RJWPregnancySettings.fertility_endage_female_animal * 100f;
|
if (pawn.IsAnimal()) fertendage = RJWPregnancySettings.fertility_endage_female_animal * 100f;
|
||||||
else fertendage = RJWPregnancySettings.fertility_endage_female_humanlike * 80f;
|
else fertendage = RJWPregnancySettings.fertility_endage_female_humanlike * 80f;
|
||||||
lifenormalized = parent.pawn.def.race.lifeExpectancy / ThingDefOf.Human.race.lifeExpectancy;
|
lifenormalized = pawn.def.race.lifeExpectancy / ThingDefOf.Human.race.lifeExpectancy;
|
||||||
fertendage *= lifenormalized;
|
fertendage *= lifenormalized;
|
||||||
ovarypower = (int)((fertendage - parent.pawn.ageTracker.AgeBiologicalYearsFloat) * (60f / (Props.folicularIntervalDays + Props.lutealIntervalDays) * Configurations.CycleAcceleration) * avglittersize);
|
power = (int)((fertendage - 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));
|
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)
|
||||||
|
{
|
||||||
|
RemoveClimactericEffect();
|
||||||
|
}
|
||||||
|
else if (ovarypower < -50000)
|
||||||
|
{
|
||||||
|
if (Props.ovaryPower > 10000000) ovarypower = Props.ovaryPower;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ovarypower = GetOvaryPowerByAge(parent.pawn);
|
||||||
if (ovarypower < 1)
|
if (ovarypower < 1)
|
||||||
{
|
{
|
||||||
Hediff hediff = HediffMaker.MakeHediff(VariousDefOf.Hediff_Menopause, parent.pawn);
|
Hediff hediff = HediffMaker.MakeHediff(VariousDefOf.Hediff_Menopause, parent.pawn);
|
||||||
|
@ -962,6 +969,7 @@ namespace RJW_Menstruation
|
||||||
hediff.Severity = 0.008f * (OvaryPowerThreshold - ovarypower);
|
hediff.Severity = 0.008f * (OvaryPowerThreshold - ovarypower);
|
||||||
parent.pawn.health.AddHediff(hediff, Genital_Helper.get_genitalsBPR(parent.pawn));
|
parent.pawn.health.AddHediff(hediff, Genital_Helper.get_genitalsBPR(parent.pawn));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue