How to use freeze method in hypothesis

Best Python code snippet using hypothesis

freeze-smooth.py

Source:freeze-smooth.py Github

copy

Full Screen

1import numpy as np2# 基本设定,暴击,冻结暴击,施法时间,冰指和冰智概率3critical = 1 / 34critical_expectation = 1 + critical5critical_expectation = min(critical_expectation, 2)6freeze_critical_expectation = min(1 + 1.5 * critical + 0.5, 2)7freezeBolt_spellTime = 28gcd = 1.59fingersOfFrost_probability = 0.1510brainFreeze_probability = 0.311print(freeze_critical_expectation)12# 冰刺设定,基本伤害,期望伤害,冻结下期望伤害13iceThorn_damage = 26814iceThorn_damage_expectation = iceThorn_damage * critical_expectation15iceThorn_damage_freeze_expectation = iceThorn_damage * freeze_critical_expectation16# 寒冰箭设定,基本伤害,期望伤害,冻结下期望伤害17frostBolt_basic_damage = 75618frostBolt_damage_expectation = frostBolt_basic_damage * critical_expectation19frostBolt_damage_freeze_expectation = frostBolt_basic_damage * freeze_critical_expectation20#顺滑寒冰橙装21freezeBolt_spellTime = freezeBolt_spellTime * 0.822frostBolt_damage_expectation = frostBolt_damage_expectation * 1.223frostBolt_damage_freeze_expectation = frostBolt_damage_freeze_expectation * 1.224# 冰枪设定,基本伤害,冰霜之咬导灵器,连锁反应天赋伤害,冰指下期望伤害25iceLance_basic_damage = 56226frostBite = 0.05227iceLance_basic_damage = iceLance_basic_damage * (1 + frostBite)28iceLance_basic_damage = iceLance_basic_damage * 129iceLance_chain_damage = iceLance_basic_damage * 1.1530iceLance_basic_damage_fingersOfFrost_expectation = iceLance_basic_damage * 3 * freeze_critical_expectation31iceLance_chain_damage_fingersOfFrost_expectation = iceLance_chain_damage * 3 * freeze_critical_expectation32# 冰风暴设定,基本伤害,冰智下基础伤害,冰智下期望伤害33iceStorm_basic_damage = 122034iceStorm_damage_brainFreeze = iceStorm_basic_damage * 1.535iceStorm_damage_brainFreeze_expectation = iceStorm_damage_brainFreeze / 3 * critical_expectation \36 + iceStorm_damage_brainFreeze / 3 * 2 * freeze_critical_expectation37damage = 038time = 039fingersOfFrost_number = 040brainFreeze_number = 041iceThorn_number = 042# 第一种打法,无论何时都是冰智优先,不管有没有冰指,只要有冰智都打1+1+243while damage < 100000000000:44 # 读条一个寒冰箭45 time = time + freezeBolt_spellTime46 damage = damage + frostBolt_damage_expectation47 fingersOfFrost_trigger = np.random.random()48 brainFreeze_trigger = np.random.random()49 # 寒冰箭多一根冰刺,大于5自动发射50 iceThorn_number += 151 iceThorn_auto = False52 if iceThorn_number > 5:53 iceThorn_auto = True54 iceThorn_number -= 155 damage = damage + iceThorn_damage_expectation56 # 之前有冰指,没有触发冰智,读完这个寒冰箭打一个冰指的冰枪57 if fingersOfFrost_number > 0 and brainFreeze_number == 0:58 time = time + gcd59 damage = damage + iceLance_chain_damage_fingersOfFrost_expectation60 fingersOfFrost_number -= 161 # 冰刺在普通状态下清062 damage = damage + iceThorn_number * iceThorn_damage_expectation63 iceThorn_number = 064 # 刚读完的寒冰箭触发了冰指,没触发冰智,扔掉所有之前存的冰指再扔了这个冰指,回去打寒冰箭65 if fingersOfFrost_trigger <= fingersOfFrost_probability and brainFreeze_trigger > brainFreeze_probability:66 while fingersOfFrost_number > 0:67 time = time + gcd68 damage = damage + iceLance_chain_damage_fingersOfFrost_expectation69 fingersOfFrost_number -= 170 time = time + gcd71 damage = damage + iceLance_chain_damage_fingersOfFrost_expectation72 # 刚读完的寒冰箭触发了冰智,没触发冰指,改变资源数量后正常打1+1+2,等效于回到开头打寒冰箭73 elif fingersOfFrost_trigger > fingersOfFrost_probability and brainFreeze_trigger <= brainFreeze_probability:74 brainFreeze_number += 175 brainFreeze_number = min(brainFreeze_number, 1)76 # 刚读完的寒冰箭触发了冰智和冰指,改变资源数量后正常打1+1+2,等效于回到开头打寒冰箭77 elif fingersOfFrost_trigger <= fingersOfFrost_probability and brainFreeze_trigger <= brainFreeze_probability:78 fingersOfFrost_number += 179 fingersOfFrost_number = min(fingersOfFrost_number, 2)80 brainFreeze_number += 181 brainFreeze_number = min(brainFreeze_number, 1)82 # 之前触发了冰智,没有触发冰指,正常1+1+283 elif fingersOfFrost_number == 0 and brainFreeze_number == 1:84 time = time + gcd * 385 damage = damage - frostBolt_damage_expectation + frostBolt_damage_freeze_expectation86 damage = damage + iceStorm_damage_brainFreeze_expectation + iceLance_chain_damage_fingersOfFrost_expectation * 287 brainFreeze_number = 088 # 冰风暴多一根冰刺,同时冰刺在冻结状态下清089 iceThorn_number += 190 if iceThorn_auto:91 damage = damage - iceThorn_damage_expectation + iceThorn_damage_freeze_expectation92 damage = damage + iceThorn_number * iceThorn_damage_freeze_expectation93 iceThorn_number = 094 # 刚读完的寒冰箭在之前冰智对应的冰风暴出手后,触发了冰指,没触发冰智,浪费一个冰指95 if fingersOfFrost_trigger <= fingersOfFrost_probability and brainFreeze_trigger > brainFreeze_probability:96 pass97 # 刚读完的寒冰箭在之前冰智对应的冰风暴出手后,触发冰智,没触发冰指,多了一个冰智98 elif fingersOfFrost_trigger > fingersOfFrost_probability and brainFreeze_trigger <= brainFreeze_probability:99 brainFreeze_number += 1100 brainFreeze_number = min(brainFreeze_number, 1)101 # 刚读完的寒冰箭在之前冰智对应的冰风暴出手后,触发了冰指和冰智,浪费一个冰指,多了一个冰智102 elif fingersOfFrost_trigger <= fingersOfFrost_probability and brainFreeze_trigger <= brainFreeze_probability:103 brainFreeze_number += 1104 brainFreeze_number = min(brainFreeze_number, 1)105 # 之前触发了冰智和冰指,浪费掉存的冰指正常1+1+2106 elif fingersOfFrost_number > 0 and brainFreeze_number == 1:107 time = time + gcd * 3108 damage = damage - frostBolt_damage_expectation + frostBolt_damage_freeze_expectation109 damage = damage + iceStorm_damage_brainFreeze_expectation + iceLance_chain_damage_fingersOfFrost_expectation * 2110 brainFreeze_number = 0111 fingersOfFrost_number = 0112 # 冰风暴多一根冰刺,同时冰刺在冻结状态下清0113 iceThorn_number += 1114 if iceThorn_auto:115 damage = damage - iceThorn_damage_expectation + iceThorn_damage_freeze_expectation116 damage = damage + iceThorn_number * iceThorn_damage_freeze_expectation117 iceThorn_number = 0118 # 刚读完的寒冰箭在前一个寒冰箭冰智对应的冰风暴出手后,触发了冰指,没触发冰智,浪费一个冰指119 if fingersOfFrost_trigger <= fingersOfFrost_probability and brainFreeze_trigger > brainFreeze_probability:120 pass121 # 刚读完的寒冰箭在前一个寒冰箭冰智对应的冰风暴出手后,触发冰智,没触发冰指,多了一个冰智122 elif fingersOfFrost_trigger > fingersOfFrost_probability and brainFreeze_trigger <= brainFreeze_probability:123 brainFreeze_number += 1124 brainFreeze_number = min(brainFreeze_number, 1)125 # 刚读完的寒冰箭在前一个寒冰箭冰智对应的冰风暴出手后,触发了冰指和冰智,浪费一个冰指,多了一个冰智126 elif fingersOfFrost_trigger <= fingersOfFrost_probability and brainFreeze_trigger <= brainFreeze_probability:127 brainFreeze_number += 1128 brainFreeze_number = min(brainFreeze_number, 1)129 # 之前啥都没,读完这个寒冰箭计算完触发,回头继续读130 else:131 # 刚读完的寒冰箭,触发了冰指冰智132 if fingersOfFrost_trigger <= fingersOfFrost_probability and brainFreeze_trigger <= brainFreeze_probability:133 fingersOfFrost_number += 1134 fingersOfFrost_number = min(fingersOfFrost_number, 2)135 brainFreeze_number += 1136 brainFreeze_number = min(brainFreeze_number, 1)137 # 刚读完的寒冰箭,触发冰智,没触发冰指138 elif fingersOfFrost_trigger > fingersOfFrost_probability and brainFreeze_trigger <= brainFreeze_probability:139 brainFreeze_number += 1140 brainFreeze_number = min(brainFreeze_number, 1)141 # 刚读完的寒冰箭触发了冰指没触发冰智142 elif fingersOfFrost_trigger <= fingersOfFrost_probability and brainFreeze_trigger > brainFreeze_probability:143 fingersOfFrost_number += 1144 fingersOfFrost_number = min(fingersOfFrost_number, 2)145dps_1 = damage / time146damage = 0147time = 0148fingersOfFrost_number = 0149brainFreeze_number = 0150iceThorn_number = 0151# 第二种打法,绝不浪费任意可以打出的冰指,有冰智和冰指也先打冰指对应的冰枪再去1+1+2152while damage < 100000000000:153 # 读条一个寒冰箭154 time = time + freezeBolt_spellTime155 damage = damage + frostBolt_damage_expectation156 fingersOfFrost_trigger = np.random.random()157 brainFreeze_trigger = np.random.random()158 # 寒冰箭多一根冰刺,大于5自动发射159 iceThorn_number += 1160 iceThorn_auto = False161 if iceThorn_number > 5:162 iceThorn_auto = True163 iceThorn_number -= 1164 damage = damage + iceThorn_damage_expectation165 # 之前触发了冰指,没有触发冰智,扔完所有存的冰指166 if fingersOfFrost_number > 0 and brainFreeze_number == 0:167 while fingersOfFrost_number > 0:168 time = time + gcd169 damage = damage + iceLance_chain_damage_fingersOfFrost_expectation170 fingersOfFrost_number -= 1171 # 冰刺在普通状态下清0172 damage = damage + iceThorn_number * iceThorn_damage_expectation173 iceThorn_number = 0174 # 刚读完的寒冰箭触发了冰指,没触发冰智,扔完之前存的冰指对应的冰枪,立刻扔掉这个寒冰箭冰指的冰枪,回头读寒冰箭175 if fingersOfFrost_trigger <= fingersOfFrost_probability and brainFreeze_trigger > brainFreeze_probability:176 time = time + gcd177 damage = damage + iceLance_chain_damage_fingersOfFrost_expectation178 # 刚读完的寒冰箭触发了冰智,没触发冰指,扔完之前存的冰指对应的冰枪,回去正常打1+1+2,179 elif fingersOfFrost_trigger > fingersOfFrost_probability and brainFreeze_trigger <= brainFreeze_probability:180 brainFreeze_number += 1181 brainFreeze_number = min(brainFreeze_number, 1)182 # 刚读完的寒冰箭触发了冰智和冰指,扔完之前存的冰指对应的冰枪,先扔这个寒冰箭冰指对应的冰枪,再回到开头打1+1+2183 elif fingersOfFrost_trigger <= fingersOfFrost_probability and brainFreeze_trigger <= brainFreeze_probability:184 time = time + gcd185 damage = damage + iceLance_chain_damage_fingersOfFrost_expectation186 brainFreeze_number += 1187 brainFreeze_number = min(brainFreeze_number, 1)188 # 之前触发了冰智,没有触发冰指,正常1+1+2189 elif fingersOfFrost_number == 0 and brainFreeze_number == 1:190 time = time + gcd * 3191 damage = damage - frostBolt_damage_expectation + frostBolt_damage_freeze_expectation192 damage = damage + iceStorm_damage_brainFreeze_expectation + iceLance_chain_damage_fingersOfFrost_expectation * 2193 brainFreeze_number = 0194 # 冰风暴多一根冰刺,同时冰刺在冻结状态下清0195 iceThorn_number += 1196 if iceThorn_auto:197 damage = damage - iceThorn_damage_expectation + iceThorn_damage_freeze_expectation198 damage = damage + iceThorn_number * iceThorn_damage_freeze_expectation199 iceThorn_number = 0200 # 刚读完的寒冰箭在之前冰智对应的冰风暴出手后,触发了冰指,没触发冰智,浪费一个冰指201 if fingersOfFrost_trigger <= fingersOfFrost_probability and brainFreeze_trigger > brainFreeze_probability:202 pass203 # 刚读完的寒冰箭在之前冰智对应的冰风暴出手后,触发冰智,没触发冰指,多了一个冰智204 elif fingersOfFrost_trigger > fingersOfFrost_probability and brainFreeze_trigger <= brainFreeze_probability:205 brainFreeze_number += 1206 brainFreeze_number = min(brainFreeze_number, 1)207 # 刚读完的寒冰箭在之前冰智对应的冰风暴出手后,触发了冰指和冰智,浪费一个冰指,多了一个冰智208 elif fingersOfFrost_trigger <= fingersOfFrost_probability and brainFreeze_trigger <= brainFreeze_probability:209 brainFreeze_number += 1210 brainFreeze_number = min(brainFreeze_number, 1)211 # 之前触发了冰智和冰指,扔完之前存的冰枪,看这个寒冰箭有没有触发冰指,再回头打1+1+2212 elif fingersOfFrost_number > 0 and brainFreeze_number == 1:213 while fingersOfFrost_number > 0:214 time = time + gcd215 damage = damage + iceLance_chain_damage_fingersOfFrost_expectation216 fingersOfFrost_number -= 1217 # 冰刺在普通状态下清0218 damage = damage + iceThorn_number * iceThorn_damage_expectation219 iceThorn_number = 0220 # 刚读完的寒冰箭在之前冰指对应的冰枪出手后,触发了冰指,没触发冰智,打完所有存的冰指,打出这个寒冰箭冰指的冰枪,回头1+1+2221 if fingersOfFrost_trigger <= fingersOfFrost_probability and brainFreeze_trigger > brainFreeze_probability:222 time = time + gcd223 damage = damage + iceLance_chain_damage_fingersOfFrost_expectation224 # 刚读完的寒冰箭之前存的冰指对应的冰枪出手后,触发冰智,没触发冰指,前一个冰智还在,浪费一个冰智225 elif fingersOfFrost_trigger > fingersOfFrost_probability and brainFreeze_trigger <= brainFreeze_probability:226 pass227 # 刚读完的寒冰箭在之前冰指对应的冰枪出手后,触发了冰指和冰智,前一个冰智还在,浪费一个冰智,打出这个寒冰箭冰指对应的冰枪,回头228 elif fingersOfFrost_trigger <= fingersOfFrost_probability and brainFreeze_trigger <= brainFreeze_probability:229 time = time + gcd230 damage = damage + iceLance_chain_damage_fingersOfFrost_expectation231 # 之前啥都没有,读完这个寒冰箭计算完触发,回头继续读232 else:233 # 刚读完的寒冰箭,触发了冰指冰智234 if fingersOfFrost_trigger <= fingersOfFrost_probability and brainFreeze_trigger <= brainFreeze_probability:235 fingersOfFrost_number += 1236 fingersOfFrost_number = min(fingersOfFrost_number, 2)237 brainFreeze_number += 1238 brainFreeze_number = min(brainFreeze_number, 1)239 # 刚读完的寒冰箭,触发冰智,没触发冰指240 elif fingersOfFrost_trigger > fingersOfFrost_probability and brainFreeze_trigger <= brainFreeze_probability:241 brainFreeze_number += 1242 brainFreeze_number = min(brainFreeze_number, 1)243 # 刚读完的寒冰箭触发了冰指没触发冰智244 elif fingersOfFrost_trigger <= fingersOfFrost_probability and brainFreeze_trigger > brainFreeze_probability:245 fingersOfFrost_number += 1246 fingersOfFrost_number = min(fingersOfFrost_number, 2)247dps_2 = damage / time248damage = 0249time = 0250fingersOfFrost_number = 0251brainFreeze_number = 0252iceThorn_number = 0253# 第三种打法,不浪费任何冰指,同时除非是之前只有冰智,并且刚扔出去了寒冰箭,才打1+1+2,否则有冰智直接打冰风暴+2冰枪254while damage < 100000000000:255 # 读条一个寒冰箭256 time = time + freezeBolt_spellTime257 damage = damage + frostBolt_damage_expectation258 fingersOfFrost_trigger = np.random.random()259 brainFreeze_trigger = np.random.random()260 # 寒冰箭多一根冰刺,大于5自动发射261 iceThorn_number += 1262 iceThorn_auto = False263 if iceThorn_number > 5:264 iceThorn_auto = True265 iceThorn_number -= 1266 damage = damage + iceThorn_damage_expectation267 # 之前触发了冰指,没有触发冰智,打完所有存的冰指268 if fingersOfFrost_number > 0 and brainFreeze_number == 0:269 while fingersOfFrost_number > 0:270 time = time + gcd271 damage = damage + iceLance_chain_damage_fingersOfFrost_expectation272 fingersOfFrost_number -= 1273 # 冰刺在普通状态下清0274 damage = damage + iceThorn_number * iceThorn_damage_expectation275 iceThorn_number = 0276 # 刚读完的寒冰箭触发了冰指,没触发冰智,扔完之前冰指对应的冰枪立刻扔掉这个寒冰箭冰指的冰枪,回去打寒冰箭277 if fingersOfFrost_trigger <= fingersOfFrost_probability and brainFreeze_trigger > brainFreeze_probability:278 time = time + gcd279 damage = damage + iceLance_chain_damage_fingersOfFrost_expectation280 # 刚读完的寒冰箭触发了冰智,没触发冰指,扔完之前冰指对应的冰枪,打这个冰智的冰风暴+2冰枪281 elif fingersOfFrost_trigger > fingersOfFrost_probability and brainFreeze_trigger <= brainFreeze_probability:282 time = time + gcd * 3283 damage = damage + iceStorm_damage_brainFreeze_expectation + \284 iceLance_chain_damage_fingersOfFrost_expectation * 2285 brainFreeze_number = 0286 # 冰风暴多一根冰刺,同时冰刺在冻结状态下清0,但是由于这个冰风暴前面是冰枪不是寒冰箭,寒冰箭的冰刺吃不到冻结287 iceThorn_number += 1288 damage = damage + iceThorn_number * iceThorn_damage_freeze_expectation289 iceThorn_number = 0290 # 刚读完的寒冰箭触发了冰智和冰指,扔完之前冰指对应的冰枪,先扔这个寒冰箭冰指对应的冰枪,再打这个冰智的冰风暴+2冰枪291 elif fingersOfFrost_trigger <= fingersOfFrost_probability and brainFreeze_trigger <= brainFreeze_probability:292 time = time + gcd293 damage = damage + iceLance_chain_damage_fingersOfFrost_expectation294 time = time + gcd * 3295 damage = damage + iceStorm_damage_brainFreeze_expectation + iceLance_chain_damage_fingersOfFrost_expectation * 2296 brainFreeze_number = 0297 # 冰风暴多一根冰刺,同时冰刺在冻结状态下清0,但是由于这个冰风暴前面是冰枪不是寒冰箭,寒冰箭的冰刺吃不到冻结298 iceThorn_number += 1299 damage = damage + iceThorn_number * iceThorn_damage_freeze_expectation300 iceThorn_number = 0301 # 之前触发了冰智,没有触发冰指,正常1+1+2302 elif fingersOfFrost_number == 0 and brainFreeze_number == 1:303 time = time + gcd * 3304 damage = damage - frostBolt_damage_expectation + frostBolt_damage_freeze_expectation305 damage = damage + iceStorm_damage_brainFreeze_expectation + iceLance_chain_damage_fingersOfFrost_expectation * 2306 brainFreeze_number = 0307 # 冰风暴多一根冰刺,同时冰刺在冻结状态下清0308 iceThorn_number += 1309 if iceThorn_auto:310 damage = damage - iceThorn_damage_expectation + iceThorn_damage_freeze_expectation311 damage = damage + iceThorn_number * iceThorn_damage_freeze_expectation312 iceThorn_number = 0313 # 刚读完的寒冰箭在之前冰智对应的冰风暴出手后,触发了冰指,没触发冰智,浪费一个冰指314 if fingersOfFrost_trigger <= fingersOfFrost_probability and brainFreeze_trigger > brainFreeze_probability:315 pass316 # 刚读完的寒冰箭在之前冰智对应的冰风暴出手后,触发冰智,没触发冰指,多了一个冰智,打完这个1+1+2,直接打这个冰智的冰风暴+2冰枪317 elif fingersOfFrost_trigger > fingersOfFrost_probability and brainFreeze_trigger <= brainFreeze_probability:318 time = time + gcd * 3319 damage = damage + iceStorm_damage_brainFreeze_expectation + \320 iceLance_chain_damage_fingersOfFrost_expectation * 2321 # 冰风暴多一根冰刺,同时冰刺在冻结状态下清0,此时不用考虑刚读完的寒冰箭的冰刺,之前的冰风暴已经算在内了322 iceThorn_number += 1323 damage = damage + iceThorn_number * iceThorn_damage_freeze_expectation324 iceThorn_number = 0325 # 刚读完的寒冰箭在之前冰智对应的冰风暴出手后,触发了冰指和冰智,浪费一个冰指,多了一个冰智,打完这个1+1+2,326 # 直接打这个冰智的冰风暴+2冰枪327 elif fingersOfFrost_trigger <= fingersOfFrost_probability and brainFreeze_trigger <= brainFreeze_probability:328 time = time + gcd * 3329 damage = damage + iceStorm_damage_brainFreeze_expectation + \330 iceLance_chain_damage_fingersOfFrost_expectation * 2331 # 冰风暴多一根冰刺,同时冰刺在冻结状态下清0,此时不用考虑刚读完的寒冰箭的冰刺,之前的冰风暴已经算在内了332 iceThorn_number += 1333 damage = damage + iceThorn_number * iceThorn_damage_freeze_expectation334 iceThorn_number = 0335 # 之前触发了冰智和冰指,读完这个寒冰箭,扔完所有冰指打之前冰智的冰风暴+2冰枪336 elif fingersOfFrost_number > 0 and brainFreeze_number == 1:337 while fingersOfFrost_number > 0:338 time = time + gcd339 damage = damage + iceLance_chain_damage_fingersOfFrost_expectation340 fingersOfFrost_number -= 1341 time = time + gcd * 3342 damage = damage + iceStorm_damage_brainFreeze_expectation + iceLance_chain_damage_fingersOfFrost_expectation * 2343 brainFreeze_number = 0344 # 冰刺在普通状态下清0345 damage = damage + iceThorn_number * iceThorn_damage_expectation346 iceThorn_number = 0347 # 冰风暴多一根冰刺,同时冰刺在冻结状态下清0,但是由于这个冰风暴前面是冰枪不是寒冰箭,寒冰箭的冰刺吃不到冻结348 iceThorn_number += 1349 damage = damage + iceThorn_number * iceThorn_damage_freeze_expectation350 iceThorn_number = 0351 # 刚读完的寒冰箭触发了冰指,没触发冰智,扔完之前的冰指立刻扔掉这个寒冰箭冰指的冰枪,再扔冰智的冰风暴+2冰枪,相当于多了个冰指352 if fingersOfFrost_trigger <= fingersOfFrost_probability and brainFreeze_trigger > brainFreeze_probability:353 time = time + gcd354 damage = damage + iceLance_chain_damage_fingersOfFrost_expectation355 # 刚读完的寒冰箭触发了冰智,没触发冰指,浪费一个冰智,扔完之前的冰指冰智,回头356 elif fingersOfFrost_trigger > fingersOfFrost_probability and brainFreeze_trigger <= brainFreeze_probability:357 pass358 # 刚读完的寒冰箭触发了冰智和冰指,浪费一个冰智,扔完之前冰指对应的冰枪,立刻扔掉这个寒冰箭冰指的冰枪,再冰智,回头359 elif fingersOfFrost_trigger <= fingersOfFrost_probability and brainFreeze_trigger <= brainFreeze_probability:360 time = time + gcd361 damage = damage + iceLance_chain_damage_fingersOfFrost_expectation362 else:363 # 刚读完的寒冰箭,触发了冰指冰智364 if fingersOfFrost_trigger <= fingersOfFrost_probability and brainFreeze_trigger <= brainFreeze_probability:365 fingersOfFrost_number += 1366 fingersOfFrost_number = min(fingersOfFrost_number, 2)367 brainFreeze_number += 1368 brainFreeze_number = min(brainFreeze_number, 1)369 # 刚读完的寒冰箭,触发冰智,没触发冰指370 elif fingersOfFrost_trigger > fingersOfFrost_probability and brainFreeze_trigger <= brainFreeze_probability:371 brainFreeze_number += 1372 brainFreeze_number = min(brainFreeze_number, 1)373 # 刚读完的寒冰箭触发了冰指没触发冰智374 elif fingersOfFrost_trigger <= fingersOfFrost_probability and brainFreeze_trigger > brainFreeze_probability:375 fingersOfFrost_number += 1376 fingersOfFrost_number = min(fingersOfFrost_number, 2)377dps_3 = damage / time378damage = 0379time = 0380fingersOfFrost_number = 0381brainFreeze_number = 0382iceThorn_number = 0383# 第四种打法,除非刚好读完一个寒冰箭同时有冰智,否则不打1+1+2,直接打冰风暴+2冰枪,同时有冰智冰指,冰智优先,即浪费掉冰指384while damage < 100000000000:385 # 读条一个寒冰箭386 time = time + freezeBolt_spellTime387 damage = damage + frostBolt_damage_expectation388 fingersOfFrost_trigger = np.random.random()389 brainFreeze_trigger = np.random.random()390 # 寒冰箭多一根冰刺,大于5自动发射391 iceThorn_number += 1392 iceThorn_auto = False393 if iceThorn_number > 5:394 iceThorn_auto = True395 iceThorn_number -= 1396 damage = damage + iceThorn_damage_expectation397 # 之前有冰指,没有触发冰智,读完这个寒冰箭打一个冰指的冰枪398 if fingersOfFrost_number > 0 and brainFreeze_number == 0:399 time = time + gcd400 damage = damage + iceLance_chain_damage_fingersOfFrost_expectation401 fingersOfFrost_number -= 1402 # 冰刺在普通状态下清0403 damage = damage + iceThorn_number * iceThorn_damage_expectation404 iceThorn_number = 0405 # 刚读完的寒冰箭触发了冰指,没触发冰智,扔掉所有之前存的冰指再扔了这个冰指,回去打寒冰箭406 if fingersOfFrost_trigger <= fingersOfFrost_probability and brainFreeze_trigger > brainFreeze_probability:407 while fingersOfFrost_number > 0:408 time = time + gcd409 damage = damage + iceLance_chain_damage_fingersOfFrost_expectation410 fingersOfFrost_number -= 1411 time = time + gcd412 damage = damage + iceLance_chain_damage_fingersOfFrost_expectation413 # 刚读完的寒冰箭触发了冰智,没触发冰指,打冰风暴+2冰枪,可能浪费冰指414 elif fingersOfFrost_trigger > fingersOfFrost_probability and brainFreeze_trigger <= brainFreeze_probability:415 time = time + gcd * 3416 damage = damage + iceStorm_damage_brainFreeze_expectation + \417 iceLance_chain_damage_fingersOfFrost_expectation * 2418 fingersOfFrost_number = 0419 # 冰风暴多一根冰刺,同时冰刺在冻结状态下清0,但是由于这个冰风暴前面是冰枪不是寒冰箭,寒冰箭的冰刺吃不到冻结420 iceThorn_number += 1421 damage = damage + iceThorn_number * iceThorn_damage_freeze_expectation422 iceThorn_number = 0423 # 刚读完的寒冰箭触发了冰智和冰指,打冰风暴+2冰枪,起码浪费1冰指424 elif fingersOfFrost_trigger <= fingersOfFrost_probability and brainFreeze_trigger <= brainFreeze_probability:425 time = time + gcd * 3426 damage = damage + iceStorm_damage_brainFreeze_expectation + \427 iceLance_chain_damage_fingersOfFrost_expectation * 2428 fingersOfFrost_number = 0429 # 冰风暴多一根冰刺,同时冰刺在冻结状态下清0,但是由于这个冰风暴前面是冰枪不是寒冰箭,寒冰箭的冰刺吃不到冻结430 iceThorn_number += 1431 damage = damage + iceThorn_number * iceThorn_damage_freeze_expectation432 iceThorn_number = 0433 # 之前触发了冰智,没有触发冰指,正常1+1+2434 elif fingersOfFrost_number == 0 and brainFreeze_number == 1:435 time = time + gcd * 3436 damage = damage - frostBolt_damage_expectation + frostBolt_damage_freeze_expectation437 damage = damage + iceStorm_damage_brainFreeze_expectation + \438 iceLance_chain_damage_fingersOfFrost_expectation * 2439 brainFreeze_number = 0440 # 冰风暴多一根冰刺,同时冰刺在冻结状态下清0441 iceThorn_number += 1442 if iceThorn_auto:443 damage = damage - iceThorn_damage_expectation + iceThorn_damage_freeze_expectation444 damage = damage + iceThorn_number * iceThorn_damage_freeze_expectation445 iceThorn_number = 0446 # 刚读完的寒冰箭在之前冰智对应的冰风暴出手后,触发了冰指,没触发冰智,浪费一个冰指447 if fingersOfFrost_trigger <= fingersOfFrost_probability and brainFreeze_trigger > brainFreeze_probability:448 pass449 # 刚读完的寒冰箭在之前冰智对应的冰风暴出手后,触发冰智,没触发冰指,打完之前冰智的1+1+2,打这个冰智的冰风暴+2冰枪450 elif fingersOfFrost_trigger > fingersOfFrost_probability and brainFreeze_trigger <= brainFreeze_probability:451 time = time + gcd * 3452 damage = damage + iceStorm_damage_brainFreeze_expectation + \453 iceLance_chain_damage_fingersOfFrost_expectation * 2454 # 冰风暴多一根冰刺,同时冰刺在冻结状态下清0,此时不用考虑刚读完的寒冰箭的冰刺,之前的冰风暴已经算在内了455 iceThorn_number += 1456 damage = damage + iceThorn_number * iceThorn_damage_freeze_expectation457 iceThorn_number = 0458 # 刚读完的寒冰箭在之前冰智对应的冰风暴出手后,触发了冰指和冰智,打完之前冰智的1+1+2,打这个冰智的冰风暴+2冰枪,浪费一个冰指459 elif fingersOfFrost_trigger <= fingersOfFrost_probability and brainFreeze_trigger <= brainFreeze_probability:460 time = time + gcd * 3461 damage = damage + iceStorm_damage_brainFreeze_expectation + \462 iceLance_chain_damage_fingersOfFrost_expectation * 2463 # 冰风暴多一根冰刺,同时冰刺在冻结状态下清0,此时不用考虑刚读完的寒冰箭的冰刺,之前的冰风暴已经算在内了464 iceThorn_number += 1465 damage = damage + iceThorn_number * iceThorn_damage_freeze_expectation466 iceThorn_number = 0467 # 之前触发了冰智和冰指,浪费掉存的冰指正常1+1+2468 elif fingersOfFrost_number > 0 and brainFreeze_number == 1:469 time = time + gcd * 3470 damage = damage - frostBolt_damage_expectation + frostBolt_damage_freeze_expectation471 damage = damage + iceStorm_damage_brainFreeze_expectation + iceLance_chain_damage_fingersOfFrost_expectation * 2472 brainFreeze_number = 0473 fingersOfFrost_number = 0474 # 冰风暴多一根冰刺,同时冰刺在冻结状态下清0475 iceThorn_number += 1476 if iceThorn_auto:477 damage = damage - iceThorn_damage_expectation + iceThorn_damage_freeze_expectation478 damage = damage + iceThorn_number * iceThorn_damage_freeze_expectation479 iceThorn_number = 0480 # 刚读完的寒冰箭之前冰智对应的冰风暴出手后,触发了冰指,没触发冰智,浪费一个冰指481 if fingersOfFrost_trigger <= fingersOfFrost_probability and brainFreeze_trigger > brainFreeze_probability:482 pass483 # 刚读完的寒冰箭在之前冰智对应的冰风暴出手后,触发冰智,没触发冰指,打冰风暴+2冰枪484 elif fingersOfFrost_trigger > fingersOfFrost_probability and brainFreeze_trigger <= brainFreeze_probability:485 time = time + gcd * 3486 damage = damage + iceStorm_damage_brainFreeze_expectation + \487 iceLance_chain_damage_fingersOfFrost_expectation * 2488 # 冰风暴多一根冰刺,同时冰刺在冻结状态下清0,此时不用考虑刚读完的寒冰箭的冰刺,之前的冰风暴已经算在内了489 iceThorn_number += 1490 damage = damage + iceThorn_number * iceThorn_damage_freeze_expectation491 iceThorn_number = 0492 # 刚读完的寒冰箭在前一个寒冰箭冰智对应的冰风暴出手后,触发了冰指和冰智,浪费一个冰指,打冰风暴+2冰枪493 elif fingersOfFrost_trigger <= fingersOfFrost_probability and brainFreeze_trigger <= brainFreeze_probability:494 time = time + gcd * 3495 damage = damage + iceStorm_damage_brainFreeze_expectation + \496 iceLance_chain_damage_fingersOfFrost_expectation * 2497 # 冰风暴多一根冰刺,同时冰刺在冻结状态下清0,此时不用考虑刚读完的寒冰箭的冰刺,之前的冰风暴已经算在内了498 iceThorn_number += 1499 damage = damage + iceThorn_number * iceThorn_damage_freeze_expectation500 iceThorn_number = 0501 # 之前啥都没,读完这个寒冰箭计算完触发,回头继续读502 else:503 # 刚读完的寒冰箭,触发了冰指冰智504 if fingersOfFrost_trigger <= fingersOfFrost_probability and brainFreeze_trigger <= brainFreeze_probability:505 fingersOfFrost_number += 1506 fingersOfFrost_number = min(fingersOfFrost_number, 2)507 brainFreeze_number += 1508 brainFreeze_number = min(brainFreeze_number, 1)509 # 刚读完的寒冰箭,触发冰智,没触发冰指510 elif fingersOfFrost_trigger > fingersOfFrost_probability and brainFreeze_trigger <= brainFreeze_probability:511 brainFreeze_number += 1512 brainFreeze_number = min(brainFreeze_number, 1)513 # 刚读完的寒冰箭触发了冰指没触发冰智514 elif fingersOfFrost_trigger <= fingersOfFrost_probability and brainFreeze_trigger > brainFreeze_probability:515 fingersOfFrost_number += 1516 fingersOfFrost_number = min(fingersOfFrost_number, 2)517dps_4 = damage / time518print(dps_1)519print(dps_2)520print(dps_3)...

