From 9ce08ceab800796b85af4182d03d930438aff69a Mon Sep 17 00:00:00 2001 From: lutepickle <28810-lutepickle@users.noreply.gitgud.io> Date: Thu, 11 Aug 2022 09:20:29 -0700 Subject: [PATCH] Slight refactor of RandomStage, be a bit cleaner --- .../HediffComps/HediffComp_Menstruation.cs | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/1.3/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_Menstruation.cs b/1.3/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_Menstruation.cs index a37064e..58d4930 100644 --- a/1.3/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_Menstruation.cs +++ b/1.3/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_Menstruation.cs @@ -1722,24 +1722,24 @@ namespace RJW_Menstruation protected Stage RandomStage() { - int rand = Rand.ElementByWeight( - 0, Props.follicularIntervalDays - Props.bleedingIntervalDays, - 1, Props.lutealIntervalDays, - 2, Props.bleedingIntervalDays); + Stage stage = Rand.ElementByWeight( + Stage.Follicular, Props.follicularIntervalDays - Props.bleedingIntervalDays, + Stage.Luteal, Props.lutealIntervalDays, + Stage.Bleeding, Props.bleedingIntervalDays); - switch (rand) + switch (stage) { - case 0: + case Stage.Follicular: curStageHrs = Rand.Range(0, (Props.follicularIntervalDays - Props.bleedingIntervalDays) * 24); - return Stage.Follicular; - case 1: + break; + case Stage.Luteal: curStageHrs = Rand.Range(0, Props.lutealIntervalDays * 24); - return Stage.Luteal; - case 2: + break; + case Stage.Bleeding: curStageHrs = Rand.Range(0, Props.bleedingIntervalDays * 24); - return Stage.Bleeding; - default: return Stage.Follicular; + break; } + return stage; } public void CopyCycleProperties(HediffComp_Menstruation original)