本文整理匯總了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)