mirror of
https://gitgud.io/lutepickle/rjw_menstruation.git
synced 2024-08-14 22:46:52 +00:00
Refactor the climacteric stage functions into the normal stage functions
This commit is contained in:
parent
9cc8897103
commit
4737641673
2 changed files with 69 additions and 144 deletions
|
@ -36,9 +36,14 @@ namespace RJW_Menstruation
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void FollicularAction()
|
protected override void FollicularAction(bool climacteric)
|
||||||
{
|
{
|
||||||
if (!IsBreedingSeason())
|
if (climacteric && !Configurations.EnableMenopause)
|
||||||
|
{
|
||||||
|
RemoveClimactericEffect();
|
||||||
|
StayCurrentStage();
|
||||||
|
}
|
||||||
|
else if (!IsBreedingSeason())
|
||||||
{
|
{
|
||||||
GoNextStage(Stage.Anestrus);
|
GoNextStage(Stage.Anestrus);
|
||||||
return;
|
return;
|
||||||
|
@ -46,33 +51,9 @@ namespace RJW_Menstruation
|
||||||
if (curStageHrs >= currentIntervalhours)
|
if (curStageHrs >= currentIntervalhours)
|
||||||
{
|
{
|
||||||
estrusflag = false;
|
estrusflag = false;
|
||||||
GoNextStage(Stage.Luteal);
|
GoNextStage(climacteric ? Stage.ClimactericLuteal : Stage.Luteal);
|
||||||
}
|
}
|
||||||
else
|
else if (climacteric && ovarypower < OvaryPowerThreshold / 3 && Rand.Range(0.0f, 1.0f) < 0.2f) // Might randomly skip to luteal early)
|
||||||
{
|
|
||||||
curStageHrs += Configurations.CycleAcceleration;
|
|
||||||
if (!estrusflag && curStageHrs > currentIntervalhours - Props.estrusDaysBeforeOvulation * 24)
|
|
||||||
{
|
|
||||||
estrusflag = true;
|
|
||||||
SetEstrus(Props.eggLifespanDays + Props.estrusDaysBeforeOvulation);
|
|
||||||
}
|
|
||||||
StayCurrentStage();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void ClimactericFollicularAction()
|
|
||||||
{
|
|
||||||
if (!Configurations.EnableMenopause)
|
|
||||||
{
|
|
||||||
RemoveClimactericEffect();
|
|
||||||
StayCurrentStage();
|
|
||||||
}
|
|
||||||
else if (curStageHrs >= currentIntervalhours)
|
|
||||||
{
|
|
||||||
estrusflag = false;
|
|
||||||
GoNextStage(Stage.ClimactericLuteal);
|
|
||||||
}
|
|
||||||
else if (ovarypower < OvaryPowerThreshold / 3 && Rand.Range(0.0f, 1.0f) < 0.2f) // Might randomly skip to luteal early)
|
|
||||||
{
|
{
|
||||||
estrusflag = false;
|
estrusflag = false;
|
||||||
GoNextStage(Stage.ClimactericLuteal);
|
GoNextStage(Stage.ClimactericLuteal);
|
||||||
|
|
|
@ -528,10 +528,8 @@ namespace RJW_Menstruation
|
||||||
Scribe_Collections.Look(ref eggs, saveDestroyedThings: true, label: "eggs", lookMode: LookMode.Deep, ctorArgs: new object[0]);
|
Scribe_Collections.Look(ref eggs, saveDestroyedThings: true, label: "eggs", lookMode: LookMode.Deep, ctorArgs: new object[0]);
|
||||||
Scribe_Values.Look(ref curStage, "curStage", curStage, true);
|
Scribe_Values.Look(ref curStage, "curStage", curStage, true);
|
||||||
Scribe_Values.Look(ref curStageHrs, "curStageHrs", curStageHrs, true);
|
Scribe_Values.Look(ref curStageHrs, "curStageHrs", curStageHrs, true);
|
||||||
//Scribe_Values.Look(ref follicularIntervalhours, "follicularIntervalhours", follicularIntervalhours, true);
|
Scribe_Values.Look(ref cycleSpeed, "cycleSpeed", cycleSpeed, true);
|
||||||
//Scribe_Values.Look(ref lutealIntervalhours, "lutealIntervalhours", lutealIntervalhours, true);
|
Scribe_Values.Look(ref cycleVariability, "cycleVariability", cycleVariability, true);
|
||||||
//Scribe_Values.Look(ref bleedingIntervalhours, "bleedingIntervalhours", bleedingIntervalhours, true);
|
|
||||||
//Scribe_Values.Look(ref recoveryIntervalhours, "recoveryIntervalhours", recoveryIntervalhours, 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 crampPain, "crampPain", crampPain, true);
|
||||||
Scribe_Values.Look(ref ovarypower, "ovarypower", ovarypower, true);
|
Scribe_Values.Look(ref ovarypower, "ovarypower", ovarypower, true);
|
||||||
|
@ -1300,9 +1298,14 @@ namespace RJW_Menstruation
|
||||||
parent.pawn.health.AddHediff(hediff, Genital_Helper.get_genitalsBPR(parent.pawn));
|
parent.pawn.health.AddHediff(hediff, Genital_Helper.get_genitalsBPR(parent.pawn));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual void FollicularAction()
|
protected virtual void FollicularAction(bool climacteric)
|
||||||
{
|
{
|
||||||
if (!IsBreedingSeason())
|
if(climacteric && !Configurations.EnableMenopause)
|
||||||
|
{
|
||||||
|
RemoveClimactericEffect();
|
||||||
|
StayCurrentStage();
|
||||||
|
}
|
||||||
|
else if (!IsBreedingSeason())
|
||||||
{
|
{
|
||||||
GoNextStage(Stage.Anestrus);
|
GoNextStage(Stage.Anestrus);
|
||||||
return;
|
return;
|
||||||
|
@ -1311,6 +1314,10 @@ namespace RJW_Menstruation
|
||||||
{
|
{
|
||||||
GoNextStage(Stage.Ovulatory);
|
GoNextStage(Stage.Ovulatory);
|
||||||
}
|
}
|
||||||
|
else if(climacteric && ovarypower < OvaryPowerThreshold / 3 && Rand.Range(0.0f, 1.0f) < 0.2f) //skips ovulatory
|
||||||
|
{
|
||||||
|
GoNextStage(Stage.ClimactericLuteal);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
curStageHrs += Configurations.CycleAcceleration;
|
curStageHrs += Configurations.CycleAcceleration;
|
||||||
|
@ -1373,9 +1380,14 @@ namespace RJW_Menstruation
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual void LutealAction()
|
protected virtual void LutealAction(bool climacteric)
|
||||||
{
|
{
|
||||||
if (!eggs.NullOrEmpty())
|
if (climacteric && !Configurations.EnableMenopause)
|
||||||
|
{
|
||||||
|
RemoveClimactericEffect();
|
||||||
|
StayCurrentStage();
|
||||||
|
}
|
||||||
|
else if (!eggs.NullOrEmpty())
|
||||||
{
|
{
|
||||||
FertilizationCheck();
|
FertilizationCheck();
|
||||||
EggDecay();
|
EggDecay();
|
||||||
|
@ -1403,7 +1415,11 @@ namespace RJW_Menstruation
|
||||||
eggs.Clear();
|
eggs.Clear();
|
||||||
if (Props.bleedingIntervalDays == 0)
|
if (Props.bleedingIntervalDays == 0)
|
||||||
{
|
{
|
||||||
GoNextStage(Stage.Follicular);
|
GoNextStage(climacteric ? Stage.ClimactericFollicular : Stage.Follicular);
|
||||||
|
}
|
||||||
|
else if (climacteric && (ovarypower < OvaryPowerThreshold / 4 || (ovarypower < OvaryPowerThreshold / 3 && Rand.Range(0.0f, 1.0f) < 0.3f))) //skips bleeding
|
||||||
|
{
|
||||||
|
GoNextStage(Stage.ClimactericFollicular);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1411,24 +1427,29 @@ namespace RJW_Menstruation
|
||||||
{
|
{
|
||||||
AddCrampPain();
|
AddCrampPain();
|
||||||
}
|
}
|
||||||
GoNextStage(Stage.Bleeding);
|
GoNextStage(climacteric ? Stage.ClimactericBleeding : Stage.Bleeding);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual void BleedingAction()
|
protected virtual void BleedingAction(bool climacteric)
|
||||||
{
|
{
|
||||||
if (curStageHrs >= currentIntervalhours)
|
if (climacteric && !Configurations.EnableMenopause)
|
||||||
|
{
|
||||||
|
RemoveClimactericEffect();
|
||||||
|
StayCurrentStage();
|
||||||
|
}
|
||||||
|
else if (curStageHrs >= currentIntervalhours)
|
||||||
{
|
{
|
||||||
Hediff hediff = parent.pawn.health.hediffSet.GetFirstHediffOfDef(VariousDefOf.Hediff_MenstrualCramp);
|
Hediff hediff = parent.pawn.health.hediffSet.GetFirstHediffOfDef(VariousDefOf.Hediff_MenstrualCramp);
|
||||||
if (hediff != null) parent.pawn.health.RemoveHediff(hediff);
|
if (hediff != null) parent.pawn.health.RemoveHediff(hediff);
|
||||||
int totalFollicularHours = PeriodRandomizer(Stage.Follicular); // The total amount of time for both bleeding and follicular
|
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);
|
GoNextStage(Stage.Ovulatory);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
currentIntervalhours = totalFollicularHours - currentIntervalhours;
|
currentIntervalhours = totalFollicularHours - currentIntervalhours;
|
||||||
GoNextStage(Stage.Follicular, false);
|
GoNextStage(climacteric ? Stage.ClimactericFollicular : Stage.Follicular, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1504,101 +1525,6 @@ namespace RJW_Menstruation
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual void ClimactericFollicularAction()
|
|
||||||
{
|
|
||||||
if (!Configurations.EnableMenopause)
|
|
||||||
{
|
|
||||||
RemoveClimactericEffect();
|
|
||||||
StayCurrentStage();
|
|
||||||
}
|
|
||||||
else if (curStageHrs >= currentIntervalhours)
|
|
||||||
{
|
|
||||||
GoNextStage(Stage.Ovulatory);
|
|
||||||
}
|
|
||||||
else if (ovarypower < OvaryPowerThreshold / 3 && Rand.Range(0.0f, 1.0f) < 0.2f) //skips ovulatory
|
|
||||||
{
|
|
||||||
GoNextStage(Stage.ClimactericLuteal);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
curStageHrs += Configurations.CycleAcceleration;
|
|
||||||
StayCurrentStage();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected virtual void ClimactericLutealAction()
|
|
||||||
{
|
|
||||||
if (!Configurations.EnableMenopause)
|
|
||||||
{
|
|
||||||
RemoveClimactericEffect();
|
|
||||||
StayCurrentStage();
|
|
||||||
}
|
|
||||||
else if (!eggs.NullOrEmpty())
|
|
||||||
{
|
|
||||||
FertilizationCheck();
|
|
||||||
EggDecay();
|
|
||||||
if (Implant()) GoNextStage(Stage.Pregnant);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
curStageHrs += Configurations.CycleAcceleration;
|
|
||||||
StayCurrentStage();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (curStageHrs <= currentIntervalhours)
|
|
||||||
{
|
|
||||||
curStageHrs += Configurations.CycleAcceleration;
|
|
||||||
StayCurrentStage();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
eggs.Clear();
|
|
||||||
if (Props.bleedingIntervalDays == 0)
|
|
||||||
{
|
|
||||||
GoNextStage(Stage.ClimactericFollicular);
|
|
||||||
}
|
|
||||||
else if (ovarypower < OvaryPowerThreshold / 4 || (ovarypower < OvaryPowerThreshold / 3 && Rand.Range(0.0f, 1.0f) < 0.3f)) //skips bleeding
|
|
||||||
{
|
|
||||||
GoNextStage(Stage.ClimactericFollicular);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (crampPain >= 0.05f)
|
|
||||||
{
|
|
||||||
AddCrampPain();
|
|
||||||
}
|
|
||||||
GoNextStage(Stage.ClimactericBleeding);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected virtual void ClimactericBleedingAction()
|
|
||||||
{
|
|
||||||
if (!Configurations.EnableMenopause)
|
|
||||||
{
|
|
||||||
RemoveClimactericEffect();
|
|
||||||
StayCurrentStage();
|
|
||||||
}
|
|
||||||
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(Stage.Follicular);
|
|
||||||
if (totalFollicularHours <= currentIntervalhours)
|
|
||||||
GoNextStage(Stage.Ovulatory);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
currentIntervalhours = totalFollicularHours - currentIntervalhours;
|
|
||||||
GoNextStage(Stage.Follicular, false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (curStageHrs < currentIntervalhours / 4) for (int i = 0; i < Configurations.CycleAcceleration; i++) BleedOut();
|
|
||||||
curStageHrs += Configurations.CycleAcceleration;
|
|
||||||
StayCurrentStage();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected virtual void AnestrusAction()
|
protected virtual void AnestrusAction()
|
||||||
{
|
{
|
||||||
if (IsBreedingSeason())
|
if (IsBreedingSeason())
|
||||||
|
@ -1674,16 +1600,25 @@ namespace RJW_Menstruation
|
||||||
switch (targetstage)
|
switch (targetstage)
|
||||||
{
|
{
|
||||||
case Stage.Follicular:
|
case Stage.Follicular:
|
||||||
action = FollicularAction;
|
action = delegate
|
||||||
|
{
|
||||||
|
FollicularAction(false);
|
||||||
|
};
|
||||||
break;
|
break;
|
||||||
case Stage.Ovulatory:
|
case Stage.Ovulatory:
|
||||||
action = OvulatoryAction;
|
action = OvulatoryAction;
|
||||||
break;
|
break;
|
||||||
case Stage.Luteal:
|
case Stage.Luteal:
|
||||||
action = LutealAction;
|
action = delegate
|
||||||
|
{
|
||||||
|
LutealAction(false);
|
||||||
|
};
|
||||||
break;
|
break;
|
||||||
case Stage.Bleeding:
|
case Stage.Bleeding:
|
||||||
action = BleedingAction;
|
action = delegate
|
||||||
|
{
|
||||||
|
BleedingAction(false);
|
||||||
|
};
|
||||||
break;
|
break;
|
||||||
case Stage.Pregnant:
|
case Stage.Pregnant:
|
||||||
action = PregnantAction;
|
action = PregnantAction;
|
||||||
|
@ -1701,13 +1636,22 @@ namespace RJW_Menstruation
|
||||||
action = YoungAction;
|
action = YoungAction;
|
||||||
break;
|
break;
|
||||||
case Stage.ClimactericFollicular:
|
case Stage.ClimactericFollicular:
|
||||||
action = ClimactericFollicularAction;
|
action = delegate
|
||||||
|
{
|
||||||
|
FollicularAction(true);
|
||||||
|
};
|
||||||
break;
|
break;
|
||||||
case Stage.ClimactericLuteal:
|
case Stage.ClimactericLuteal:
|
||||||
action = ClimactericLutealAction;
|
action = delegate
|
||||||
|
{
|
||||||
|
LutealAction(true);
|
||||||
|
};
|
||||||
break;
|
break;
|
||||||
case Stage.ClimactericBleeding:
|
case Stage.ClimactericBleeding:
|
||||||
action = ClimactericBleedingAction;
|
action = delegate
|
||||||
|
{
|
||||||
|
BleedingAction(true);
|
||||||
|
};
|
||||||
break;
|
break;
|
||||||
case Stage.Anestrus:
|
case Stage.Anestrus:
|
||||||
action = AnestrusAction;
|
action = AnestrusAction;
|
||||||
|
@ -1810,7 +1754,7 @@ namespace RJW_Menstruation
|
||||||
return (int)(Props.bleedingIntervalDays * 24 * (cycleSpeed * 0.5f) * (1 + Rand.Range(-cycleVariability, cycleVariability) * 0.5f * variabilityFactor));
|
return (int)(Props.bleedingIntervalDays * 24 * (cycleSpeed * 0.5f) * (1 + Rand.Range(-cycleVariability, cycleVariability) * 0.5f * variabilityFactor));
|
||||||
case Stage.Recover:
|
case Stage.Recover:
|
||||||
return (int)(Props.recoveryIntervalDays * 24 * Rand.Range(-0.05f, 0.05f));
|
return (int)(Props.recoveryIntervalDays * 24 * Rand.Range(-0.05f, 0.05f));
|
||||||
default: // Can happen on init, shouldn't happen during a cycle
|
default: // Often unused
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue