mirror of
https://gitgud.io/lutepickle/rjw_menstruation.git
synced 2024-08-14 22:46:52 +00:00
Replace some uses of Rand.Range with Utility.VariationRange
This commit is contained in:
parent
7e407a1cf9
commit
1cdb12fd3a
3 changed files with 9 additions and 9 deletions
|
@ -1507,7 +1507,7 @@ namespace RJW_Menstruation
|
|||
protected void BleedOut()
|
||||
{
|
||||
// ~1.5 per hour times acceleration
|
||||
float bledAmount = 0.03f * Configurations.BleedingAmount * Configurations.CycleAcceleration * Rand.Range(0.5f, 1.5f) * HoursBetweenSimulations;
|
||||
float bledAmount = Utility.VariationRange(0.03f * Configurations.BleedingAmount * Configurations.CycleAcceleration * HoursBetweenSimulations, 0.5f);
|
||||
CumIn(Pawn, bledAmount, Translations.Menstrual_Blood, -5.0f, Pawn.RaceProps?.BloodDef ?? ThingDefOf.Filth_Blood);
|
||||
Cum blood = GetNotCum(Translations.Menstrual_Blood);
|
||||
if (blood != null) blood.Color = BloodColor;
|
||||
|
@ -1581,7 +1581,7 @@ namespace RJW_Menstruation
|
|||
protected void AddCrampPain()
|
||||
{
|
||||
Hediff hediff = HediffMaker.MakeHediff(VariousDefOf.Hediff_MenstrualCramp, Pawn);
|
||||
hediff.Severity = crampPain * Rand.Range(0.9f, 1.1f);
|
||||
hediff.Severity = Utility.VariationRange(crampPain, 0.1f);
|
||||
HediffCompProperties_SeverityPerDay Prop = (HediffCompProperties_SeverityPerDay)hediff.TryGetComp<HediffComp_SeverityPerDay>().props;
|
||||
Prop.severityPerDay = -hediff.Severity / (currentIntervalTicks / GenDate.TicksPerDay) * Configurations.CycleAcceleration;
|
||||
Pawn.health.AddHediff(hediff, parent.Part);
|
||||
|
@ -1860,15 +1860,15 @@ namespace RJW_Menstruation
|
|||
switch (stage)
|
||||
{
|
||||
case Stage.Follicular:
|
||||
return (int)(Props.follicularIntervalDays * GenDate.TicksPerDay * (1 + Rand.Range(-cycleVariability, cycleVariability) * 1.5f * variabilityFactor) / (1 + (cycleSpeed - 1) * 1.5f));
|
||||
return (int)(Utility.VariationRange(Props.follicularIntervalDays * GenDate.TicksPerDay, cycleVariability * 1.5f * variabilityFactor) / (1 + (cycleSpeed - 1) * 1.5f));
|
||||
case Stage.Ovulatory:
|
||||
return Props.ovulationIntervalHours * GenDate.TicksPerHour; // No variability for now
|
||||
case Stage.Luteal:
|
||||
return (int)(Props.lutealIntervalDays * GenDate.TicksPerDay * (1 + Rand.Range(-cycleVariability, cycleVariability) * 0.5f * variabilityFactor) / (1 + (cycleSpeed - 1) * 0.5f));
|
||||
return (int)(Utility.VariationRange(Props.lutealIntervalDays * GenDate.TicksPerDay, cycleVariability * 0.5f * variabilityFactor) / (1 + (cycleSpeed - 1) * 0.5f));
|
||||
case Stage.Bleeding:
|
||||
return (int)(Props.bleedingIntervalDays * GenDate.TicksPerDay * (1 + Rand.Range(-cycleVariability, cycleVariability) * 0.5f * variabilityFactor) / (1 + (cycleSpeed - 1) * 0.5f));
|
||||
return (int)(Utility.VariationRange(Props.bleedingIntervalDays * GenDate.TicksPerDay, cycleVariability * 0.5f * variabilityFactor) / (1 + (cycleSpeed - 1) * 0.5f));
|
||||
case Stage.Recover:
|
||||
return (int)(Props.recoveryIntervalDays * GenDate.TicksPerDay * Rand.Range(0.95f, 1.05f));
|
||||
return (int)Utility.VariationRange(Props.recoveryIntervalDays * GenDate.TicksPerDay, 0.05f);
|
||||
case Stage.Pregnant:
|
||||
return (int)(MenstruationUtility.GestationHours(pregnancy) * GenDate.TicksPerHour);
|
||||
default:
|
||||
|
|
|
@ -99,14 +99,14 @@ namespace RJW_Menstruation
|
|||
base.PregnantAction();
|
||||
if (curStage != Stage.Pregnant)
|
||||
// Go halfway into the cycle
|
||||
ticksToNextCycle = (int)(averageCycleIntervalTicks * (1 + Rand.Range(-cycleVariability, cycleVariability))) / 2;
|
||||
ticksToNextCycle = (int)Utility.VariationRange(averageCycleIntervalTicks, cycleVariability) / 2;
|
||||
}
|
||||
|
||||
protected override void AnestrusAction()
|
||||
{
|
||||
if (ticksToNextCycle <= 0 && IsBreedingSeason())
|
||||
{
|
||||
ticksToNextCycle = (int)(averageCycleIntervalTicks * (1 + Rand.Range(-cycleVariability, cycleVariability)));
|
||||
ticksToNextCycle = (int)Utility.VariationRange(averageCycleIntervalTicks, cycleVariability);
|
||||
GoNextStage(Stage.Follicular);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -80,7 +80,7 @@ namespace RJW_Menstruation
|
|||
|
||||
try
|
||||
{
|
||||
res = part.FluidAmmount * part.FluidModifier * pawn.BodySize / pawn.RaceProps.baseBodySize * Rand.Range(0.8f, 1.2f);
|
||||
res = VariationRange(part.FluidAmmount * part.FluidModifier * pawn.BodySize / pawn.RaceProps.baseBodySize, 0.2f);
|
||||
}
|
||||
catch (NullReferenceException)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue