import math
import itertools
luna_spell_defense = 169
luna_physical_defense = 375
luna_spell_attack = 10
luna_physical_attack = 335
luna_spell_penetrate = 64
luna_physical_penetrate = 0
luna_hp = 6612
luna_crit_rate = 0
luna_crit_effect = 2
flag = False
if flag:
enemy_spell_defense = 169 + 450 + 0.25 * (180 + 240) # 蔡文姬
else:
enemy_spell_defense = 169 # 没有蔡文姬
enemy_physical_defense = 329
enemy_spell_attack = 0
enemy_physical_attack = 407 + 9 + 16
enemy_spell_penetrate = 0
enemy_physical_penetrate = 89
enemy_hp = 5669
enemy_crit_rate = 0.021
enemy_crit_effect = 2 + 0.108
luna_equipment = {0: "符文大剑", 1: "抵抗之靴", 2: "嗜神之书", 3: "痛苦面具", 4: "虚无法杖",
5: "极寒风暴", 6: "不祥征兆", 7: "辉月", 8: "贤者之书", 9: "炽热支配者",
10: "回响之杖", 11: "急速战靴", 12: "闪电匕首", 13: "无尽战刃", 14: "破晓",
15: "魔女斗篷", 16: "泣血之刃", 17: "巫术法杖", 18: "博学者之怒"}
class Role:
def __init__(self, spell_defense, physical_defense, spell_attack, physical_attack, spell_penetrate,
physical_penetrate, hp, crit_rate, crit_effect):
self.spell_defense = spell_defense
self.physical_defense = physical_defense
self.spell_attack = spell_attack
self.physical_attack = physical_attack
self.spell_penetrate = spell_penetrate
self.physical_penetrate = physical_penetrate
self.hp = hp
self.crit_rate = crit_rate
self.crit_effect = crit_effect
self.physical_penetrate_pen = 0
self.spell_penetrate_pen = 0
self.epuipment = []
self.shuxing = (self.spell_defense,
self.physical_defense,
self.spell_attack,
self.physical_attack,
self.spell_penetrate,
self.physical_penetrate,
self.hp,
self.crit_rate,
self.crit_effect,
self.physical_penetrate_pen,
self.spell_penetrate_pen,
self.epuipment)
def print_pro(self):
print("=" * 50)
print("法术防御:", self.spell_defense)
print("物理防御:", self.physical_defense)
print("法术攻击:", self.spell_attack)
print("物理攻击:", self.physical_attack)
print("法术穿透:", self.spell_penetrate)
print("物理穿透:", self.physical_penetrate)
print("生命值:", self.hp)
print("暴击率:", self.crit_rate)
print("暴击效果:", self.crit_effect)
print("=" * 50)
def print_ep(self):
if self.epuipment != []:
for i in self.epuipment:
print(luna_equipment[i])
def back(self):
(self.spell_defense,
self.physical_defense,
self.spell_attack,
self.physical_attack,
self.spell_penetrate,
self.physical_penetrate,
self.hp,
self.crit_rate,
self.crit_effect,
self.physical_penetrate_pen,
self.spell_penetrate_pen,
self.epuipment) = self.shuxing
def luna_0_skill(physical_attack, spell_attack):
spell_hurt = 290 + 0.35 * spell_attack
physical_hurt = physical_attack * 3
return spell_hurt, physical_hurt
def luna_1_skill(spell_attack):
spell_hurt = 750 + 0.51 * spell_attack
return spell_hurt
def luna_2_skill(spell_attack):
spell_hurt = 195 + 0.31 * spell_attack
shield = 1000 + 0.8 * spell_attack
return spell_hurt, shield
def luna_3_skill(spell_attack):
spell_hurt = 750 + 0.6 * spell_attack
return spell_hurt
luna = Role(luna_spell_defense,
luna_physical_defense,
luna_spell_attack,
luna_physical_attack,
luna_spell_penetrate,
luna_physical_penetrate,
luna_hp,
luna_crit_rate,
luna_crit_effect)
yuji = Role(enemy_spell_defense,
enemy_physical_defense,
enemy_spell_attack,
enemy_physical_attack,
enemy_spell_penetrate,
enemy_physical_penetrate,
enemy_hp,
enemy_crit_rate,
enemy_crit_effect)
def calcul_chara(role, ep_list):
for i in ep_list:
if i == 0:
role.spell_attack += 280
elif i == 1:
role.spell_defense += 110
elif i == 2:
role.spell_attack += 180
role.hp += 800
elif i == 3:
role.spell_attack += 100
role.hp += 500
role.spell_penetrate += 75
elif i == 4:
role.spell_attack += 240
role.hp += 300
role.spell_penetrate_pen += 0.45
elif i == 5:
role.physical_defense += 360
elif i == 6:
role.physical_defense += 270
role.hp += 1200
elif i == 7:
role.spell_attack += 160
elif i == 8:
role.spell_attack += 400
role.hp += 1600
elif i == 9:
role.spell_attack += 180
elif i == 10:
role.spell_attack += 240
elif i == 11:
pass
elif i == 12:
role.crit_rate += 0.2
elif i == 13:
role.physical_attack += 130
role.crit_rate += 0.2
role.crit_effect += 0.4
elif i == 14:
role.physical_attack += 50
role.crit_rate += 0.15
role.physical_penetrate_pen += 0.4
elif i == 15:
role.spell_defense += 360
role.hp += 3000
elif i == 16:
role.physical_attack += 100
elif i == 17:
role.spell_attack += 140
elif i == 18:
role.spell_attack += 240
role.spell_attack *= 1.35
role.spell_attack = math.floor(role.spell_attack)
role.epuipment = ep_list
def cal_hurt(luna, yuji):
actual_ph_defense = (yuji.physical_defense - luna.physical_penetrate) * (1 - luna.physical_penetrate_pen)
actual_sp_defense = (yuji.spell_defense - luna.spell_penetrate) * (1 - luna.spell_penetrate_pen)
if actual_ph_defense <= 0:
actual_ph_defense = 0
the_spe_hurt, the_phy_hurt = luna_0_skill(luna.physical_attack, luna.spell_attack)
phy_hurt = the_phy_hurt * actual_ph_defense / (1 - (actual_ph_defense + 602))
the_spe_hurt += luna_1_skill(luna.spell_attack)
temp, luna_sheild = luna_2_skill(luna.spell_attack)
the_spe_hurt += temp
the_spe_hurt += (3 * luna_3_skill(luna.spell_attack))
temp = 0
for i in luna.epuipment:
if i == 0:
temp = max(temp, 2 * (50 + 0.5 * luna.spell_attack))
elif i == 3:
the_spe_hurt += yuji.hp * 0.08 + yuji.hp * 0.08 * 0.5
elif i == 10:
the_spe_hurt += 100 + 0.3 * luna.spell_attack
elif i == 17:
temp = max(temp, 2 * (0.3 * luna.physical_attack + 0.8 * luna.spell_attack))
the_spe_hurt += temp
spe_hurt = the_spe_hurt * (1 - actual_sp_defense / (actual_sp_defense + 602))
return phy_hurt, spe_hurt
# calcul_chara(luna, [0, 1, 2, 3, 5, 18])
yuji_epuipment = [11, 12, 13, 14, 16]
# yuji_epuipment.append(15)
calcul_chara(yuji, yuji_epuipment)
guding = [1, 2, 5, 7,15] # 设置固定装备
beizhan = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18]
for i in guding:
beizhan.remove(i) # 装备不重复
li1 = []
for i in itertools.combinations(beizhan, r=6 - len(guding)):
li2 = []
luna.back()
j = list(i)
zhangbei = sorted(j + guding)
calcul_chara(luna, zhangbei)
phy_hurt, spe_hurt = cal_hurt(luna, yuji)
zong = phy_hurt + spe_hurt
# print("=" * 50)
# print("%-5s %-5s %-5s %-4d %-4d" %
# (luna_equipment[j[0]], luna_equipment[j[1]], luna_equipment[j[2]], phy_hurt, spe_hurt))
# print("总伤害:", zong)
li2.append(zong)
# temp=[]
# for k in j:
# temp.append(k)
# for k in
ttt = j + guding
temp = list(map(lambda x: luna_equipment[x], ttt))
# temp = sorted(temp)
li2.append(temp)
li1.append(li2)
# print(len(li1))
li1 = sorted(li1)
for i in li1:
print(i)
if flag:
print("有蔡文姬")
else:
print("没有蔡文姬")
if 15 in yuji.epuipment:
print("虞姬出魔女")
else:
print("虞姬没出魔女")
print("露娜固定装备为:")
if guding == []:
print("无固定装备")
else:
print(list(map(lambda x: luna_equipment[x], guding)))
王者荣耀露娜13a2a3a3连招伤害计算
猜你喜欢
转载自blog.csdn.net/qq_34769201/article/details/99756627
今日推荐
周排行