本文整理汇总了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)
示例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)