當前位置: 首頁>>代碼示例>>Python>>正文


Python Power.normal_power_to_level方法代碼示例

本文整理匯總了Python中the_tale.game.balance.power.Power.normal_power_to_level方法的典型用法代碼示例。如果您正苦於以下問題:Python Power.normal_power_to_level方法的具體用法?Python Power.normal_power_to_level怎麽用?Python Power.normal_power_to_level使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在the_tale.game.balance.power.Power的用法示例。


在下文中一共展示了Power.normal_power_to_level方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: damage_integrity

# 需要導入模塊: from the_tale.game.balance.power import Power [as 別名]
# 或者: from the_tale.game.balance.power.Power import normal_power_to_level [as 別名]
    def damage_integrity(self):
        if random.random() < self.safe_artifact_integrity_probability:
            return

        expected_artifact_power = Power.normal_power_to_level(self.level)

        for artifact in self.equipment.values():
            delta = c.ARTIFACT_INTEGRITY_DAMAGE_PER_BATTLE * (float(artifact.power.total()) / expected_artifact_power)**2

            if self.preferences.favorite_item is not None and self.preferences.favorite_item == artifact.type.equipment_slot:
                delta *= c.ARTIFACT_INTEGRITY_DAMAGE_FOR_FAVORITE_ITEM

            artifact.damage_integrity(delta)
開發者ID:,項目名稱:,代碼行數:15,代碼來源:

示例2: test_damage_integrity__damage_from_artifact_power

# 需要導入模塊: from the_tale.game.balance.power import Power [as 別名]
# 或者: from the_tale.game.balance.power.Power import normal_power_to_level [as 別名]
    def test_damage_integrity__damage_from_artifact_power(self):
        expected_artifact_power = Power.normal_power_to_level(self.hero.level)

        new_artifact = artifacts_storage.generate_artifact_from_list(artifacts_storage.artifacts, self.hero.level, rarity=artifacts_relations.RARITY.NORMAL)
        new_artifact.power = Power(expected_artifact_power / 2, expected_artifact_power / 2)

        self.hero.equipment.unequip(new_artifact.type.equipment_slot)
        self.hero.equipment.equip(new_artifact.type.equipment_slot, new_artifact)

        old_integrity = new_artifact.integrity

        self.hero.damage_integrity()

        not_modified_integrity = new_artifact.integrity

        new_artifact.power = Power(expected_artifact_power, expected_artifact_power)

        self.hero.damage_integrity()

        modified_integrity = new_artifact.integrity

        self.assertTrue(old_integrity - not_modified_integrity < not_modified_integrity - modified_integrity)
開發者ID:,項目名稱:,代碼行數:24,代碼來源:


注:本文中的the_tale.game.balance.power.Power.normal_power_to_level方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。