示例#1
0
 def decrease_motive_level(sim_info: SimInfo, motive_id: int,
                           amount: float) -> bool:
     """ Decrease the current level of the Motive of a Sim. """
     mapped_motive_id = CommonSimMotiveUtils._map_motive_id(
         sim_info, motive_id)
     if not CommonSimMotiveUtils.has_motive(sim_info, mapped_motive_id):
         return False
     CommonSimStatisticUtils.add_statistic_value(sim_info,
                                                 mapped_motive_id,
                                                 amount * -1.0,
                                                 add=True)
     return True
 def change_progress_toward_max_skill_level(sim_info: SimInfo,
                                            skill_id: int,
                                            value: float,
                                            add: bool = True) -> bool:
     """ Modify the amount of progress a Sim has made toward the max level of a Skill. """
     return CommonSimStatisticUtils.add_statistic_value(sim_info,
                                                        skill_id,
                                                        value,
                                                        add=add)
    def decrease_motive_level(sim_info: SimInfo, motive_id: int, amount: float) -> bool:
        """decrease_motive_level(sim_info, motive_id, amount)

        Decrease 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: int
        :param amount: The amount to decrease the motive by.
        :type amount: float
        :return: True, if the specified Motive was changed successfully. False, if not.
        :rtype: bool
        """
        mapped_motive_id = CommonSimMotiveUtils._map_motive_id(sim_info, motive_id)
        if not CommonSimMotiveUtils.has_motive(sim_info, mapped_motive_id):
            return False
        CommonSimStatisticUtils.add_statistic_value(sim_info, mapped_motive_id, amount * -1.0, add=True)
        return True
    def change_progress_toward_max_skill_level(sim_info: SimInfo, skill_id: int, value: float, add: bool=True) -> bool:
        """change_progress_toward_max_skill_level(sim_info, skill_id, value, add=True)

        Modify 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 modify.
        :type skill_id: int
        :param value: The level to add or subtract to/from the skill.
        :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.add_statistic_value(sim_info, skill_id, value, add=add)