本文整理汇总了Python中the_tale.game.balance.power.Power.artifact_power_interval方法的典型用法代码示例。如果您正苦于以下问题:Python Power.artifact_power_interval方法的具体用法?Python Power.artifact_power_interval怎么用?Python Power.artifact_power_interval使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类the_tale.game.balance.power.Power
的用法示例。
在下文中一共展示了Power.artifact_power_interval方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: receive_artifacts_slots_choices
# 需要导入模块: from the_tale.game.balance.power import Power [as 别名]
# 或者: from the_tale.game.balance.power.Power import artifact_power_interval [as 别名]
def receive_artifacts_slots_choices(self, better, prefered_slot, prefered_item):
from the_tale.game.artifacts.prototypes import ArtifactPrototype
allowed_slots = list(relations.EQUIPMENT_SLOT.records)
slot_choices = list(allowed_slots)
if prefered_slot and self.preferences.equipment_slot and self.can_upgrade_prefered_slot:
slot_choices = [self.preferences.equipment_slot]
if prefered_item and self.preferences.favorite_item and self.preferences.favorite_item in slot_choices: #after prefered slot, since prefered item is more important
slot_choices.remove(self.preferences.favorite_item)
result_choices = []
if better:
for slot in slot_choices:
artifact = self.equipment.get(slot)
if artifact is not None:
distribution = self.preferences.archetype.power_distribution
min_power, max_power = Power.artifact_power_interval(distribution, self.level) # pylint: disable=W0612
if artifact.preference_rating(distribution) >= ArtifactPrototype._preference_rating(artifact.rarity, max_power, distribution):
continue
result_choices.append(slot)
else:
result_choices = slot_choices
return result_choices
示例2: test_receive_artifacts_slots_choices__better_false
# 需要导入模块: from the_tale.game.balance.power import Power [as 别名]
# 或者: from the_tale.game.balance.power.Power import artifact_power_interval [as 别名]
def test_receive_artifacts_slots_choices__better_false(self):
distribution = self.hero.preferences.archetype.power_distribution
min_power, max_power = Power.artifact_power_interval(distribution, self.hero.level) # pylint: disable=W0612
for artifact in self.hero.equipment.values():
artifact.power = max_power
self.assertEqual(set(self.hero.receive_artifacts_slots_choices(better=False, prefered_slot=False, prefered_item=False)),
set(relations.EQUIPMENT_SLOT.records))
示例3: use
# 需要导入模块: from the_tale.game.balance.power import Power [as 别名]
# 或者: from the_tale.game.balance.power.Power import artifact_power_interval [as 别名]
def use(self, task, storage, **kwargs): # pylint: disable=R0911,W0613
for artifact in task.hero.equipment.values():
distribution = task.hero.preferences.archetype.power_distribution
min_power, max_power = Power.artifact_power_interval(distribution, task.hero.level)
artifact.sharp(distribution=distribution, max_power=max_power, force=True)
return task.logic_result(message=u"Вся экипировка героя улучшена")
示例4: use
# 需要导入模块: from the_tale.game.balance.power import Power [as 别名]
# 或者: from the_tale.game.balance.power.Power import artifact_power_interval [as 别名]
def use(self, task, storage, **kwargs): # pylint: disable=R0911,W0613
artifact = random.choice(task.hero.equipment.values())
distribution=task.hero.preferences.archetype.power_distribution
min_power, max_power = Power.artifact_power_interval(distribution, task.hero.level)
artifact.sharp(distribution=distribution,
max_power=max_power,
force=True)
return task.logic_result(message=u'Улучшена экипировка героя: %(artifact)s' % {'artifact': artifact.html_label()})
示例5: test_sharp_preferences_with_max_power
# 需要导入模块: from the_tale.game.balance.power import Power [as 别名]
# 或者: from the_tale.game.balance.power.Power import artifact_power_interval [as 别名]
def test_sharp_preferences_with_max_power(self):
distribution = self.hero.preferences.archetype.power_distribution
min_power, max_power = Power.artifact_power_interval(distribution, self.hero.level)
self.hero.preferences.set_equipment_slot(relations.EQUIPMENT_SLOT.HAND_PRIMARY)
artifact = self.hero.equipment.get(relations.EQUIPMENT_SLOT.HAND_PRIMARY)
artifact.power = max_power
artifact = self.hero.sharp_artifact()
self.assertFalse(artifact.type.is_MAIN_HAND)
示例6: test_sharp_artifact_when_all_artifacts_has_max_power
# 需要导入模块: from the_tale.game.balance.power import Power [as 别名]
# 或者: from the_tale.game.balance.power.Power import artifact_power_interval [as 别名]
def test_sharp_artifact_when_all_artifacts_has_max_power(self):
distribution = self.hero.preferences.archetype.power_distribution
min_power, max_power = Power.artifact_power_interval(distribution, self.hero.level)
for artifact in self.hero.equipment.equipment.values():
artifact.power = max_power.clone()
old_power = self.hero.power
artifact = self.hero.sharp_artifact()
self.assertTrue(self.hero.power.physic > old_power.physic or
self.hero.power.magic > old_power.magic)
self.assertTrue(artifact.power == max_power + Power(1, 0) or
artifact.power == max_power + Power(0, 1))
self.assertTrue(self.hero.equipment.updated)
示例7: test_only_better_for_prefered_slot
# 需要导入模块: from the_tale.game.balance.power import Power [as 别名]
# 或者: from the_tale.game.balance.power.Power import artifact_power_interval [as 别名]
def test_only_better_for_prefered_slot(self):
self.hero._model.level = 9999
self.hero.preferences.set_equipment_slot(relations.EQUIPMENT_SLOT.PLATE)
# just set any artifact
self.hero.receive_artifact(equip=True, better=False, prefered_slot=True, prefered_item=True, archetype=True)
distribution = self.hero.preferences.archetype.power_distribution
min_power, max_power = Power.artifact_power_interval(distribution, self.hero.level)
for i in xrange(100):
old_artifact = self.hero.equipment.get(relations.EQUIPMENT_SLOT.PLATE)
old_artifact.power = max_power - Power(1, 1)
self.hero.receive_artifact(equip=True, better=True, prefered_slot=True, prefered_item=True, archetype=True)
self.assertTrue(self.hero.equipment.get(relations.EQUIPMENT_SLOT.PLATE).preference_rating(distribution) > old_artifact.preference_rating(distribution))
示例8: sharp_artifact
# 需要导入模块: from the_tale.game.balance.power import Power [as 别名]
# 或者: from the_tale.game.balance.power.Power import artifact_power_interval [as 别名]
def sharp_artifact(self):
choices = list(relations.EQUIPMENT_SLOT.records)
random.shuffle(choices)
if self.preferences.equipment_slot is not None and self.can_upgrade_prefered_slot:
choices.insert(0, self.preferences.equipment_slot)
distribution = self.preferences.archetype.power_distribution
min_power, max_power = Power.artifact_power_interval(distribution, self.level) # pylint: disable=W0612
for slot in choices:
artifact = self.equipment.get(slot)
if artifact is not None and artifact.sharp(distribution, max_power):
self.equipment.updated = True
return artifact
# if all artifacts are on maximum level
random.shuffle(choices)
for slot in choices:
artifact = self.equipment.get(slot)
if artifact is not None and artifact.sharp(distribution, max_power, force=True):
self.equipment.updated = True
return artifact