@property
def effective_fertility(self) -> float:
if persistent.pregnancy_pref == 0 or self.fertility_percent < 0:
return 0
fertility = self.fertility_percent
if persistent.pregnancy_pref > 1:
day_difference = self.days_from_ideal_fertility # Gets the distance between the current day and the ideal fertile day.
multiplier = 2 - (float(day_difference)/10.0) # The multiplier is 2 when the day difference is 0, 0.5 when the day difference is 15.
fertility = self.fertility_percent * multiplier
if persistent.pregnancy_pref == 3:
if self.baby_desire < -400:
fertility = fertility / 4
elif self.baby_desire < 400:
fertility = fertility / 2
return fertility
@property
def pregnancy_chance(self) -> float:
if self.effective_fertility <= 0:
return 0
return (self.effective_fertility / 100) * (100-self.birthcontrol_efficiency)
def did_she_become_pregnant(self, mc_father = True) -> bool:
if persistent.pregnancy_pref == 0 or self.has_role(pregnant_role):
return False
# Pregnancy Check #
if renpy.random.randint(0,100) < self.effective_fertility: #There's a chance she's pregnant
if renpy.random.randint(0,100) >= self.birthcontrol_efficiency: # Birth control failed to prevent the pregnancy
become_pregnant(self, mc_father = mc_father) #Function in role_pregnant establishes all of the pregnancy related variables and events.
return True
return False