本文整理汇总了Python中the_tale.game.balance.power.Power.power_to_artifact方法的典型用法代码示例。如果您正苦于以下问题:Python Power.power_to_artifact方法的具体用法?Python Power.power_to_artifact怎么用?Python Power.power_to_artifact使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类the_tale.game.balance.power.Power
的用法示例。
在下文中一共展示了Power.power_to_artifact方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: check_better_artifact_power
# 需要导入模块: from the_tale.game.balance.power import Power [as 别名]
# 或者: from the_tale.game.balance.power.Power import power_to_artifact [as 别名]
def check_better_artifact_power(self, distribution):
median_power = Power.power_to_artifact(distribution, 100)
for i in range(100):
power = Power.better_artifact_power_randomized(distribution, 100)
self.assertTrue(median_power.physic < power.physic)
self.assertTrue(median_power.magic < power.magic)
示例2: test_purchase_artifact__better_artifact__min_level
# 需要导入模块: from the_tale.game.balance.power import Power [as 别名]
# 或者: from the_tale.game.balance.power.Power import power_to_artifact [as 别名]
def test_purchase_artifact__better_artifact__min_level(self):
self.assertEqual(self.hero.level, 1)
rarity = RARITY.NORMAL
distribution = self.hero.preferences.archetype.power_distribution
middle_power = Power.power_to_artifact(distribution, self.hero.level)
for i in xrange(100):
self.assertTrue(self.hero.purchase_artifact(rarity=RARITY.NORMAL, better=True).preference_rating(distribution) >
ArtifactPrototype._preference_rating(rarity, middle_power, distribution))
示例3: test_better_artifact_power__on_low_levels
# 需要导入模块: from the_tale.game.balance.power import Power [as 别名]
# 或者: from the_tale.game.balance.power.Power import power_to_artifact [as 别名]
def test_better_artifact_power__on_low_levels(self):
median_power = Power.power_to_artifact(PowerDistribution(0.5, 0.5), 1)
self.assertEqual(median_power, Power(1, 1))
powers = set()
for i in range(100):
power = Power.better_artifact_power_randomized(PowerDistribution(0.5, 0.5), 1)
powers.add(power.magic)
powers.add(power.physic)
self.assertEqual(1 + c.ARTIFACT_BETTER_MIN_POWER_DELTA * 2, len(powers))
示例4: test_purchase_artifact__better_artifact__large_level
# 需要导入模块: from the_tale.game.balance.power import Power [as 别名]
# 或者: from the_tale.game.balance.power.Power import power_to_artifact [as 别名]
def test_purchase_artifact__better_artifact__large_level(self):
self.hero.level = 100
self.assertEqual(self.hero.level, 100)
rarity = RARITY.NORMAL
distribution = self.hero.preferences.archetype.power_distribution
middle_power = Power.power_to_artifact(distribution, self.hero.level)
N = 100
with mock.patch('the_tale.game.actions.container.ActionsContainer.request_replane') as request_replane:
for i in xrange(N):
self.assertTrue(self.hero.purchase_artifact(rarity=RARITY.NORMAL, better=True).preference_rating(distribution) >
ArtifactPrototype._preference_rating(rarity, middle_power, distribution))
self.assertEqual(request_replane.call_count, N)
示例5: show_balance
# 需要导入模块: from the_tale.game.balance.power import Power [as 别名]
# 或者: from the_tale.game.balance.power.Power import power_to_artifact [as 别名]
def show_balance(self): # pylint: disable=R0914
tmp_time = ['начало', '8 часов', 'день', 'неделя', 'месяц', '3 месяца', '6 месяцев', '1 год', '2 года', '3 года', '4 года', '5 лет', '6 лет']
tmp_times = [0, 8, 24, 24*7, 24*30, 24*30*3, 24*30*6, 24*30*12, 24*30*12*2, 24*30*12*3, 24*30*12*4, 24*30*12*5, 24*30*12*6]
tmp_lvls = list(map(f.lvl_after_time, tmp_times))
# Всё, что ниже, должно зависеть от уровня, не от времени, т.к. время в данном случае не точный параметр, а анализ всё равно ориентируется на уровень.
exp_for_quest = f.experience_for_quest__real(c.QUEST_AREA_RADIUS)
tmp_exp_to_level = list(map(math.floor, list(map(f.exp_on_lvl, tmp_lvls))))
tmp_exp_total = list(map(math.floor, list(map(f.total_exp_to_lvl, tmp_lvls))))
tmp_quests_to_level = list(map(math.ceil, (exp/float(exp_for_quest) for exp in tmp_exp_to_level)))
tmp_quests_total = list(map(math.ceil, (exp/float(exp_for_quest) for exp in tmp_exp_total)))
dstr = PowerDistribution(0.5, 0.5)
tmp_hp = list(map(f.hp_on_lvl, tmp_lvls))
tmp_turns = list(map(f.turns_on_lvl, tmp_lvls))
tmp_turns_to_time = list(map(int, list(map(f.hours_to_turns, tmp_times))))
tmp_expected_damage_to_hero_per_hit = list(map(f.expected_damage_to_hero_per_hit, tmp_lvls))
tmp_expected_damage_to_hero_per_hit_interval = [ (int(round(dmg*(1-c.DAMAGE_DELTA))), int(round(dmg*(1+c.DAMAGE_DELTA)))) for dmg in tmp_expected_damage_to_hero_per_hit]
tmp_mob_hp = list(map(f.mob_hp_to_lvl, tmp_lvls))
tmp_power = [Power.power_to_level(dstr, lvl) for lvl in tmp_lvls]
tmp_expected_damage_to_mob_per_hit = list(map(f.expected_damage_to_mob_per_hit, tmp_lvls))
tmp_real_damage_to_mob_per_hit = [p.damage().total for p in tmp_power]
tmp_real_damage_to_mob_per_hit_interval = [ (int(round(dmg*(1-c.DAMAGE_DELTA))), int(round(dmg*(1+c.DAMAGE_DELTA)))) for dmg in tmp_real_damage_to_mob_per_hit]
tmp_power_per_slot = [Power.power_to_artifact(dstr, lvl) for lvl in tmp_lvls]
tmp_battles_at_lvl = list(map(math.floor, [x * c.BATTLES_PER_HOUR for x in map(f.time_on_lvl, tmp_lvls)]))
tmp_total_battles = list(map(math.floor, [x * c.BATTLES_PER_HOUR for x in map(f.total_time_for_lvl, tmp_lvls)]))
tmp_artifacts_per_battle = [c.ARTIFACTS_PER_BATTLE]* len(tmp_lvls)
tmp_artifacts_total = [c.ARTIFACTS_LOOT_PER_DAY * f.total_time_for_lvl(lvl-1)/24.0 for lvl in tmp_lvls]
tmp_gold_in_day = list(map(f.expected_gold_in_day, tmp_lvls))
tmp_total_gold_at_lvl = list(map(f.total_gold_at_lvl, tmp_lvls))
return self.template('balance/balance.html',
{'c': c,
'f': f ,
'exp_for_quest': exp_for_quest,
'average_path_length': c.QUEST_AREA_RADIUS,
'tmp_time': tmp_time,
'tmp_lvls': tmp_lvls,
'tmp_exp_to_level': tmp_exp_to_level,
'tmp_exp_total': tmp_exp_total,
'tmp_quests_to_level': tmp_quests_to_level,
'tmp_quests_total': tmp_quests_total,
'tmp_hp': tmp_hp,
'tmp_turns': tmp_turns,
'tmp_turns_to_time': tmp_turns_to_time,
'tmp_expected_damage_to_hero_per_hit': tmp_expected_damage_to_hero_per_hit,
'tmp_mob_hp': tmp_mob_hp,
'tmp_power': tmp_power,
'tmp_expected_damage_to_mob_per_hit': tmp_expected_damage_to_mob_per_hit,
'tmp_expected_damage_to_hero_per_hit_interval': tmp_expected_damage_to_hero_per_hit_interval,
'tmp_real_damage_to_mob_per_hit': tmp_real_damage_to_mob_per_hit,
'tmp_real_damage_to_mob_per_hit_interval': tmp_real_damage_to_mob_per_hit_interval,
'tmp_power_per_slot': tmp_power_per_slot,
'tmp_battles_at_lvl': tmp_battles_at_lvl,
'tmp_total_battles': tmp_total_battles,
'tmp_artifacts_total': tmp_artifacts_total,
'tmp_artifacts_per_battle': tmp_artifacts_per_battle,
# 'tmp_gold_at_lvl': tmp_gold_at_lvl,
'tmp_gold_in_day': tmp_gold_in_day,
'tmp_total_gold_at_lvl': tmp_total_gold_at_lvl
} )
示例6: show_balance
# 需要导入模块: from the_tale.game.balance.power import Power [as 别名]
# 或者: from the_tale.game.balance.power.Power import power_to_artifact [as 别名]
def show_balance(self): # pylint: disable=R0914
tmp_time = [
u"начало",
u"8 часов",
u"день",
u"неделя",
u"месяц",
u"3 месяца",
u"6 месяцев",
u"1 год",
u"2 года",
u"3 года",
u"4 года",
u"5 лет",
u"6 лет",
]
tmp_times = [
0,
8,
24,
24 * 7,
24 * 30,
24 * 30 * 3,
24 * 30 * 6,
24 * 30 * 12,
24 * 30 * 12 * 2,
24 * 30 * 12 * 3,
24 * 30 * 12 * 4,
24 * 30 * 12 * 5,
24 * 30 * 12 * 6,
]
tmp_lvls = map(f.lvl_after_time, tmp_times)
# Всё, что ниже, должно зависеть от уровня, не от времени, т.к. время в данном случае не точный параметр, а анализ всё равно ориентируется на уровень.
exp_for_quest = f.experience_for_quest__real(c.QUEST_AREA_RADIUS)
tmp_exp_to_level = map(math.floor, map(f.exp_on_lvl, tmp_lvls))
tmp_exp_total = map(math.floor, map(f.total_exp_to_lvl, tmp_lvls))
tmp_quests_to_level = map(math.ceil, (exp / float(exp_for_quest) for exp in tmp_exp_to_level))
tmp_quests_total = map(math.ceil, (exp / float(exp_for_quest) for exp in tmp_exp_total))
dstr = PowerDistribution(0.5, 0.5)
tmp_hp = map(f.hp_on_lvl, tmp_lvls)
tmp_turns = map(f.turns_on_lvl, tmp_lvls)
tmp_turns_to_time = map(int, map(f.hours_to_turns, tmp_times))
tmp_expected_damage_to_hero_per_hit = map(f.expected_damage_to_hero_per_hit, tmp_lvls)
tmp_expected_damage_to_hero_per_hit_interval = [
(int(round(dmg * (1 - c.DAMAGE_DELTA))), int(round(dmg * (1 + c.DAMAGE_DELTA))))
for dmg in tmp_expected_damage_to_hero_per_hit
]
tmp_mob_hp = map(f.mob_hp_to_lvl, tmp_lvls)
tmp_power = map(lambda lvl: Power.power_to_level(dstr, lvl), tmp_lvls)
tmp_expected_damage_to_mob_per_hit = map(f.expected_damage_to_mob_per_hit, tmp_lvls)
tmp_real_damage_to_mob_per_hit = map(lambda p: p.damage().total, tmp_power)
tmp_real_damage_to_mob_per_hit_interval = [
(int(round(dmg * (1 - c.DAMAGE_DELTA))), int(round(dmg * (1 + c.DAMAGE_DELTA))))
for dmg in tmp_real_damage_to_mob_per_hit
]
tmp_power_per_slot = [Power.power_to_artifact(dstr, lvl) for lvl in tmp_lvls]
tmp_battles_at_lvl = map(math.floor, [x * c.BATTLES_PER_HOUR for x in map(f.time_on_lvl, tmp_lvls)])
tmp_total_battles = map(math.floor, [x * c.BATTLES_PER_HOUR for x in map(f.total_time_for_lvl, tmp_lvls)])
tmp_artifacts_per_battle = [c.ARTIFACTS_PER_BATTLE] * len(tmp_lvls)
tmp_artifacts_total = [c.ARTIFACTS_LOOT_PER_DAY * f.total_time_for_lvl(lvl - 1) / 24.0 for lvl in tmp_lvls]
tmp_gold_in_day = map(f.expected_gold_in_day, tmp_lvls)
tmp_total_gold_at_lvl = map(f.total_gold_at_lvl, tmp_lvls)
return self.template(
"balance/balance.html",
{
"c": c,
"f": f,
"exp_for_quest": exp_for_quest,
"average_path_length": c.QUEST_AREA_RADIUS,
"tmp_time": tmp_time,
"tmp_lvls": tmp_lvls,
"tmp_exp_to_level": tmp_exp_to_level,
"tmp_exp_total": tmp_exp_total,
"tmp_quests_to_level": tmp_quests_to_level,
"tmp_quests_total": tmp_quests_total,
"tmp_hp": tmp_hp,
"tmp_turns": tmp_turns,
"tmp_turns_to_time": tmp_turns_to_time,
"tmp_expected_damage_to_hero_per_hit": tmp_expected_damage_to_hero_per_hit,
"tmp_mob_hp": tmp_mob_hp,
"tmp_power": tmp_power,
"tmp_expected_damage_to_mob_per_hit": tmp_expected_damage_to_mob_per_hit,
"tmp_expected_damage_to_hero_per_hit_interval": tmp_expected_damage_to_hero_per_hit_interval,
"tmp_real_damage_to_mob_per_hit": tmp_real_damage_to_mob_per_hit,
"tmp_real_damage_to_mob_per_hit_interval": tmp_real_damage_to_mob_per_hit_interval,
"tmp_power_per_slot": tmp_power_per_slot,
"tmp_battles_at_lvl": tmp_battles_at_lvl,
"tmp_total_battles": tmp_total_battles,
"tmp_artifacts_total": tmp_artifacts_total,
"tmp_artifacts_per_battle": tmp_artifacts_per_battle,
# 'tmp_gold_at_lvl': tmp_gold_at_lvl,
"tmp_gold_in_day": tmp_gold_in_day,
#.........这里部分代码省略.........