mirror of
https://gitgud.io/lutepickle/rjw_menstruation.git
synced 2024-08-14 22:46:52 +00:00
Some checks for initializing the currentIntervalHours. Also fix the capitalization
This commit is contained in:
parent
07221e01a8
commit
258f68a88d
2 changed files with 28 additions and 24 deletions
|
@ -48,7 +48,7 @@ namespace RJW_Menstruation
|
|||
GoNextStage(Stage.Anestrus);
|
||||
return;
|
||||
}
|
||||
if (curStageHrs >= currentIntervalhours)
|
||||
if (curStageHrs >= currentIntervalHours)
|
||||
{
|
||||
estrusflag = false;
|
||||
GoNextStage(climacteric ? Stage.ClimactericLuteal : Stage.Luteal);
|
||||
|
@ -61,7 +61,7 @@ namespace RJW_Menstruation
|
|||
else
|
||||
{
|
||||
curStageHrs += Configurations.CycleAcceleration;
|
||||
if (!estrusflag && curStageHrs > currentIntervalhours - Props.estrusDaysBeforeOvulation * 24)
|
||||
if (!estrusflag && curStageHrs > currentIntervalHours - Props.estrusDaysBeforeOvulation * 24)
|
||||
{
|
||||
estrusflag = true;
|
||||
SetEstrus(Props.eggLifespanDays + Props.estrusDaysBeforeOvulation);
|
||||
|
|
|
@ -111,7 +111,7 @@ namespace RJW_Menstruation
|
|||
protected List<Egg> eggs;
|
||||
protected float cycleSpeed = -1;
|
||||
protected float cycleVariability = -1;
|
||||
protected int currentIntervalhours = -1;
|
||||
protected int currentIntervalHours = -1;
|
||||
protected float crampPain = -1;
|
||||
protected Need sexNeed = null;
|
||||
protected string customwombtex = null;
|
||||
|
@ -433,7 +433,7 @@ namespace RJW_Menstruation
|
|||
{
|
||||
case Stage.Follicular:
|
||||
case Stage.ClimactericFollicular:
|
||||
return curStageHrs > 0.7f * currentIntervalhours;
|
||||
return curStageHrs > 0.7f * currentIntervalHours;
|
||||
case Stage.Ovulatory:
|
||||
return true;
|
||||
case Stage.Luteal:
|
||||
|
@ -500,7 +500,7 @@ namespace RJW_Menstruation
|
|||
{
|
||||
get
|
||||
{
|
||||
return currentIntervalhours;
|
||||
return currentIntervalHours;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -530,7 +530,7 @@ namespace RJW_Menstruation
|
|||
Scribe_Values.Look(ref curStageHrs, "curStageHrs", curStageHrs, true);
|
||||
Scribe_Values.Look(ref cycleSpeed, "cycleSpeed", cycleSpeed, true);
|
||||
Scribe_Values.Look(ref cycleVariability, "cycleVariability", cycleVariability, true);
|
||||
Scribe_Values.Look(ref currentIntervalhours, "currentIntervalhours", currentIntervalhours, true);
|
||||
Scribe_Values.Look(ref currentIntervalHours, "currentIntervalHours", currentIntervalHours, true);
|
||||
Scribe_Values.Look(ref crampPain, "crampPain", crampPain, true);
|
||||
Scribe_Values.Look(ref ovarypower, "ovarypower", ovarypower, true);
|
||||
Scribe_Values.Look(ref eggstack, "eggstack", eggstack, true);
|
||||
|
@ -899,13 +899,17 @@ namespace RJW_Menstruation
|
|||
{
|
||||
if (cycleSpeed < 0f) cycleSpeed = Utility.RandGaussianLike(0.8f, 1.2f);
|
||||
if (cycleVariability < 0f) cycleVariability = Utility.RandomVariabilityPercent();
|
||||
if (currentIntervalhours < 0)
|
||||
{
|
||||
//follicularIntervalhours = PeriodRandomizer(Props.follicularIntervalDays * 24, Props.deviationFactor);
|
||||
if (currentIntervalHours < 0)
|
||||
{;
|
||||
if (parent.pawn.health.capacities.GetLevel(xxx.reproduction) <= 0) curStage = Stage.Young;
|
||||
else if (!IsBreedingSeason()) curStage = Stage.Anestrus;
|
||||
else curStage = RandomStage();
|
||||
currentIntervalhours = PeriodRandomizer(curStage);
|
||||
if (curStage == Stage.Follicular)
|
||||
currentIntervalHours = PeriodRandomizer(Stage.Follicular) - PeriodRandomizer(Stage.Bleeding);
|
||||
else
|
||||
currentIntervalHours = PeriodRandomizer(curStage);
|
||||
if (currentIntervalHours <= 0) currentIntervalHours = 1;
|
||||
else if (currentIntervalHours < curStageHrs) curStageHrs = currentIntervalHours;
|
||||
}
|
||||
if (crampPain < 0) crampPain = PainRandomizer();
|
||||
if (cums == null) cums = new List<Cum>();
|
||||
|
@ -922,7 +926,7 @@ namespace RJW_Menstruation
|
|||
{
|
||||
if (hediff is Hediff_BasePregnancy preg)
|
||||
{
|
||||
currentIntervalhours = (int)(preg.GestationHours());
|
||||
currentIntervalHours = (int)(preg.GestationHours());
|
||||
curStage = Stage.Pregnant;
|
||||
}
|
||||
}
|
||||
|
@ -1158,7 +1162,7 @@ namespace RJW_Menstruation
|
|||
{
|
||||
PregnancyHelper.PregnancyDecider(parent.pawn, egg.fertilizer);
|
||||
Hediff_BasePregnancy hediff = (Hediff_BasePregnancy)PregnancyHelper.GetPregnancy(parent.pawn);
|
||||
currentIntervalhours = (int)hediff?.GestationHours();
|
||||
currentIntervalHours = (int)hediff?.GestationHours();
|
||||
pregnant = true;
|
||||
break;
|
||||
}
|
||||
|
@ -1166,7 +1170,7 @@ namespace RJW_Menstruation
|
|||
{
|
||||
Hediff_BasePregnancy.Create<Hediff_MultiplePregnancy>(parent.pawn, egg.fertilizer);
|
||||
Hediff_BasePregnancy hediff = (Hediff_BasePregnancy)PregnancyHelper.GetPregnancy(parent.pawn);
|
||||
currentIntervalhours = (int)hediff?.GestationHours();
|
||||
currentIntervalHours = (int)hediff?.GestationHours();
|
||||
|
||||
pregnant = true;
|
||||
deadeggs.Add(egg);
|
||||
|
@ -1294,7 +1298,7 @@ namespace RJW_Menstruation
|
|||
Hediff hediff = HediffMaker.MakeHediff(VariousDefOf.Hediff_MenstrualCramp, parent.pawn);
|
||||
hediff.Severity = crampPain * Rand.Range(0.9f, 1.1f);
|
||||
HediffCompProperties_SeverityPerDay Prop = (HediffCompProperties_SeverityPerDay)hediff.TryGetComp<HediffComp_SeverityPerDay>().props;
|
||||
Prop.severityPerDay = -hediff.Severity / (currentIntervalhours / 24) * Configurations.CycleAcceleration;
|
||||
Prop.severityPerDay = -hediff.Severity / (currentIntervalHours / 24) * Configurations.CycleAcceleration;
|
||||
parent.pawn.health.AddHediff(hediff, Genital_Helper.get_genitalsBPR(parent.pawn));
|
||||
}
|
||||
|
||||
|
@ -1310,7 +1314,7 @@ namespace RJW_Menstruation
|
|||
GoNextStage(Stage.Anestrus);
|
||||
return;
|
||||
}
|
||||
if (curStageHrs >= currentIntervalhours)
|
||||
if (curStageHrs >= currentIntervalHours)
|
||||
{
|
||||
GoNextStage(Stage.Ovulatory);
|
||||
}
|
||||
|
@ -1321,7 +1325,7 @@ namespace RJW_Menstruation
|
|||
else
|
||||
{
|
||||
curStageHrs += Configurations.CycleAcceleration;
|
||||
if (!estrusflag && curStageHrs > currentIntervalhours - Props.estrusDaysBeforeOvulation * 24)
|
||||
if (!estrusflag && curStageHrs > currentIntervalHours - Props.estrusDaysBeforeOvulation * 24)
|
||||
{
|
||||
estrusflag = true;
|
||||
SetEstrus(Props.eggLifespanDays + Props.estrusDaysBeforeOvulation);
|
||||
|
@ -1405,7 +1409,7 @@ namespace RJW_Menstruation
|
|||
StayCurrentStage();
|
||||
}
|
||||
}
|
||||
else if (curStageHrs <= currentIntervalhours)
|
||||
else if (curStageHrs <= currentIntervalHours)
|
||||
{
|
||||
curStageHrs += Configurations.CycleAcceleration;
|
||||
StayCurrentStage();
|
||||
|
@ -1439,22 +1443,22 @@ namespace RJW_Menstruation
|
|||
RemoveClimactericEffect();
|
||||
StayCurrentStage();
|
||||
}
|
||||
else if (curStageHrs >= currentIntervalhours)
|
||||
else if (curStageHrs >= currentIntervalHours)
|
||||
{
|
||||
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
|
||||
if (totalFollicularHours <= currentIntervalhours) // We've bled for so long that we completely missed the follicular phase
|
||||
if (totalFollicularHours <= currentIntervalHours) // We've bled for so long that we completely missed the follicular phase
|
||||
GoNextStage(Stage.Ovulatory);
|
||||
else
|
||||
{
|
||||
currentIntervalhours = totalFollicularHours - currentIntervalhours; // I.e., the remaining follicular hours equals the total minus the bleeding hours elapsed
|
||||
currentIntervalHours = totalFollicularHours - currentIntervalHours; // I.e., the remaining follicular hours equals the total minus the bleeding hours elapsed
|
||||
GoNextStage(climacteric ? Stage.ClimactericFollicular : Stage.Follicular, false);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (curStageHrs < currentIntervalhours / 4) for (int i = 0; i < Configurations.CycleAcceleration; i++) BleedOut();
|
||||
if (curStageHrs < currentIntervalHours / 4) for (int i = 0; i < Configurations.CycleAcceleration; i++) BleedOut();
|
||||
curStageHrs += Configurations.CycleAcceleration;
|
||||
StayCurrentStage();
|
||||
}
|
||||
|
@ -1486,7 +1490,7 @@ namespace RJW_Menstruation
|
|||
|
||||
protected virtual void RecoverAction()
|
||||
{
|
||||
if (curStageHrs >= currentIntervalhours)
|
||||
if (curStageHrs >= currentIntervalHours)
|
||||
{
|
||||
if (Configurations.EnableMenopause && ovarypower < OvaryPowerThreshold)
|
||||
{
|
||||
|
@ -1659,7 +1663,7 @@ namespace RJW_Menstruation
|
|||
default:
|
||||
curStage = Stage.Follicular;
|
||||
curStageHrs = 0;
|
||||
if (currentIntervalhours < 0) currentIntervalhours = PeriodRandomizer(curStage);
|
||||
if (currentIntervalHours < 0) currentIntervalHours = PeriodRandomizer(curStage);
|
||||
HugsLibController.Instance.TickDelayScheduler.ScheduleCallback(PeriodSimulator(Stage.Follicular), GetNextUpdate(), parent.pawn, false);
|
||||
break;
|
||||
}
|
||||
|
@ -1693,7 +1697,7 @@ namespace RJW_Menstruation
|
|||
{
|
||||
curStageHrs = 0;
|
||||
float variabilityFactor = nextstage == Stage.ClimactericFollicular || nextstage == Stage.ClimactericLuteal || nextstage == Stage.ClimactericBleeding ? 6f : 1f;
|
||||
if (calculateHours) currentIntervalhours = PeriodRandomizer(nextstage, variabilityFactor);
|
||||
if (calculateHours) currentIntervalHours = PeriodRandomizer(nextstage, variabilityFactor);
|
||||
curStage = nextstage;
|
||||
HugsLibController.Instance.TickDelayScheduler.ScheduleCallback(PeriodSimulator(nextstage), GetNextUpdate(), parent.pawn, false);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue