def start_pregnancy(
            sim_info: SimInfo,
            partner_sim_info: SimInfo,
            pregnancy_origin: PregnancyOrigin = PregnancyOrigin.DEFAULT
    ) -> bool:
        """start_pregnancy(sim_info, partner_sim_info, pregnancy_origin=PregnancyOrigin.DEFAULT)

        Start a pregnancy between a Sim and a Partner Sim.

        :param sim_info: The Sim getting pregnant.
        :type sim_info: SimInfo
        :param partner_sim_info: The Sim that is getting the other Sim pregnant.
        :type partner_sim_info: SimInfo
        :param pregnancy_origin: The origin of the pregnancy. Default is PregnancyOrigin.DEFAULT.
        :type pregnancy_origin: PregnancyOrigin, optional
        :return: True, if the Sim is successfully impregnated by the Partner Sim. False, if not.
        :rtype: bool
        """
        if not CommonHouseholdUtils.has_free_household_slots(sim_info):
            return False
        pregnancy_tracker = CommonSimPregnancyUtils._get_pregnancy_tracker(
            sim_info)
        if pregnancy_tracker is None:
            return False
        pregnancy_tracker.start_pregnancy(sim_info,
                                          partner_sim_info,
                                          pregnancy_origin=pregnancy_origin)
        pregnancy_tracker.clear_pregnancy_visuals()
        CommonSimStatisticUtils.set_statistic_value(
            sim_info, CommonStatisticId.PREGNANCY, 1.0)
        return True
Beispiel #2
0
 def start_pregnancy(sim_info: SimInfo, partner_sim_info: SimInfo) -> bool:
     """ Start a pregnancy between a Sim and a Partner Sim. """
     if not CommonHouseholdUtils.has_free_household_slots(sim_info):
         return False
     pregnancy_tracker = CommonSimPregnancyUtils._get_pregnancy_tracker(
         sim_info)
     if pregnancy_tracker is None:
         return False
     pregnancy_tracker.start_pregnancy(sim_info, partner_sim_info)
     pregnancy_tracker.clear_pregnancy_visuals()
     CommonSimStatisticUtils.set_statistic_value(
         sim_info, CommonStatisticId.PREGNANCY, 1.0)
     return True
 def set_progress_toward_max_skill_level(sim_info: SimInfo,
                                         skill_id: int,
                                         value: float,
                                         add: bool = True) -> bool:
     """ Set the amount of progress a Sim has made toward the max level of a Skill.  """
     return CommonSimStatisticUtils.set_statistic_value(sim_info,
                                                        skill_id,
                                                        value,
                                                        add=add)
    def start_pregnancy(sim_info: SimInfo, partner_sim_info: SimInfo) -> bool:
        """start_pregnancy(sim_info, partner_sim_info)

        Start a pregnancy between a Sim and a Partner Sim.

        :param sim_info: The Sim getting pregnant.
        :type sim_info: SimInfo
        :param partner_sim_info: The Sim that is getting the other Sim pregnant.
        :type partner_sim_info: SimInfo
        :return: True, if successful. False, if not.
        :rtype: bool
        """
        if not CommonHouseholdUtils.has_free_household_slots(sim_info):
            return False
        pregnancy_tracker = CommonSimPregnancyUtils._get_pregnancy_tracker(
            sim_info)
        if pregnancy_tracker is None:
            return False
        pregnancy_tracker.start_pregnancy(sim_info, partner_sim_info)
        pregnancy_tracker.clear_pregnancy_visuals()
        CommonSimStatisticUtils.set_statistic_value(
            sim_info, CommonStatisticId.PREGNANCY, 1.0)
        return True
    def set_motive_level(sim_info: SimInfo, motive_id: CommonMotiveId,
                         amount: float) -> bool:
        """set_motive_level(sim_info, motive_id, amount)

        Set the current level of a Motive of a Sim.

        :param sim_info: The Sim to modify.
        :type sim_info: SimInfo
        :param motive_id: The identifier of the Motive to change.
        :type motive_id: CommonMotiveId
        :param amount: The amount to set the motive level to.
        :type amount: float
        :return: True, if the specified Motive was changed successfully. False, if not.
        :rtype: bool
        """
        if not CommonSimMotiveUtils.has_motive(sim_info, motive_id):
            return False
        mapped_motive_id: int = CommonSimMotiveUtils._map_motive_id(
            sim_info, motive_id)
        CommonSimStatisticUtils.set_statistic_value(sim_info,
                                                    mapped_motive_id,
                                                    amount,
                                                    add=True)
        return True
    def set_progress_toward_max_skill_level(sim_info: SimInfo, skill_id: int, value: float, add: bool=True) -> bool:
        """set_progress_toward_max_skill_level(sim_info, skill_id, value, add=True)

        Set the amount of progress a Sim has made toward the max level of a Skill.

        :param sim_info: The Sim to modify.
        :type sim_info: SimInfo
        :param skill_id: The identifier of the Skill to set.
        :type skill_id: int
        :param value: The amount to add.
        :type value: int
        :param add: If True, the skill will be added to the Sim before it is modified.
        :type add: bool, optional
        :return: True, if successful. False, if not.
        :rtype: bool
        """
        return CommonSimStatisticUtils.set_statistic_value(sim_info, skill_id, value, add=add)