mirror of
				https://gitgud.io/lutepickle/rjw_menstruation.git
				synced 2024-08-14 22:46:52 +00:00 
			
		
		
		
	Refactor the transition to ovulation, eliminate some code duplication in follicular and bleeding actions between standard and induced ovulation
This commit is contained in:
		
							parent
							
								
									5d98d23541
								
							
						
					
					
						commit
						1a875dba1c
					
				
					 3 changed files with 13 additions and 34 deletions
				
			
		
										
											Binary file not shown.
										
									
								
							| 
						 | 
				
			
			@ -53,38 +53,10 @@ namespace RJW_Menstruation
 | 
			
		|||
            return 0;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        protected override void FollicularAction(bool climacteric)
 | 
			
		||||
        protected override void GoOvulatoryStage(bool climacteric)
 | 
			
		||||
        {
 | 
			
		||||
            if (climacteric && !Configurations.EnableMenopause)
 | 
			
		||||
            {
 | 
			
		||||
                RemoveClimactericEffect();
 | 
			
		||||
                StayCurrentStage();
 | 
			
		||||
            }
 | 
			
		||||
            else if (!IsBreedingSeason())
 | 
			
		||||
            {
 | 
			
		||||
                GoNextStage(Stage.Anestrus);
 | 
			
		||||
                return;
 | 
			
		||||
            }
 | 
			
		||||
            else if (curStageHrs >= currentIntervalHours)
 | 
			
		||||
            {
 | 
			
		||||
                estrusflag = false;
 | 
			
		||||
                GoNextStage(climacteric ? Stage.ClimactericLuteal : Stage.Luteal);
 | 
			
		||||
            }
 | 
			
		||||
            else if (climacteric && ovarypower < OvaryPowerThreshold / 3 && Rand.Range(0.0f, 1.0f) < 0.2f)  // Might randomly skip to luteal early)
 | 
			
		||||
            {
 | 
			
		||||
                estrusflag = false;
 | 
			
		||||
                GoNextStage(Stage.ClimactericLuteal);
 | 
			
		||||
            }
 | 
			
		||||
            else
 | 
			
		||||
            {
 | 
			
		||||
                curStageHrs += Configurations.CycleAcceleration;
 | 
			
		||||
                if (!estrusflag && curStageHrs > currentIntervalHours - Props.estrusDaysBeforeOvulation * 24)
 | 
			
		||||
                {
 | 
			
		||||
                    estrusflag = true;
 | 
			
		||||
                    SetEstrus(Props.eggLifespanDays + Props.estrusDaysBeforeOvulation);
 | 
			
		||||
                }
 | 
			
		||||
                StayCurrentStage();
 | 
			
		||||
            }
 | 
			
		||||
            estrusflag = false;
 | 
			
		||||
            GoNextStage(climacteric ? Stage.ClimactericLuteal : Stage.Luteal);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        protected override void AfterCumIn(Pawn cummer)
 | 
			
		||||
| 
						 | 
				
			
			@ -94,7 +66,7 @@ namespace RJW_Menstruation
 | 
			
		|||
            {
 | 
			
		||||
                case Stage.Follicular:
 | 
			
		||||
                case Stage.ClimactericFollicular:
 | 
			
		||||
                    curStage = Stage.Ovulatory;
 | 
			
		||||
                    GoNextStage(Stage.Ovulatory);
 | 
			
		||||
                    break;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1297,15 +1297,17 @@ namespace RJW_Menstruation
 | 
			
		|||
            }
 | 
			
		||||
            else if (!IsBreedingSeason())
 | 
			
		||||
            {
 | 
			
		||||
                estrusflag = false;
 | 
			
		||||
                GoNextStage(Stage.Anestrus);
 | 
			
		||||
                return;
 | 
			
		||||
            }
 | 
			
		||||
            else if (curStageHrs >= currentIntervalHours)
 | 
			
		||||
            {
 | 
			
		||||
                GoNextStage(Stage.Ovulatory);
 | 
			
		||||
                GoOvulatoryStage(climacteric);
 | 
			
		||||
            }
 | 
			
		||||
            else if (climacteric && ovarypower < OvaryPowerThreshold / 3 && Rand.Range(0.0f, 1.0f) < 0.2f) //skips ovulatory
 | 
			
		||||
            {
 | 
			
		||||
                estrusflag = false;
 | 
			
		||||
                GoNextStage(Stage.ClimactericLuteal);
 | 
			
		||||
            }
 | 
			
		||||
            else
 | 
			
		||||
| 
						 | 
				
			
			@ -1437,7 +1439,7 @@ namespace RJW_Menstruation
 | 
			
		|||
                if (hediff != null) parent.pawn.health.RemoveHediff(hediff);
 | 
			
		||||
                int totalFollicularHours = PeriodRandomizer(climacteric ? Stage.ClimactericFollicular : Stage.Follicular, climacteric ? 6.0f : 1.0f);  // 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
 | 
			
		||||
                    GoNextStage(Stage.Ovulatory);
 | 
			
		||||
                    GoOvulatoryStage(climacteric);
 | 
			
		||||
                else
 | 
			
		||||
                {
 | 
			
		||||
                    currentIntervalHours = totalFollicularHours - currentIntervalHours; // I.e., the remaining follicular hours equals the total minus the bleeding hours elapsed
 | 
			
		||||
| 
						 | 
				
			
			@ -1694,6 +1696,11 @@ namespace RJW_Menstruation
 | 
			
		|||
            HugsLibController.Instance.TickDelayScheduler.ScheduleCallback(PeriodSimulator(nextstage), GetNextUpdate(), parent.pawn, false);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        protected virtual void GoOvulatoryStage(bool climacteric)
 | 
			
		||||
        {
 | 
			
		||||
            GoNextStage(Stage.Ovulatory);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        //stage can be interrupted in other reasons
 | 
			
		||||
        protected void StayCurrentStage()
 | 
			
		||||
        {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue