def can_create_pregnancy_together(sim_info_a: SimInfo, sim_info_b: SimInfo, ignore_gender_options=False) -> bool: """can_create_pregnancy_together(sim_info_a, sim_info_b, ignore_gender_options=False) Determine if two Sims can create a pregnancy together. :param sim_info_a: An instance of a Sim. :type sim_info_a: SimInfo :param sim_info_b: An instance of a Sim. :type sim_info_b: SimInfo :param ignore_gender_options: If set to True, pregnancy gender options will be ignored.\ If set to False, each Sim will be checked for having either Can Impregnate or Can Be Impregnated. Default is False. :type ignore_gender_options: bool, optional :return: True, if the Sim can produce a pregnancy. False, if not. :rtype: bool """ if not S4CMSimPregnancyUtils.can_create_pregnancy(sim_info_a, ignore_gender_options=ignore_gender_options)\ or not S4CMSimPregnancyUtils.can_create_pregnancy(sim_info_b, ignore_gender_options=ignore_gender_options): return False if not CommonSpeciesUtils.are_same_species(sim_info_a, sim_info_b): # If both Sims are dogs, that is an ok combination, even though their species do not match. if not CommonSpeciesUtils.is_dog( sim_info_a) or not CommonSpeciesUtils.is_dog(sim_info_b): return False if not S4CMSettingUtils.is_sim_allowed_to_perform_adult_sim_operations( sim_info_a ) or not S4CMSettingUtils.is_sim_allowed_to_perform_adult_sim_operations( sim_info_b): return False if not S4CMSettingUtils.are_allowed_romantic_relationship( sim_info_a, sim_info_b): return False return True
def _translate_motive(self, sim_info: SimInfo, motive_name: str) -> int: if motive_name == CMMotive.BOWEL: if CommonSpeciesUtils.is_dog(sim_info): return CommonMotiveId.PET_DOG_BOWEL elif CommonSpeciesUtils.is_cat(sim_info): return CommonMotiveId.PET_CAT_BOWEL return -1 else: return CMMotiveUtils._MOTIVE_MAPPINGS[motive_name]
def get_bowels_level(sim_info: SimInfo) -> float: """ Retrieve the bowels level of a Sim. """ if CommonSpeciesUtils.is_human(sim_info): return -1.0 elif CommonSpeciesUtils.is_dog(sim_info): return CommonSimMotiveUtils._get_motive_level( sim_info, CommonMotiveId.PET_DOG_BOWEL) elif CommonSpeciesUtils.is_cat(sim_info): return CommonSimMotiveUtils._get_motive_level( sim_info, CommonMotiveId.PET_CAT_BOWEL) return -1.0
def get_bowels_level(sim_info: SimInfo) -> float: """get_bowels_level(sim_info) Retrieve the bowels level of a Sim. :param sim_info: The Sim to get the level of. :type sim_info: SimInfo :return: The current level of the Motive of the Sim. :rtype: float """ if CommonSpeciesUtils.is_human(sim_info): return -1.0 elif CommonSpeciesUtils.is_dog(sim_info): return CommonSimMotiveUtils._get_motive_level(sim_info, CommonMotiveId.PET_DOG_BOWEL) elif CommonSpeciesUtils.is_cat(sim_info): return CommonSimMotiveUtils._get_motive_level(sim_info, CommonMotiveId.PET_CAT_BOWEL) return -1.0
def get_stand_interaction(sim_info: SimInfo) -> Union[int, None]: """get_stand_interaction(sim_info) Retrieve a Stand interaction appropriate for a Sim. :param sim_info: An instance of a Sim. :type sim_info: SimInfo :return: The decimal identifier of a Stand interaction appropriate for the Sim or None if no Stand interaction was found to be appropriate. :rtype: Union[int, None] """ from sims4communitylib.utils.sims.common_species_utils import CommonSpeciesUtils if CommonSpeciesUtils.is_human(sim_info): return CommonInteractionId.SIM_STAND elif CommonSpeciesUtils.is_dog(sim_info): return CommonInteractionId.DOG_STAND elif CommonSpeciesUtils.is_cat(sim_info): return CommonInteractionId.CAT_STAND return None
def get_swim_interaction(sim_info: SimInfo) -> Union[int, None]: """get_swim_interaction(sim_info) Retrieve a Swim interaction appropriate for a Sim. .. note:: Cats do not have an appropriate Swim interaction. :param sim_info: An instance of a Sim. :type sim_info: SimInfo :return: The decimal identifier of an interaction appropriate for the Sim or None if no interaction was found to be appropriate. :rtype: Union[int, None] """ if CommonSpeciesUtils.is_human(sim_info): return CommonInteractionId.SIM_SWIM elif CommonSpeciesUtils.is_dog(sim_info): return CommonInteractionId.DOG_SWIM # Cats don't have a swim interaction. return None
def get_in_labor_buff(sim_info: SimInfo) -> Union[int, CommonBuffId]: """get_in_labor_buff(sim_info) Retrieve an In Labor buff appropriate for causing the Sim to go into labor (Give Birth). :param sim_info: An instance of a Sim. :type sim_info: SimInfo :return: The decimal identifier of a Buff that will cause the specified Sim to go into labor. If no appropriate Buff is found, -1 will be returned. :rtype: Union[int, CommonBuffId] """ from sims4communitylib.utils.sims.common_gender_utils import CommonGenderUtils sim_name = CommonSimNameUtils.get_full_name(sim_info) log.debug( 'Locating appropriate Buff for inducing labor in \'{}\'.'.format( sim_name)) is_female = CommonGenderUtils.is_female(sim_info) if CommonSpeciesUtils.is_human(sim_info): log.debug('\'{}\' is Human.'.format(sim_name)) if is_female: log.debug('\'{}\' is Female.'.format(sim_name)) return CommonBuffId.PREGNANCY_IN_LABOR else: log.debug('\'{}\' is Male.'.format(sim_name)) return CommonBuffId.PREGNANCY_IN_LABOR_MALE elif CommonSpeciesUtils.is_dog(sim_info): log.debug('\'{}\' is a Dog.'.format(sim_name)) if is_female: log.debug('\'{}\' is Female.'.format(sim_name)) return CommonBuffId.PREGNANCY_IN_LABOR_PET_DOG elif CommonSpeciesUtils.is_cat(sim_info): log.debug('\'{}\' is a Cat.'.format(sim_name)) if is_female: log.debug('\'{}\' is Female.'.format(sim_name)) return CommonBuffId.PREGNANCY_IN_LABOR_PET_CAT log.debug( 'No appropriate Buff located to induce labor in \'{}\'.'.format( sim_name)) return -1