Full Screen

Full Screen

freeze2.py

Source:freeze2.py Github

copy

Full Screen

1import numpy as np2# 基本设定,暴击,冻结暴击,施法时间,冰指和冰智概率(点冰冻之触)3critical = 1/34critical_expectation = 1 + critical5critical_expectation = min(critical_expectation, 2)6freeze_critical_expectation = min(1 + 1.5 * critical + 0.5, 2)7freezeBolt_spellTime = 28gcd = 1.59fingersOfFrost_probability = 0.1810brainFreeze_probability = 0.3611print(freeze_critical_expectation)12#寒冰箭设定,基本伤害,期望伤害,冻结下期望伤害13frostBolt_basic_damage = 75614frostBolt_damage_expectation = frostBolt_basic_damage * critical_expectation15frostBolt_damage_freeze_expectation = frostBolt_basic_damage * freeze_critical_expectation16#冰枪设定,基本伤害,连锁反应天赋伤害,冰指下期望伤害17iceLance_basic_damage = 56218iceLance_basic_damage_fingersOfFrost_expectation = iceLance_basic_damage * 3 * freeze_critical_expectation19#冰风暴设定,基本伤害,冰智下基础伤害,冰智下期望伤害20iceStorm_basic_damage = 122021iceStorm_damage_brainFreeze = iceStorm_basic_damage * 1.522iceStorm_damage_brainFreeze_expectation = iceStorm_damage_brainFreeze / 3 * critical_expectation \23 + iceStorm_damage_brainFreeze / 3 * 2 * freeze_critical_expectation24damage = 025time = 026fingersOfFrost_number = 027brainFreeze_number = 028#t = np.random.random()29#第一种打法,无论何时都是冰智优先,不管有没有冰指,只要有冰智都打1+1+230while damage < 100000000000:31 #读条一个寒冰箭32 time = time + freezeBolt_spellTime33 damage = damage + frostBolt_damage_expectation34 fingersOfFrost_trigger = np.random.random()35 brainFreeze_trigger = np.random.random()36 #之前有冰指,没有触发冰智,读完这个寒冰箭打一个冰指的冰枪37 if fingersOfFrost_number > 0 and brainFreeze_number == 0:38 time = time + gcd39 damage = damage + iceLance_basic_damage_fingersOfFrost_expectation40 fingersOfFrost_number -= 141 #刚读完的寒冰箭触发了冰指,没触发冰智,扔掉所有之前存的冰指再扔了这个冰指,回去打寒冰箭42 if fingersOfFrost_trigger <= fingersOfFrost_probability and brainFreeze_trigger > brainFreeze_probability:43 while fingersOfFrost_number > 0:44 time = time + gcd45 damage = damage + iceLance_basic_damage_fingersOfFrost_expectation46 fingersOfFrost_number -= 147 time = time + gcd48 damage = damage + iceLance_basic_damage_fingersOfFrost_expectation49 # 刚读完的寒冰箭触发了冰智,没触发冰指,改变资源数量后正常打1+1+2,等效于回到开头打寒冰箭50 elif fingersOfFrost_trigger > fingersOfFrost_probability and brainFreeze_trigger <= brainFreeze_probability:51 brainFreeze_number += 152 brainFreeze_number = min(brainFreeze_number, 1)53 # 刚读完的寒冰箭触发了冰智和冰指,改变资源数量后正常打1+1+2,等效于回到开头打寒冰箭54 elif fingersOfFrost_trigger <= fingersOfFrost_probability and brainFreeze_trigger <= brainFreeze_probability:55 fingersOfFrost_number += 156 fingersOfFrost_number = min(fingersOfFrost_number, 2)57 brainFreeze_number += 158 brainFreeze_number = min(brainFreeze_number, 1)59 # 之前触发了冰智,没有触发冰指,正常1+1+260 elif fingersOfFrost_number == 0 and brainFreeze_number == 1:61 time = time + gcd * 362 damage = damage - frostBolt_damage_expectation + frostBolt_damage_freeze_expectation63 damage = damage + iceStorm_damage_brainFreeze_expectation + iceLance_basic_damage_fingersOfFrost_expectation * 264 brainFreeze_number = 065 #刚读完的寒冰箭在之前冰智对应的冰风暴出手后,触发了冰指,没触发冰智,浪费一个冰指66 if fingersOfFrost_trigger <= fingersOfFrost_probability and brainFreeze_trigger > brainFreeze_probability:67 pass68 # 刚读完的寒冰箭在之前冰智对应的冰风暴出手后,触发冰智,没触发冰指,多了一个冰智69 elif fingersOfFrost_trigger > fingersOfFrost_probability and brainFreeze_trigger <= brainFreeze_probability:70 brainFreeze_number += 171 brainFreeze_number = min(brainFreeze_number, 1)72 # 刚读完的寒冰箭在之前冰智对应的冰风暴出手后,触发了冰指和冰智,浪费一个冰指,多了一个冰智73 elif fingersOfFrost_trigger <= fingersOfFrost_probability and brainFreeze_trigger <= brainFreeze_probability:74 brainFreeze_number += 175 brainFreeze_number = min(brainFreeze_number, 1)76 # 之前触发了冰智和冰指,浪费掉存的冰指正常1+1+277 elif fingersOfFrost_number > 0 and brainFreeze_number == 1:78 time = time + gcd * 379 damage = damage - frostBolt_damage_expectation + frostBolt_damage_freeze_expectation80 damage = damage + iceStorm_damage_brainFreeze_expectation + iceLance_basic_damage_fingersOfFrost_expectation * 281 brainFreeze_number = 082 fingersOfFrost_number = 083 #刚读完的寒冰箭在前一个寒冰箭冰智对应的冰风暴出手后,触发了冰指,没触发冰智,浪费一个冰指84 if fingersOfFrost_trigger <= fingersOfFrost_probability and brainFreeze_trigger > brainFreeze_probability:85 pass86 # 刚读完的寒冰箭在前一个寒冰箭冰智对应的冰风暴出手后,触发冰智,没触发冰指,多了一个冰智87 elif fingersOfFrost_trigger > fingersOfFrost_probability and brainFreeze_trigger <= brainFreeze_probability:88 brainFreeze_number += 189 brainFreeze_number = min(brainFreeze_number, 1)90 # 刚读完的寒冰箭在前一个寒冰箭冰智对应的冰风暴出手后,触发了冰指和冰智,浪费一个冰指,多了一个冰智91 elif fingersOfFrost_trigger <= fingersOfFrost_probability and brainFreeze_trigger <= brainFreeze_probability:92 brainFreeze_number += 193 brainFreeze_number = min(brainFreeze_number, 1)94 #之前啥都没,读完这个寒冰箭计算完触发,回头继续读95 else:96 # 刚读完的寒冰箭,触发了冰指冰智97 if fingersOfFrost_trigger <= fingersOfFrost_probability and brainFreeze_trigger <= brainFreeze_probability:98 fingersOfFrost_number += 199 fingersOfFrost_number = min(fingersOfFrost_number, 2)100 brainFreeze_number += 1101 brainFreeze_number = min(brainFreeze_number, 1)102 # 刚读完的寒冰箭,触发冰智,没触发冰指103 elif fingersOfFrost_trigger > fingersOfFrost_probability and brainFreeze_trigger <= brainFreeze_probability:104 brainFreeze_number += 1105 brainFreeze_number = min(brainFreeze_number, 1)106 # 刚读完的寒冰箭触发了冰指没触发冰智107 elif fingersOfFrost_trigger <= fingersOfFrost_probability and brainFreeze_trigger > brainFreeze_probability:108 fingersOfFrost_number += 1109 fingersOfFrost_number = min(fingersOfFrost_number, 2)110dps_1 = damage / time111damage = 0112time = 0113fingersOfFrost_number = 0114brainFreeze_number = 0115#第二种打法,绝不浪费任意可以打出的冰指,有冰智和冰指也先打冰指对应的冰枪再去1+1+2116while damage < 100000000000:117 #读条一个寒冰箭118 time = time + freezeBolt_spellTime119 damage = damage + frostBolt_damage_expectation120 fingersOfFrost_trigger = np.random.random()121 brainFreeze_trigger = np.random.random()122 #之前触发了冰指,没有触发冰智,扔完所有存的冰指123 if fingersOfFrost_number > 0 and brainFreeze_number == 0:124 while fingersOfFrost_number > 0:125 time = time + gcd126 damage = damage + iceLance_basic_damage_fingersOfFrost_expectation127 fingersOfFrost_number -= 1128 #刚读完的寒冰箭触发了冰指,没触发冰智,扔完之前存的冰指对应的冰枪,立刻扔掉这个寒冰箭冰指的冰枪,回头读寒冰箭129 if fingersOfFrost_trigger <= fingersOfFrost_probability and brainFreeze_trigger > brainFreeze_probability:130 time = time + gcd131 damage = damage + iceLance_basic_damage_fingersOfFrost_expectation132 # 刚读完的寒冰箭触发了冰智,没触发冰指,扔完之前存的冰指对应的冰枪,回去正常打1+1+2,133 elif fingersOfFrost_trigger > fingersOfFrost_probability and brainFreeze_trigger <= brainFreeze_probability:134 brainFreeze_number += 1135 brainFreeze_number = min(brainFreeze_number, 1)136 # 刚读完的寒冰箭触发了冰智和冰指,扔完之前存的冰指对应的冰枪,先扔这个寒冰箭冰指对应的冰枪,再回到开头打1+1+2137 elif fingersOfFrost_trigger <= fingersOfFrost_probability and brainFreeze_trigger <= brainFreeze_probability:138 time = time + gcd139 damage = damage + iceLance_basic_damage_fingersOfFrost_expectation140 brainFreeze_number += 1141 brainFreeze_number = min(brainFreeze_number, 1)142 # 之前触发了冰智,没有触发冰指,正常1+1+2143 elif fingersOfFrost_number == 0 and brainFreeze_number == 1:144 time = time + gcd * 3145 damage = damage - frostBolt_damage_expectation + frostBolt_damage_freeze_expectation146 damage = damage + iceStorm_damage_brainFreeze_expectation + iceLance_basic_damage_fingersOfFrost_expectation * 2147 brainFreeze_number = 0148 #刚读完的寒冰箭在之前冰智对应的冰风暴出手后,触发了冰指,没触发冰智,浪费一个冰指149 if fingersOfFrost_trigger <= fingersOfFrost_probability and brainFreeze_trigger > brainFreeze_probability:150 pass151 # 刚读完的寒冰箭在之前冰智对应的冰风暴出手后,触发冰智,没触发冰指,多了一个冰智152 elif fingersOfFrost_trigger > fingersOfFrost_probability and brainFreeze_trigger <= brainFreeze_probability:153 brainFreeze_number += 1154 brainFreeze_number = min(brainFreeze_number, 1)155 # 刚读完的寒冰箭在之前冰智对应的冰风暴出手后,触发了冰指和冰智,浪费一个冰指,多了一个冰智156 elif fingersOfFrost_trigger <= fingersOfFrost_probability and brainFreeze_trigger <= brainFreeze_probability:157 brainFreeze_number += 1158 brainFreeze_number = min(brainFreeze_number, 1)159 # 之前触发了冰智和冰指,扔完之前存的冰枪,看这个寒冰箭有没有触发冰指,再回头打1+1+2160 elif fingersOfFrost_number > 0 and brainFreeze_number == 1:161 while fingersOfFrost_number > 0:162 time = time + gcd163 damage = damage + iceLance_basic_damage_fingersOfFrost_expectation164 fingersOfFrost_number -= 1165 #刚读完的寒冰箭在之前冰指对应的冰枪出手后,触发了冰指,没触发冰智,打完所有存的冰指,打出这个寒冰箭冰指的冰枪,回头1+1+2166 if fingersOfFrost_trigger <= fingersOfFrost_probability and brainFreeze_trigger > brainFreeze_probability:167 time = time + gcd168 damage = damage + iceLance_basic_damage_fingersOfFrost_expectation169 # 刚读完的寒冰箭之前存的冰指对应的冰枪出手后,触发冰智,没触发冰指,前一个冰智还在,浪费一个冰智170 elif fingersOfFrost_trigger > fingersOfFrost_probability and brainFreeze_trigger <= brainFreeze_probability:171 pass172 # 刚读完的寒冰箭在之前冰指对应的冰枪出手后,触发了冰指和冰智,前一个冰智还在,浪费一个冰智,打出这个寒冰箭冰指对应的冰枪,回头173 elif fingersOfFrost_trigger <= fingersOfFrost_probability and brainFreeze_trigger <= brainFreeze_probability:174 time = time + gcd175 damage = damage + iceLance_basic_damage_fingersOfFrost_expectation176 #之前啥都没有,读完这个寒冰箭计算完触发,回头继续读177 else:178 # 刚读完的寒冰箭,触发了冰指冰智179 if fingersOfFrost_trigger <= fingersOfFrost_probability and brainFreeze_trigger <= brainFreeze_probability:180 fingersOfFrost_number += 1181 fingersOfFrost_number = min(fingersOfFrost_number, 2)182 brainFreeze_number += 1183 brainFreeze_number = min(brainFreeze_number, 1)184 # 刚读完的寒冰箭,触发冰智,没触发冰指185 elif fingersOfFrost_trigger > fingersOfFrost_probability and brainFreeze_trigger <= brainFreeze_probability:186 brainFreeze_number += 1187 brainFreeze_number = min(brainFreeze_number, 1)188 # 刚读完的寒冰箭触发了冰指没触发冰智189 elif fingersOfFrost_trigger <= fingersOfFrost_probability and brainFreeze_trigger > brainFreeze_probability:190 fingersOfFrost_number += 1191 fingersOfFrost_number = min(fingersOfFrost_number, 2)192dps_2 = damage / time193damage = 0194time = 0195fingersOfFrost_number = 0196brainFreeze_number = 0197#第三种打法,不浪费任何冰指,同时除非是之前只有冰智,并且刚扔出去了寒冰箭,才打1+1+2,否则有冰智直接打冰风暴+2冰枪198while damage < 100000000000:199 #读条一个寒冰箭200 time = time + freezeBolt_spellTime201 damage = damage + frostBolt_damage_expectation202 fingersOfFrost_trigger = np.random.random()203 brainFreeze_trigger = np.random.random()204 #之前触发了冰指,没有触发冰智,打完所有存的冰指205 if fingersOfFrost_number > 0 and brainFreeze_number == 0:206 while fingersOfFrost_number > 0:207 time = time + gcd208 damage = damage + iceLance_basic_damage_fingersOfFrost_expectation209 fingersOfFrost_number -= 1210 # 刚读完的寒冰箭触发了冰指,没触发冰智,扔完之前冰指对应的冰枪立刻扔掉这个寒冰箭冰指的冰枪,回去打寒冰箭211 if fingersOfFrost_trigger <= fingersOfFrost_probability and brainFreeze_trigger > brainFreeze_probability:212 time = time + gcd213 damage = damage + iceLance_basic_damage_fingersOfFrost_expectation214 # 刚读完的寒冰箭触发了冰智,没触发冰指,扔完之前冰指对应的冰枪,打这个冰智的冰风暴+2冰枪215 elif fingersOfFrost_trigger > fingersOfFrost_probability and brainFreeze_trigger <= brainFreeze_probability:216 time = time + gcd * 3217 damage = damage + iceStorm_damage_brainFreeze_expectation + \218 iceLance_basic_damage_fingersOfFrost_expectation * 2219 brainFreeze_number = 0220 # 刚读完的寒冰箭触发了冰智和冰指,扔完之前冰指对应的冰枪,先扔这个寒冰箭冰指对应的冰枪,再打这个冰智的冰风暴+2冰枪221 elif fingersOfFrost_trigger <= fingersOfFrost_probability and brainFreeze_trigger <= brainFreeze_probability:222 time = time + gcd223 damage = damage + iceLance_basic_damage_fingersOfFrost_expectation224 time = time + gcd * 3225 damage = damage + iceStorm_damage_brainFreeze_expectation + iceLance_basic_damage_fingersOfFrost_expectation * 2226 brainFreeze_number = 0227 # 之前触发了冰智,没有触发冰指,正常1+1+2228 elif fingersOfFrost_number == 0 and brainFreeze_number == 1:229 time = time + gcd * 3230 damage = damage - frostBolt_damage_expectation + frostBolt_damage_freeze_expectation231 damage = damage + iceStorm_damage_brainFreeze_expectation + iceLance_basic_damage_fingersOfFrost_expectation * 2232 brainFreeze_number = 0233 # 刚读完的寒冰箭在之前冰智对应的冰风暴出手后,触发了冰指,没触发冰智,浪费一个冰指234 if fingersOfFrost_trigger <= fingersOfFrost_probability and brainFreeze_trigger > brainFreeze_probability:235 pass236 # 刚读完的寒冰箭在之前冰智对应的冰风暴出手后,触发冰智,没触发冰指,多了一个冰智,打完这个1+1+2,直接打这个冰智的冰风暴+2冰枪237 elif fingersOfFrost_trigger > fingersOfFrost_probability and brainFreeze_trigger <= brainFreeze_probability:238 time = time + gcd * 3239 damage = damage + iceStorm_damage_brainFreeze_expectation + \240 iceLance_basic_damage_fingersOfFrost_expectation * 2241 # 刚读完的寒冰箭在之前冰智对应的冰风暴出手后,触发了冰指和冰智,浪费一个冰指,多了一个冰智,打完这个1+1+2,242 # 直接打这个冰智的冰风暴+2冰枪243 elif fingersOfFrost_trigger <= fingersOfFrost_probability and brainFreeze_trigger <= brainFreeze_probability:244 time = time + gcd * 3245 damage = damage + iceStorm_damage_brainFreeze_expectation + \246 iceLance_basic_damage_fingersOfFrost_expectation * 2247 # 之前触发了冰智和冰指,读完这个寒冰箭,扔完所有冰指打之前冰智的冰风暴+2冰枪248 elif fingersOfFrost_number > 0 and brainFreeze_number == 1:249 while fingersOfFrost_number > 0:250 time = time + gcd251 damage = damage + iceLance_basic_damage_fingersOfFrost_expectation252 fingersOfFrost_number -= 1253 time = time + gcd * 3254 damage = damage + iceStorm_damage_brainFreeze_expectation + iceLance_basic_damage_fingersOfFrost_expectation * 2255 brainFreeze_number = 0256 #刚读完的寒冰箭触发了冰指,没触发冰智,扔完之前的冰指冰智,立刻扔掉这个寒冰箭冰指的冰枪,回去打寒冰箭257 if fingersOfFrost_trigger <= fingersOfFrost_probability and brainFreeze_trigger > brainFreeze_probability:258 time = time + gcd259 damage = damage + iceLance_basic_damage_fingersOfFrost_expectation260 # 刚读完的寒冰箭触发了冰智,没触发冰指,浪费一个冰智,扔完之前的冰指冰智,回头261 elif fingersOfFrost_trigger > fingersOfFrost_probability and brainFreeze_trigger <= brainFreeze_probability:262 pass263 # 刚读完的寒冰箭触发了冰智和冰指,浪费一个冰智,扔完之前冰指对应的冰枪,立刻扔掉这个寒冰箭冰指的冰枪,回头264 elif fingersOfFrost_trigger <= fingersOfFrost_probability and brainFreeze_trigger <= brainFreeze_probability:265 time = time + gcd266 damage = damage + iceLance_basic_damage_fingersOfFrost_expectation267 else:268 # 刚读完的寒冰箭,触发了冰指冰智269 if fingersOfFrost_trigger <= fingersOfFrost_probability and brainFreeze_trigger <= brainFreeze_probability:270 fingersOfFrost_number += 1271 fingersOfFrost_number = min(fingersOfFrost_number, 2)272 brainFreeze_number += 1273 brainFreeze_number = min(brainFreeze_number, 1)274 # 刚读完的寒冰箭,触发冰智,没触发冰指275 elif fingersOfFrost_trigger > fingersOfFrost_probability and brainFreeze_trigger <= brainFreeze_probability:276 brainFreeze_number += 1277 brainFreeze_number = min(brainFreeze_number, 1)278 # 刚读完的寒冰箭触发了冰指没触发冰智279 elif fingersOfFrost_trigger <= fingersOfFrost_probability and brainFreeze_trigger > brainFreeze_probability:280 fingersOfFrost_number += 1281 fingersOfFrost_number = min(fingersOfFrost_number, 2)282dps_3 = damage / time283damage = 0284time = 0285fingersOfFrost_number = 0286brainFreeze_number = 0287#第四种打法,除非刚好读完一个寒冰箭同时有冰智,否则不打1+1+2,直接打冰风暴+2冰枪,同时有冰智冰指,冰智优先,即浪费掉冰指(定性也能分析出这个不行)288while damage < 100000000000:289 #读条一个寒冰箭290 time = time + freezeBolt_spellTime291 damage = damage + frostBolt_damage_expectation292 fingersOfFrost_trigger = np.random.random()293 brainFreeze_trigger = np.random.random()294 #之前有冰指,没有触发冰智,读完这个寒冰箭打一个冰指的冰枪295 if fingersOfFrost_number > 0 and brainFreeze_number == 0:296 time = time + gcd297 damage = damage + iceLance_basic_damage_fingersOfFrost_expectation298 fingersOfFrost_number -= 1299 #刚读完的寒冰箭触发了冰指,没触发冰智,扔掉所有之前存的冰指再扔了这个冰指,回去打寒冰箭300 if fingersOfFrost_trigger <= fingersOfFrost_probability and brainFreeze_trigger > brainFreeze_probability:301 while fingersOfFrost_number > 0:302 time = time + gcd303 damage = damage + iceLance_basic_damage_fingersOfFrost_expectation304 fingersOfFrost_number -= 1305 time = time + gcd306 damage = damage + iceLance_basic_damage_fingersOfFrost_expectation307 # 刚读完的寒冰箭触发了冰智,没触发冰指,打冰风暴+2冰枪,可能浪费冰指308 elif fingersOfFrost_trigger > fingersOfFrost_probability and brainFreeze_trigger <= brainFreeze_probability:309 time = time + gcd * 3310 damage = damage + iceStorm_damage_brainFreeze_expectation + \311 iceLance_basic_damage_fingersOfFrost_expectation * 2312 fingersOfFrost_number = 0313 # 刚读完的寒冰箭触发了冰智和冰指,打冰风暴+2冰枪,起码浪费1冰指314 elif fingersOfFrost_trigger <= fingersOfFrost_probability and brainFreeze_trigger <= brainFreeze_probability:315 time = time + gcd * 3316 damage = damage + iceStorm_damage_brainFreeze_expectation + \317 iceLance_basic_damage_fingersOfFrost_expectation * 2318 fingersOfFrost_number = 0319 # 之前触发了冰智,没有触发冰指,正常1+1+2320 elif fingersOfFrost_number == 0 and brainFreeze_number == 1:321 time = time + gcd * 3322 damage = damage - frostBolt_damage_expectation + frostBolt_damage_freeze_expectation323 damage = damage + iceStorm_damage_brainFreeze_expectation + \324 iceLance_basic_damage_fingersOfFrost_expectation * 2325 brainFreeze_number = 0326 #刚读完的寒冰箭在之前冰智对应的冰风暴出手后,触发了冰指,没触发冰智,浪费一个冰指327 if fingersOfFrost_trigger <= fingersOfFrost_probability and brainFreeze_trigger > brainFreeze_probability:328 pass329 # 刚读完的寒冰箭在之前冰智对应的冰风暴出手后,触发冰智,没触发冰指,打完之前冰智的1+1+2,打这个冰智的冰风暴+2冰枪330 elif fingersOfFrost_trigger > fingersOfFrost_probability and brainFreeze_trigger <= brainFreeze_probability:331 time = time + gcd * 3332 damage = damage + iceStorm_damage_brainFreeze_expectation + \333 iceLance_basic_damage_fingersOfFrost_expectation * 2334 # 刚读完的寒冰箭在之前冰智对应的冰风暴出手后,触发了冰指和冰智,打完之前冰智的1+1+2,打这个冰智的冰风暴+2冰枪,浪费一个冰指335 elif fingersOfFrost_trigger <= fingersOfFrost_probability and brainFreeze_trigger <= brainFreeze_probability:336 time = time + gcd * 3337 damage = damage + iceStorm_damage_brainFreeze_expectation + \338 iceLance_basic_damage_fingersOfFrost_expectation * 2339 # 之前触发了冰智和冰指,浪费掉存的冰指正常1+1+2340 elif fingersOfFrost_number > 0 and brainFreeze_number == 1:341 time = time + gcd * 3342 damage = damage - frostBolt_damage_expectation + frostBolt_damage_freeze_expectation343 damage = damage + iceStorm_damage_brainFreeze_expectation + iceLance_basic_damage_fingersOfFrost_expectation * 2344 brainFreeze_number = 0345 fingersOfFrost_number = 0346 #刚读完的寒冰箭之前冰智对应的冰风暴出手后,触发了冰指,没触发冰智,浪费一个冰指347 if fingersOfFrost_trigger <= fingersOfFrost_probability and brainFreeze_trigger > brainFreeze_probability:348 pass349 # 刚读完的寒冰箭在之前冰智对应的冰风暴出手后,触发冰智,没触发冰指,打冰风暴+2冰枪350 elif fingersOfFrost_trigger > fingersOfFrost_probability and brainFreeze_trigger <= brainFreeze_probability:351 time = time + gcd * 3352 damage = damage + iceStorm_damage_brainFreeze_expectation + \353 iceLance_basic_damage_fingersOfFrost_expectation * 2354 # 刚读完的寒冰箭在前一个寒冰箭冰智对应的冰风暴出手后,触发了冰指和冰智,浪费一个冰指,打冰风暴+2冰枪355 elif fingersOfFrost_trigger <= fingersOfFrost_probability and brainFreeze_trigger <= brainFreeze_probability:356 time = time + gcd * 3357 damage = damage + iceStorm_damage_brainFreeze_expectation + \358 iceLance_basic_damage_fingersOfFrost_expectation * 2359 #之前啥都没,读完这个寒冰箭计算完触发,回头继续读360 else:361 # 刚读完的寒冰箭,触发了冰指冰智362 if fingersOfFrost_trigger <= fingersOfFrost_probability and brainFreeze_trigger <= brainFreeze_probability:363 fingersOfFrost_number += 1364 fingersOfFrost_number = min(fingersOfFrost_number, 2)365 brainFreeze_number += 1366 brainFreeze_number = min(brainFreeze_number, 1)367 # 刚读完的寒冰箭,触发冰智,没触发冰指368 elif fingersOfFrost_trigger > fingersOfFrost_probability and brainFreeze_trigger <= brainFreeze_probability:369 brainFreeze_number += 1370 brainFreeze_number = min(brainFreeze_number, 1)371 # 刚读完的寒冰箭触发了冰指没触发冰智372 elif fingersOfFrost_trigger <= fingersOfFrost_probability and brainFreeze_trigger > brainFreeze_probability:373 fingersOfFrost_number += 1374 fingersOfFrost_number = min(fingersOfFrost_number, 2)375dps_4 = damage / time376print(dps_1)377print(dps_2)378print(dps_3)...

