-
Notifications
You must be signed in to change notification settings - Fork 0
/
clara.py
executable file
·38 lines (30 loc) · 1.1 KB
/
clara.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#! /bin/python
# Star Rail Clara's RES rate
class BOSS:
def __init__(self, chance, hit):
self.chance = chance
self.hit = hit
class Character:
def __init__(self, resist, extra_resist = 0):
self.resist = resist
self.extra_resist = extra_resist
def hope(self, boss):
print("当前被控概率: ",
self.cal_hope(boss.chance, boss.hit, self.resist, self.extra_resist))
# hopes
print("效果抵抗 被控概率")
res = list(map(lambda x: round(0.1*x, 1), range(11)))
for x in res:
print("{0}\t{1}".format(
x,
self.cal_hope(boss.chance, boss.hit, x, self.extra_resist))
)
def cal_hope(self, boss_chance, boss_hit, resist, extra_resist):
# 被控概率 = BOSS基础概率 x (1-BOSS效果命中) x (1-角色效果抵抗) x (1-额外控制抵抗)
return round(boss_chance * (1 - boss_hit) * (1 - resist) * (1 - extra_resist), 3)
def main():
kafka = BOSS(1.2, 0.4)
clara = Character(0.5, 0.3)
clara.hope(kafka)
if __name__ == '__main__':
main()