From 9191cd7f4d4ed71084f26e92fb2514af3a7912ee Mon Sep 17 00:00:00 2001 From: hppeng Date: Sun, 13 Feb 2022 10:47:23 -0800 Subject: [PATCH] Fix small quirk/bug with skillpoints behavior when you delete it instead of typing 0 --- js/builder.js | 4 ++-- testing/ms_sslow.py | 17 +++++++++++------ 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/js/builder.js b/js/builder.js index 518f3a1..811245f 100644 --- a/js/builder.js +++ b/js/builder.js @@ -588,14 +588,14 @@ function updateStats() { let delta_total = 0; for (let i in skp_order) { let value = document.getElementById(skp_order[i] + "-skp").value; - if (value === ""){value = 0; setValue(skp_order[i] + "-skp", value)} + if (value === ""){value = "0"; setValue(skp_order[i] + "-skp", value)} let manual_assigned = 0; if (value.includes("+")) { let skp = value.split("+"); for (const s of skp) { manual_assigned += parseInt(s,10); } - } else { + } else { manual_assigned = parseInt(value,10); } let delta = manual_assigned - skillpoints[i]; diff --git a/testing/ms_sslow.py b/testing/ms_sslow.py index 3cd068b..8b76da5 100644 --- a/testing/ms_sslow.py +++ b/testing/ms_sslow.py @@ -3,9 +3,9 @@ import numpy.linalg as la import matplotlib.pyplot as plt # Super slow attack speed. (Idealized to 1 hit/2s, 2/3 chance of proc -mana_consumption = 3 -mana_steal = 5 # /3s -mana_regen = 4 # /5s +mana_consumption = 6 +mana_steal = 14 # /3s +mana_regen = 6 # /5s #mana_steal = 5 # /3s #mana_regen = 5 # /5s natural_regen = 1 @@ -41,20 +41,25 @@ print("mana\tcumulative probability") for i in range(MAX_MANA): print(f"{i+1}\t{cumulative[i]}") +mana_limit = 6+mana_consumption + x_ticks = list(range(len(steady_state))) plt.figure() plt.scatter(x_ticks, steady_state, label="mana values") plt.xlim(0, 19) plt.ylim(0, 0.3) -plt.axvline(x=6+mana_consumption) +plt.axvline(x=mana_limit, color="red") plt.xlabel("Mana Value") plt.xticks(x_ticks) plt.ylabel("Probability at t=infty") plt.legend() ax2 = plt.gca().twinx() -ax2.plot(x_ticks, cumulative, label="cumulative probability") +ax2.plot(x_ticks, cumulative, label="cumulative probability", color="pink") + +plt.text(mana_limit - 0.2, cumulative[mana_limit] + 0.03, f"time with sprint loss: {cumulative[mana_limit]*100:.2f}%", horizontalalignment='right') +plt.scatter((mana_limit,), (cumulative[mana_limit],), color="red") ax2.set_ylim(0, 1) ax2.set_ylabel("Cumulative probability at t=infty") -plt.title(f"Build={mana_regen}mr,{mana_steal}ms,{mana_consumption}mana/sec") +plt.title(f"Super Slow Speed: Build={mana_regen}mr,{mana_steal}ms,{mana_consumption}mana/sec") plt.legend() plt.show()