Full Screen

Full Screen

test_timeout.py

Source:test_timeout.py Github

copy

Full Screen

...15 timeout = TimeoutManager()16 with pytest.raises(asyncio.TimeoutError):17 async with timeout.async_timeout(0.1):18 await hass.async_add_executor_job(lambda: time.sleep(0.2))19async def test_simple_global_timeout_freeze():20 """Test a simple global timeout freeze."""21 timeout = TimeoutManager()22 async with timeout.async_timeout(0.2):23 async with timeout.async_freeze():24 await asyncio.sleep(0.3)25async def test_simple_zone_timeout_freeze_inside_executor_job(hass):26 """Test a simple zone timeout freeze inside an executor job."""27 timeout = TimeoutManager()28 def _some_sync_work():29 with timeout.freeze("recorder"):30 time.sleep(0.3)31 async with timeout.async_timeout(1.0):32 async with timeout.async_timeout(0.2, zone_name="recorder"):33 await hass.async_add_executor_job(_some_sync_work)34async def test_simple_global_timeout_freeze_inside_executor_job(hass):35 """Test a simple global timeout freeze inside an executor job."""36 timeout = TimeoutManager()37 def _some_sync_work():38 with timeout.freeze():39 time.sleep(0.3)40 async with timeout.async_timeout(0.2):41 await hass.async_add_executor_job(_some_sync_work)42async def test_mix_global_timeout_freeze_and_zone_freeze_inside_executor_job(hass):43 """Test a simple global timeout freeze inside an executor job."""44 timeout = TimeoutManager()45 def _some_sync_work():46 with timeout.freeze("recorder"):47 time.sleep(0.3)48 async with timeout.async_timeout(0.1):49 async with timeout.async_timeout(0.2, zone_name="recorder"):50 await hass.async_add_executor_job(_some_sync_work)51async def test_mix_global_timeout_freeze_and_zone_freeze_different_order(hass):52 """Test a simple global timeout freeze inside an executor job before timeout was set."""53 timeout = TimeoutManager()54 def _some_sync_work():55 with timeout.freeze("recorder"):56 time.sleep(0.4)57 async with timeout.async_timeout(0.1):58 hass.async_add_executor_job(_some_sync_work)59 async with timeout.async_timeout(0.2, zone_name="recorder"):60 await asyncio.sleep(0.3)61async def test_mix_global_timeout_freeze_and_zone_freeze_other_zone_inside_executor_job(62 hass,63):64 """Test a simple global timeout freeze other zone inside an executor job."""65 timeout = TimeoutManager()66 def _some_sync_work():67 with timeout.freeze("not_recorder"):68 time.sleep(0.3)69 with pytest.raises(asyncio.TimeoutError):70 async with timeout.async_timeout(0.1):71 async with timeout.async_timeout(0.2, zone_name="recorder"):72 async with timeout.async_timeout(0.2, zone_name="not_recorder"):73 await hass.async_add_executor_job(_some_sync_work)74async def test_mix_global_timeout_freeze_and_zone_freeze_inside_executor_job_second_job_outside_zone_context(75 hass,76):77 """Test a simple global timeout freeze inside an executor job with second job outside of zone context."""78 timeout = TimeoutManager()79 def _some_sync_work():80 with timeout.freeze("recorder"):81 time.sleep(0.3)82 with pytest.raises(asyncio.TimeoutError):83 async with timeout.async_timeout(0.1):84 async with timeout.async_timeout(0.2, zone_name="recorder"):85 await hass.async_add_executor_job(_some_sync_work)86 await hass.async_add_executor_job(lambda: time.sleep(0.2))87async def test_simple_global_timeout_freeze_with_executor_job(hass):88 """Test a simple global timeout freeze with executor job."""89 timeout = TimeoutManager()90 async with timeout.async_timeout(0.2):91 async with timeout.async_freeze():92 await hass.async_add_executor_job(lambda: time.sleep(0.3))93async def test_simple_global_timeout_freeze_reset():94 """Test a simple global timeout freeze reset."""95 timeout = TimeoutManager()96 with pytest.raises(asyncio.TimeoutError):97 async with timeout.async_timeout(0.2):98 async with timeout.async_freeze():99 await asyncio.sleep(0.1)100 await asyncio.sleep(0.2)101async def test_simple_zone_timeout():102 """Test a simple zone timeout."""103 timeout = TimeoutManager()104 with pytest.raises(asyncio.TimeoutError):105 async with timeout.async_timeout(0.1, "test"):106 await asyncio.sleep(0.3)107async def test_multiple_zone_timeout():108 """Test a simple zone timeout."""109 timeout = TimeoutManager()110 with pytest.raises(asyncio.TimeoutError):111 async with timeout.async_timeout(0.1, "test"):112 async with timeout.async_timeout(0.5, "test"):113 await asyncio.sleep(0.3)114async def test_different_zone_timeout():115 """Test a simple zone timeout."""116 timeout = TimeoutManager()117 with pytest.raises(asyncio.TimeoutError):118 async with timeout.async_timeout(0.1, "test"):119 async with timeout.async_timeout(0.5, "other"):120 await asyncio.sleep(0.3)121async def test_simple_zone_timeout_freeze():122 """Test a simple zone timeout freeze."""123 timeout = TimeoutManager()124 async with timeout.async_timeout(0.2, "test"):125 async with timeout.async_freeze("test"):126 await asyncio.sleep(0.3)127async def test_simple_zone_timeout_freeze_without_timeout():128 """Test a simple zone timeout freeze on a zone that does not have a timeout set."""129 timeout = TimeoutManager()130 async with timeout.async_timeout(0.1, "test"):131 async with timeout.async_freeze("test"):132 await asyncio.sleep(0.3)133async def test_simple_zone_timeout_freeze_reset():134 """Test a simple zone timeout freeze reset."""135 timeout = TimeoutManager()136 with pytest.raises(asyncio.TimeoutError):137 async with timeout.async_timeout(0.2, "test"):138 async with timeout.async_freeze("test"):139 await asyncio.sleep(0.1)140 await asyncio.sleep(0.2, "test")141async def test_mix_zone_timeout_freeze_and_global_freeze():142 """Test a mix zone timeout freeze and global freeze."""143 timeout = TimeoutManager()144 async with timeout.async_timeout(0.2, "test"):145 async with timeout.async_freeze("test"):146 async with timeout.async_freeze():147 await asyncio.sleep(0.3)148async def test_mix_global_and_zone_timeout_freeze_():149 """Test a mix zone timeout freeze and global freeze."""150 timeout = TimeoutManager()151 async with timeout.async_timeout(0.2, "test"):152 async with timeout.async_freeze():153 async with timeout.async_freeze("test"):154 await asyncio.sleep(0.3)155async def test_mix_zone_timeout_freeze():156 """Test a mix zone timeout global freeze."""157 timeout = TimeoutManager()158 async with timeout.async_timeout(0.2, "test"):159 async with timeout.async_freeze():160 await asyncio.sleep(0.3)161async def test_mix_zone_timeout():162 """Test a mix zone timeout global."""163 timeout = TimeoutManager()164 async with timeout.async_timeout(0.1):165 with suppress(asyncio.TimeoutError):166 async with timeout.async_timeout(0.2, "test"):167 await asyncio.sleep(0.4)168async def test_mix_zone_timeout_trigger_global():169 """Test a mix zone timeout global with trigger it."""170 timeout = TimeoutManager()171 with pytest.raises(asyncio.TimeoutError):172 async with timeout.async_timeout(0.1):173 with suppress(asyncio.TimeoutError):174 async with timeout.async_timeout(0.1, "test"):175 await asyncio.sleep(0.3)176 await asyncio.sleep(0.3)177async def test_mix_zone_timeout_trigger_global_cool_down():178 """Test a mix zone timeout global with trigger it with cool_down."""179 timeout = TimeoutManager()180 async with timeout.async_timeout(0.1, cool_down=0.3):181 with suppress(asyncio.TimeoutError):182 async with timeout.async_timeout(0.1, "test"):183 await asyncio.sleep(0.3)184 await asyncio.sleep(0.2)185async def test_simple_zone_timeout_freeze_without_timeout_cleanup(hass):186 """Test a simple zone timeout freeze on a zone that does not have a timeout set."""187 timeout = TimeoutManager()188 async def background():189 async with timeout.async_freeze("test"):190 await asyncio.sleep(0.4)191 async with timeout.async_timeout(0.1):192 hass.async_create_task(background())193 await asyncio.sleep(0.2)194async def test_simple_zone_timeout_freeze_without_timeout_cleanup2(hass):195 """Test a simple zone timeout freeze on a zone that does not have a timeout set."""196 timeout = TimeoutManager()197 async def background():198 async with timeout.async_freeze("test"):199 await asyncio.sleep(0.2)200 with pytest.raises(asyncio.TimeoutError):201 async with timeout.async_timeout(0.1):202 hass.async_create_task(background())203 await asyncio.sleep(0.3)204async def test_simple_zone_timeout_freeze_without_timeout_exeption():205 """Test a simple zone timeout freeze on a zone that does not have a timeout set."""206 timeout = TimeoutManager()207 with pytest.raises(asyncio.TimeoutError):208 async with timeout.async_timeout(0.1):209 with suppress(RuntimeError):210 async with timeout.async_freeze("test"):211 raise RuntimeError()212 await asyncio.sleep(0.4)213async def test_simple_zone_timeout_zone_with_timeout_exeption():214 """Test a simple zone timeout freeze on a zone that does not have a timeout set."""215 timeout = TimeoutManager()216 with pytest.raises(asyncio.TimeoutError):217 async with timeout.async_timeout(0.1):218 with suppress(RuntimeError):219 async with timeout.async_timeout(0.3, "test"):220 raise RuntimeError()...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run hypothesis automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful