level 9
n_4_troop = 26
n_5_troop = 9
n_4_hero = 25
n_5_hero = 8
n_4_dragon = 18
n_5_dragon = 12
#######
r_4_hero = 0.128
r_5_hero = 0.168
r_4_troop = 0.084
r_5_troop = 0.112
r_4_dragon = 0.21
r_5_dragon = 0.28
if __name__ == "__main__":
reduction = 0
for _ in range(n_4_troop):
reduction += (1 - reduction) * r_4_troop
# print("troop damage reduction is ", reduction)
for _ in range(n_5_troop):
reduction += (1 - reduction) * r_5_troop
print("troop damage reduction is ", reduction)
reduction = 0
for _ in range(n_4_hero):
reduction += (1 - reduction) * r_4_hero
# print("hero damage reduction is ", reduction)
for _ in range(n_5_hero):
reduction += (1 - reduction) * r_5_hero
print("hero damage reduction is ", reduction)
reduction = 0
for _ in range(n_4_dragon):
reduction += (1 - reduction) * r_4_dragon
# print("hero damage reduction is ", reduction)
for _ in range(n_5_dragon):
reduction += (1 - reduction) * r_5_dragon
print("dragon damage reduction is ", reduction)
2023年01月12日 10点01分
11
level 8
r4是四级宝石减伤率
r5是五级宝石减伤率
不过你减伤公式写复杂了,直接1-(1-r4)** n4算出四级的减伤率,再套一次五级,用不到循环。
2023年01月12日 10点01分
13