def _PregnancyCachedTestSimulationPhase( self, simulation: ReproductionShared.Simulation, ticks: int) -> None: simulatingGameMinutes = ReproductionShared.TicksToGameMinutes( ticks) # type: float if self._cachedPregnancyTestGameMinutesRemaining is not None: self._cachedPregnancyTestGameMinutesRemaining -= simulatingGameMinutes if self._cachedPregnancyTestGameMinutesRemaining <= 0: self._ResetCachedPregnancyTestResults()
def _SimulateInternal(self, simulation: ReproductionShared.Simulation, ticks: int, reproductiveTimeMultiplier: float) -> None: simulatingMinutes = ReproductionShared.TicksToReproductiveMinutes( ticks, reproductiveTimeMultiplier) # type: float gameMinutes = ReproductionShared.TicksToGameMinutes( ticks) # type: float effectGuide = self.BirthControlPillsEffectGuide # type: CycleGuides.BirthControlPillsEffectGuide currentNeed = self.Need # type: float nextNeed = self.Need # type: float if effectGuide.NeedPerGameMinute != 0: if effectGuide.NeedPerGameMinute > 0: if currentNeed != 1: nextNeed += gameMinutes * effectGuide.NeedPerGameMinute else: if currentNeed != 0: nextNeed += gameMinutes * effectGuide.NeedPerGameMinute nextNeed = min(max(nextNeed, 0), 1) currentEntrenchmentRate = effectGuide.EntrenchmentPerReproductiveMinute.Evaluate( currentNeed) # type: float nextEntrenchmentRate = effectGuide.EntrenchmentPerReproductiveMinute.Evaluate( nextNeed) # type: float averageEntrenchmentRate = ( currentEntrenchmentRate + nextEntrenchmentRate ) / 2 # type: float # This is probably only right if the curve is linear. currentEntrenchment = self.Entrenchment nextEntrenchment = self.Entrenchment if averageEntrenchmentRate != 0: if averageEntrenchmentRate > 0: if currentEntrenchment != 1: nextEntrenchment += simulatingMinutes * averageEntrenchmentRate else: if currentEntrenchment != 0: nextEntrenchment += simulatingMinutes * averageEntrenchmentRate nextEntrenchment = min(max(nextEntrenchment, 0), 1) gameMinutesSinceLastPill = self.GameMinutesSinceLastPill # type: float self.Need = nextNeed self.Entrenchment = nextEntrenchment if gameMinutesSinceLastPill is not None: self.GameMinutesSinceLastPill = gameMinutesSinceLastPill + gameMinutes
def _SimulateInternal (self, simulation: ReproductionShared.Simulation, ticks: int, reproductiveTimeMultiplier: float) -> None: simulatingGameMinutes = ReproductionShared.TicksToGameMinutes(ticks) # type: float if self.BuffCoolDown is not None: self.BuffCoolDown -= simulatingGameMinutes if self.BuffCoolDown <= 0: self.BuffCoolDown = None if self.BuffCoolDown is not None and self.BuffCoolDown > 0: return if not self.AffectingSystem.SimInfo.is_instanced(): return # The game doesn't appear to allow us to add the buffs to non-instanced sims. if not simulation.LastTickStep: return cycleTracker = self.AffectingSystem.GetTracker(FemalesShared.CycleTrackerIdentifier) # type: typing.Optional[CycleTracker.CycleTracker] if cycleTracker is None: return currentCycle = cycleTracker.CurrentCycle # type: typing.Optional[CycleMenstrual.MenstrualCycle] if currentCycle is None: return if currentCycle.TypeIdentifier != CycleShared.MenstrualCycleTypeIdentifier: return buffSelectionTesting = self.DoBuffSelectionTesting() # type: CycleEvents.MenstrualEffectBuffSelectionTestingArguments selectedBuffType, hadValidSelections = buffSelectionTesting.SelectAppropriateBuff(currentCycle) # type: typing.Optional[typing.Type[BuffsMenstrual.MenstrualBuffBase]], bool if not hadValidSelections: return if selectedBuffType is None: self.ApplyBuffAbstainedEffects() return self.AffectingSystem.SimInfo.Buffs.add_buff_from_op(selectedBuffType, BuffsShared.ReproductiveSystemBuffReason.GetLocalizationString())